Ability Validator - KonradHeinser/EBSGFramework GitHub Wiki
This ability comp allows you to set up abilities that can only be used in certain conditions. This can check various things, from the conditions on the caster's map, the caster themselves, and the target. The basic comp looks like this:
<comps>
<li Class="EBSGFramework.CompProperties_AbilityAbilityValidator">
</li>
</comps>
There are two options that allow you to alter when the gizmo is usable/visible
- disableGizmo : Default (True) : Checks the caster conditions, and if any of them fail then the gizmo is unusable. Generally recommended to leave this as true
- hideGizmo : Default (False) : Hides the gizmo when it's disabled
- noMessage : Default (False) : Prevents the message from popping up when the player clicks on an invalid pawn or the AI fails mid-cast. Unfortunately, due to the way that Ludeon coded abilities and AI checks, you'll need to set this to True if you do have an enemy AI that can cast this ability, and said ability is likely to be cast by multiple pawns at once
These are the options for checking the conditions on the caster's map:
-
progressThroughDay : Default (0~1) : % of progress through the day when this will be active. For example, if this is set to be 0~0.5, then the ability is usable from midnight until noon, 0.5~1 would be noon until midnight, and 0.25~0.75 6:00 to 18:00
- If you aren't sure what to put for the percentage, take the hour you want it to start/end at, and divide it by 24. For example, if you want the available times to be 5:00-15:00 (5-3 for those who stick to 12 hour clocks), you would do 5/24 and 15/24 to get 0.208~0.625
-
invertTime : Default (False) : Makes it so progressThroughDay looks to make sure the value is outside the range instead of inside. This can be used to set up times that pass through midnight as it will result in you specifying the range of times when the ability does not work
- For example, the 0.208~0.625 in the example (5:00-15:00, morning to afternoon) would instead check for 15:00-5:00 (afternoon to morning)
-
seasons : A list of valid seasons for this ability to be usable. The options are Spring, Summer, Fall, Winter, PermanentSummer, and PermanentWinter. Summer includes both normal Summer and PermanentSummer, and Winter checks for both Winter and PermanentWinter. However, PermanentSummer and PermanentWinter do not check for their temporary variants
-
checkRoofForRainSnowRate : Default (False) : When set to true, the ability can't be cast if the pawn is under a roof and needs some rain, and will be able to ignore max snow/rain when under a roof
-
rainRate : Default (0~9999) : The rain rate of the map's active WeatherDef must be in this range
-
snowRate : Default (0~9999) : The snow rate of the map's active WeatherDef must be in this range
-
requireOneOfWeather : List of WeatherDefs that allow the ability to be used
-
forbiddenWeather : List of WeatherDefs that prevent the ability from being used
-
requireOneOfCondition : List of GameConditionDefs that allow the ability to be used
-
forbiddenMapConditions : List of GameConditionDefs that prevent the ability from being used
Caster checking tags:
-
casterRoof : Default (NoCheck) : Checks the roofing above the caster's head, if there is any. The options are NoRoof, NoThickRoof, AnyRoof, and ThickRoof
-
casterLightLevel : Default (0~1) : The light level of the area the pawn is standing must be in this range
-
invertCasterLight : Default (False) : Makes it so casterLightLevel looks to make sure the value is outside the range instead of inside
- For example, if you set the light level to 0.3~0.7, then invert it, instead of looking for light levels between 30% and 70%, it looks for light levels below 30% or above 70%
-
casterHasAnyOfHediffs : List of HediffDefs that the pawn requires at least one of for the ability to be usable
-
casterHasAllOfHediffs : List of HediffDefs that the pawn needs to have all of for the ability to be usable
-
casterHasNoneOfHediffs : List of HediffDefs that prevent casting if the pawn has any of them
-
casterCapLimiters : Special list of PawnCapacityDefs that uses the DefName for the tag, and the valid range for the value
-
casterSkillLimiters : Special list of SkillDefs that uses the DefName for the tag, and the valid range for the value
-
casterStatLimiters : Special list of StatDefs that uses the DefName for the tag, and the valid range for the value
-
casterNeedLevels : Special list of NeedDefs that uses the DefName for the tag, and the valid range for the value
-
validCasterFactions : List of FactionDefs that the caster must be part of. It is generally recommended to have disableGizmo and hideGizmo set to true when using this
-
forrbiddenCasterFactions : List of FactionDefs that the caster cannot be a part of. It is generally recommended to have disableGizmo and hideGizmo set to true when using this
Target checking tags:
-
targetRoof : Default (NoCheck) : Checks the roofing above the caster's head, if there is any. The options are NoRoof, NoThickRoof, AnyRoof, and ThickRoof
-
targetLightLevel : Default (0~1) : The light level of the area the target is standing must be in this range
-
invertTargetLight : Default (False) : Makes it so targetLightLevel looks to make sure the value is outside the range instead of inside
- For example, if you set the light level to 0.3~0.7, then invert it, instead of looking for light levels between 30% and 70%, it looks for light levels below 30% or above 70%
-
bodySize : Default (0~999) : The body size of the target must be in this range
-
invertBodySize : Default (False) : Makes it so bodySize looks to make sure the value is outside the range instead of inside
-
targetHasAnyOfHediffs : List of HediffDefs that the target requires at least one of for the ability to be usable
-
targetHasAllOfHediffs : List of HediffDefs that the target needs to have all of for the ability to be usable
-
targetHasNoneOfHediffs : List of HediffDefs that prevent casting if the target has any of them
-
targetIsOneOfXenotype : List of XenotypeDefs that can be targeted. Doesn't work so well with the gene options due to how xenotypes are handled
-
targetIsNoneOfXenotype : List of XenotypeDefs that cannot be targeted. Ideally a specific gene would be used in place of this due to how inheritance and xenotypes are handled, but this can be used if you only want certain groups of pawns with the gene to be immune
-
targetHasAnyOfGenes : List of GeneDefs that the target requires at least one of for the ability to be usable
-
targetHasAllOfGenes : List of GeneDefs that the target needs to have all of for the ability to be usable
-
targetHasNoneOfGenes : List of GeneDefs that prevent casting if the target has any of them
-
targetCapLimiters : Special list of PawnCapacityDefs that uses the DefName for the tag, and the valid range for the value
-
targetSkillLimiters : Special list of SkillDefs that uses the DefName for the tag, and the valid range for the value
-
targetStatLimiters : Special list of StatDefs that uses the DefName for the tag, and the valid range for the value
-
targetNeedLevels : Special list of NeedDefs that uses the DefName for the tag, and the valid range for the value
-
targetGroup : Restricts the ability to cover only those who fit into certain categories (usually faction based). The options are Player, NonPlayer, Hostiles, and NoFaction. Hostiles goes by Rimworld's definition, so usually it only covers opposing factions or immediate threats
-
validTargetFactions : List of FactionDefs that the target must be part of. It is generally recommended to have disableGizmo and hideGizmo set to true when using this
-
forrbiddenTargetFactions : List of FactionDefs that the target cannot be a part of. It is generally recommended to have disableGizmo and hideGizmo set to true when using this
These are examples from SHG - Just the Radiomancer. The first one is impossible to cast on pawns that have the radiomancer gene (a prerequisite for the cellular destabilization gene), and the second one is impossible to cast on pawns that already have the related hediff
<AbilityDef>
<defName>SHG_Radiomancer_CellularDestabilization</defName>
<label>cellular destabilization</label>
<description>There was a description here.</description>
<iconPath>Radiomancer/Decay/Gene_Radiomancer_CellularDestabilization</iconPath>
<jobDef>CastAbilityOnThingWithoutWeaponInterruptible</jobDef>
<aiCanUse>True</aiCanUse>
<cooldownTicksRange>100</cooldownTicksRange>
<hostile>true</hostile>
<verbProperties>
<verbClass>Verb_CastAbility</verbClass>
<warmupTime>1</warmupTime>
<range>10</range>
</verbProperties>
<comps>
<li Class="EBSGFramework.CompProperties_AbilityAbilityValidator">
<targetHasNoneOfGenes>
<li>SHG_Archetypes_Radiomancer</li>
</targetHasNoneOfGenes>
</li>
<li Class="CompProperties_AbilityGiveHediff">
<compClass>CompAbilityEffect_GiveHediff</compClass>
<hediffDef>SHG_Radiomancer_CellularDestabilization</hediffDef>
</li>
<li Class="EBSGFramework.CompProperties_AbilityResourceCost">
<resourceCost>0.20</resourceCost>
<mainResourceGene>SHG_Archetypes_Radiomancer</mainResourceGene>
</li>
</comps>
</AbilityDef>
<AbilityDef>
<defName>SHG_Radiomancer_LimitlessPotential</defName>
<label>limitless potential</label>
<description>There was a description here.</description>
<iconPath>Radiomancer/Emission/Gene_Radiomancer_LimitlessPotential</iconPath>
<displayGizmoWhileUndrafted>True</displayGizmoWhileUndrafted>
<disableGizmoWhileUndrafted>False</disableGizmoWhileUndrafted>
<jobDef>CastAbilityOnThingWithoutWeaponInterruptible</jobDef>
<aiCanUse>True</aiCanUse>
<cooldownTicksRange>100</cooldownTicksRange>
<hostile>false</hostile>
<verbProperties>
<verbClass>Verb_CastAbility</verbClass>
<warmupTime>1</warmupTime>
<range>10</range>
<targetParams>
<canTargetSelf>True</canTargetSelf>
<canTargetBuildings>False</canTargetBuildings>
<canTargetMechs>False</canTargetMechs>
<canTargetAnimals>False</canTargetAnimals>
</targetParams>
</verbProperties>
<comps>
<li Class="EBSGFramework.CompProperties_AbilityAbilityValidator">
<targetHasNoneOfHediffs>
<li>SHG_Radiomancer_LimitlessPotential</li>
</targetHasNoneOfHediffs>
</li>
<li Class="EBSGFramework.CompProperties_AbilityGiveMultipleHediffs">
<hediffsToGive>
<li><hediffDef>SHG_Radiomancer_LimitlessPotential</hediffDef></li>
<li><hediffDef>SHG_EverEvolving_Enlightenment</hediffDef></li>
</hediffsToGive>
</li>
<li Class="EBSGFramework.CompProperties_AbilityResourceCost">
<resourceCost>0.1</resourceCost>
<mainResourceGene>SHG_Archetypes_Radiomancer</mainResourceGene>
</li>
</comps>
</AbilityDef>