-
Notifications
You must be signed in to change notification settings - Fork 59
SwappableBuilding
juanosarg edited this page Sep 29, 2025
·
4 revisions
SwappableBuilding creates buildings that can be swapped for another via code
First of all, the thingClass of the building needs to be:
<thingClass>VEF.Buildings.SwappableBuilding</thingClass>Second of all (the hard part), you need to make a C# class that calls the Notify_Swap method of SwappableBuilding. For example, this is the code that tells the silo traps in Vanilla Quests Expanded - Deadlife to come alive (irrelevant lines removed):
if (building is VEF.Buildings.SwappableBuilding swappable)
{
swappable.Notify_Swap();
}Thirdly, you need a mod extension that tells details to the main class what to pop up when the building is opened. This mod extension is SwappableBuildingDetails
public ThingDef buildingLeft = null;
public SoundDef deconstructSound = null;
//If swappingTimer is set to something higher than -1, the building will just swap on a timer on its own, no need for being called from code
public int swappingTimer = -1;Here is the def extension of one of the traps mentioned:
<modExtensions>
<li Class="VEF.Buildings.SwappableBuildingDetails">
<buildingLeft>VQED_DeathPit</buildingLeft>
<deconstructSound>VQED_AncientDoorSeal</deconstructSound>
</li>
</modExtensions>- 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