-
Notifications
You must be signed in to change notification settings - Fork 59
ThingDef Extension
ThingDefExtension has a lot of fields to tweak behaviours of ThingDefs:
// For weapons
public bool? usableWithShields = false;
public WeaponDrawOffsets weaponCarryDrawOffsets = null; // Offsets carried weapon regardless of stance
public WeaponDrawOffsets weaponDraftedDrawOffsets = null; // Only when drafted but not actively attacking/aiming
// For shields and apparel
public List<PawnKindDef> useFactionColourForPawnKinds;
// For artillery
public float siegeBlueprintPoints = SiegeBlueprintPlacer.ArtyCost;
// For thing that can be discovered by deep scanner
public Color deepColor = Color.white;
public float transparencyMultiplier = 0.5f;
public bool allowDeepDrill = true;
// For buildings that need to render deep resources mouse attachments
public bool deepResourcesOnGUI = false;
public bool deepResourcesOnGUIRequireScanner = true;
// For skyfallers that can fall into shield fields
public int shieldDamageIntercepted = -1;
public bool destroyCorpse;
public ConstructionSkillRequirement constructionSkillRequirement;WeaponDrawOffsets is a container class:
public class WeaponDrawOffsets
{
public Offset north = null;
public Offset east = null;
public Offset south = null;
public Offset west = null;
}
public class Offset
{
public Vector3 drawOffset;
public Vector3? drawOffsetWhileMoving;
public float angleOffset;
public float? angleOffsetWhileMoving;
}So is ConstructionSkillRequirement:
public class ConstructionSkillRequirement
{
public WorkTypeDef workType;
public SkillDef skill;
public int level;
public string reportStringOverride;
}For oversized weapons such as the Warcasket lasers and wardrone mini-blasters from Vanilla Factions Expanded - Pirates, you can use weaponCarryDrawOffsets to specify draw offsets and angles. These apply at all times, whenever the pawn is drafted, carrying weapons openly, watching for targets or actively aiming/attacking a target.
<!-- Example: VFEP_WarcasketGun_LaserBlaster from Vanilla Factions Expanded - Pirates -->
<modExtensions>
<li Class="VEF.Things.ThingDefExtension">
<weaponCarryDrawOffsets>
<north>
<drawOffset>(0,0,-0.18)</drawOffset>
</north>
<east>
<drawOffset>(0,0,-0.18)</drawOffset>
</east>
<south>
<drawOffset>(0,0,-0.18)</drawOffset>
</south>
<west>
<drawOffset>(0,0,-0.18)</drawOffset>
</west>
</weaponCarryDrawOffsets>
</li>
</modExtensions>
For long polearm weapons such as pikes and halberds, you can use weaponDraftedDrawOffsets to specify draw offsets and angles that only apply when the pawn is drafted, carrying weapons openly, watching for targets - aiming is not affected.
<!-- Example: Mousekin Pike from Mousekin Race -->
<modExtensions>
<li Class="VEF.Things.ThingDefExtension">
<weaponDraftedDrawOffsets>
<north>
<drawOffset>(0.25, 0, 0.36)</drawOffset>
<angleOffset>-143</angleOffset>
</north>
<east>
<drawOffset>(0.1, 0, 0.42)</drawOffset>
<angleOffset>-122</angleOffset>
</east>
<south>
<drawOffset>(-0.25, 0, 0.47)</drawOffset>
<angleOffset>-143</angleOffset>
</south>
<west>
<drawOffset>(-0.1, 0, 0.42)</drawOffset>
<angleOffset>122</angleOffset>
</west>
</weaponDraftedDrawOffsets>
</li>
</modExtensions>

- All orientations (north/south/east/west), position and angular offsets are optional, and default to 0,0,0 and 0 degrees respectively
- Both
weaponCarryDrawOffsetsandweaponDraftedDrawOffsetscan be used simultaneously - The offsets apply cumulatively over the base game's existing
equippedAngleOffsetparameter
For items or resources that can be mined using Deep drills, you can customize the color and transparency of their associated underground deposits detected by the Long-range mineral scanners:
<modExtensions>
<li Class="VEF.Things.ThingDefExtension">
<deepColor>(0.72, 0.29, 0.29)</deepColor> <!-- defaults to white if unspecified -->
<transparencyMultiplier>0.75</transparencyMultiplier> <!-- defaults to 0.5 if unspecified -->
</li>
</modExtensions>For example, this is the offset of warcasket weapons:
<li Class="VEF.Things.ThingDefExtension">
<weaponCarryDrawOffsets>
<north>
<drawOffset>(0,0,-0.18)</drawOffset>
</north>
<east>
<drawOffset>(0,0,-0.18)</drawOffset>
</east>
<south>
<drawOffset>(0,0,-0.18)</drawOffset>
</south>
<west>
<drawOffset>(0,0,-0.18)</drawOffset>
</west>
</weaponCarryDrawOffsets>
</li>Here are shields in VFE Medieval 2:
<li Class="VEF.Things.ThingDefExtension">
<useFactionColourForPawnKinds>
<li>VFEM2_ManAtArms</li>
<li>VFEM2_Raider</li>
<li>VFEM2_Spearman</li>
<li>VFEM2_Jarl</li>
</useFactionColourForPawnKinds>
</li>And the javelin in VFE Classical
<li Class="VEF.Things.ThingDefExtension">
<usableWithShields>true</usableWithShields>
</li>- Abilities
- Aesthetic scaling
- Animal Behaviours
- Apparels
- Buildings
- Cooking
- Factions
- Genes
- Global
- Graphics
- Hediffs
- Maps
- Memes
- OptionalFeatures
- Pawns
- Planet
- Plants
- Storyteller
- Things
- Weapons
- Weathers
- PipeSystem basics
- Resource
- Resource storage
- Resource processor
- Resource to thing
- Resource to power
- Thing to resource
- Resource trader
- Refill building with pipes
- Pipe valve
- Advanced Resource Processor
- Update to KCSG 2.0
- Exporting buildings
- Customizing symbols
- Debug helpers options
- Custom faction settlement
- Custom structure and scenarios
- Custom structure in quests
- Custom structure in WorldObjects
- Biome based structures
- Spawning world object(s) at world generation
- Prevent settlement spawning for nomadic factions