
Preview with regards to the XML gizmos. Light on the left has had the Red portion of its RGB values set to about 0 using the "Less Red" button, while the one on the right has a Red of about 0.8 to 0.9.
Gizmos are defined as follows:
Code Select
<?xml version="1.0" encoding="utf-8" ?>
<Reikentech.CommandDefs>
<Reikentech.CommandDef>
<defName>DecreaseGlowerRed</defName>
<label>Less Red</label>
<description>Decrease the Red value by 10%.</description>
<uiIconPath>Interface/Gizmos/Less_Red</uiIconPath>
<requirements>
<li>
<type>ResearchProjectDef</type>
<helper>ColoredLights</helper>
<property>IsFinished</property>
<value>true</value>
<reqType>Default</reqType>
</li>
</requirements>
<actions>
<li>
<compType>Reikentech.CompGlowerDynamic</compType>
<actionType>Offset</actionType>
<property>Red</property>
<value>-0.10</value>
</li>
</actions>
</Reikentech.CommandDef>
<Reikentech.CommandDef>
<defName>IncreaseGlowerRed</defName>
<label>More Red</label>
<description>Increase the Red value by 10%.</description>
<uiIconPath>Interface/Gizmos/More_Red</uiIconPath>
<requirements>
<li>
<type>ResearchProjectDef</type>
<helper>ColoredLights</helper>
<property>IsFinished</property>
<value>true</value>
<reqType>Default</reqType>
</li>
</requirements>
<actions>
<li>
<compType>Reikentech.CompGlowerDynamic</compType>
<actionType>Offset</actionType>
<property>Red</property>
<value>0.10</value>
</li>
</actions>
</Reikentech.CommandDef>
</Reikentech.CommandDefs>Adding Gizmos to a Thing involves giving it a CompProperties_Commands object:
Code Select
<ThingDef ParentName="Wall" Name="WallLampBase" Abstract="True">
<defName>WallLampBase</defName>
<description>An impassable wall with an embedded electrical lamp. Capable of holding up a roof.</description>
<costList>
<Steel>30</Steel>
</costList>
<building>
<isInert>true</isInert>
<ignoreNeedsPower>false</ignoreNeedsPower>
<canPlaceOverWall>true</canPlaceOverWall>
</building>
<comps>
<li Class="CompProperties_Power">
<compClass>CompPowerTrader</compClass>
<basePowerConsumption>60</basePowerConsumption>
<shortCircuitInRain>false</shortCircuitInRain>
<transmitsPower>true</transmitsPower>
</li>
<li Class="CompProperties_Glower">
<compClass>Reikentech.CompGlowerDynamic</compClass>
<glowRadius>12</glowRadius>
<glowColor>(217,217,208,0)</glowColor>
</li>
<li Class="Reikentech.CompProperties_Commands">
<commandGroups>
<li>
<type>Default</type>
<commands>
<li>DecreaseGlowerRed</li>
<li>IncreaseGlowerRed</li>
</commands>
</li>
</commandGroups>
</li>
</comps>
</ThingDef>In this case, CompProperties_Glower needed to have its ThingComp class set to a custom CompGlowerDynamic instead of the vanilla CompGlower, but otherwise it works about the same as usual.
Commands are separated into "Command Groups" because each group can be displayed in a different way according to the display type. Currently I have:
- Default, which just displays all the gizmos
- Toggle, which displays all the gizmos with on/off checkboxes
- Radio, which which functions like Toggle except only one gizmo can be "On" at a given time
- Radio_Linear, which is like Radio except it only displays the Previous, Current, and Next gizmos to save space. If the current gizmo is the first/last gizmo in the list, then only two gizmos are displayed. Designed for things like, say, sequential levels of power production on a generator (Low, Medium, High, Ultra).
- Radio_Loop, which functions identically to Radio_Linear except the front of the list connects to the back and vice-versa.



