Autocast Toggle - KonradHeinser/EBSGFramework GitHub Wiki
If you are making a think tree that autocasts abilities, players may want specific abilities or pawns to not cast stuff. The Think Tree Stuff covers wide scale disabling through think tree settings, while this page explains how to allow players to disable the abilities for specific pawns.
WARNING: Due to how psycasts are coded, this will not work for them. The psycast ability class completely overrides this gizmo class, and I didn't want to try to create psycast versions of these due to the risk of accidentally blowing things up
In the AbilityDef you will need to set the gizmoClass, and you will need to add the autocast toggle comp:
<gizmoClass>EBSGFramework.Command_AbilityAutocastToggle</gizmoClass>
This framework contains default icons to indicate active/inactive, so if you want to use those, you only need to add an empty version of the comp:
<comps>
<li Class="EBSGFramework.CompProperties_AbilityAutocastToggle" />
</comps>
If you want to change one or both of the icons for your ability, you can active/inactive to the comp, and put the file path as the value:
<comps>
<li Class="EBSGFramework.CompProperties_AbilityAutocastToggle">
<active>EBSG/AutoOn</active>
<inactive>EBSG/AutoOff</inactive>
</li>
</comps>
To make a think tree check if autocast is enabled for a specific ability, you will need to use the has ability usable conditional in this framework:
<li Class="EBSGFramework.ThinkNode_ConditionalHasAbilityUsable">
<ability>InsertDefName</ability>
<subNodes>
<li Class="EBSGFramework.ThinkNode_RecordPassage" />
</subNodes>
</li>
- If you are using the EBSG Colonist Tree, remember that there is a setting that stops all colonists from casting all of the abilities, even is this says the ability will be auto-cast. This setting is disabled by default to try to minimize player frustration with colonists using abilities at undesired times, so if you or a player are finding that colonists are not casting their abilities automatically, check to make sure that setting is active
- The only conditional node that actually checks if autocast is disabled is EBSGFramework.ThinkNode_ConditionalHasAbilityUsable, so you will need to either use that node or create your own if you know C#
- If you do not see icons, then you are missing either the gizmoClass or the comp.
This example took the fire spew ability, and just added the comp in its simplest form and the gizmo:
<AbilityDef>
<defName>AutoFireSpew</defName>
<label>auto fire spew</label>
<description>Spit a stream of sticky, flammable bile from the mouth. The bile can ignite anything or anyone it hits, and also form flaming pools on the ground.\n\nThe bile is generated and stored by an organ in the neck, along with a separate pouch of hypergolic reactant for ignition.</description>
<iconPath>UI/Abilities/FireSpew</iconPath>
<cooldownTicksRange>300000</cooldownTicksRange>
<gizmoClass>EBSGFramework.Command_AbilityAutocastToggle</gizmoClass>
<aiCanUse>true</aiCanUse>
<ai_IsIncendiary>true</ai_IsIncendiary>
<sendMessageOnCooldownComplete>true</sendMessageOnCooldownComplete>
<warmupStartSound>FireSpew_Warmup</warmupStartSound>
<verbProperties>
<verbClass>Verb_CastAbility</verbClass>
<range>7.9</range>
<warmupTime>1</warmupTime>
<soundCast>FireSpew_Resolve</soundCast>
<targetParams>
<canTargetLocations>true</canTargetLocations>
</targetParams>
</verbProperties>
<comps>
<li Class="CompProperties_AbilityFireSpew">
<range>7.9</range>
<lineWidthEnd>3</lineWidthEnd>
<filthDef>Filth_FlammableBile</filthDef>
<effecterDef>Fire_Spew</effecterDef>
<canHitFilledCells>true</canHitFilledCells>
</li>
<li Class="EBSGFramework.CompProperties_AbilityAutocastToggle" />
</comps>
</AbilityDef>