Spawning world object(s) at world generation - AndroidQuazar/VanillaExpandedFramework GitHub Wiki
KCSG also allow to easily spawn WorldObjects (similar to quest sites, but not disappearing until visited/raider and that won't respawn). It can be useful for story based sites. In the example below, we will describe the creation of a world site containing a ruined spaceship.
First, we export the created spaceship (Exporting buildings):
<KCSG.StructureLayoutDef>
<defName>Wiki_AncientShip</defName>
<layouts>
<li>
<li>.,.,.,.,.,Ship_Engine_North,.,.,.,.,Ship_Engine_North,.,.,.,.,.</li>
<li>.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,Ship_CryptosleepCasket_West,.,.,.,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,.,Ship_Beam_North,.,Ship_ComputerCore,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,Ship_CryptosleepCasket_West,.,.,.,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.</li>
<li>.,Ship_Engine_North,.,.,.,.,.,.,.,.,.,.,.,.,Ship_Engine_North,.</li>
<li>.,.,.,Ship_Beam_North,.,.,.,.,.,.,.,Ship_Beam_North,.,.,.,.</li>
<li>.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,.,Ship_Reactor_North,.,.,.,.,.,.,.,.</li>
<li>.,.,Ship_CryptosleepCasket_West,.,.,.,.,.,.,.,.,.,.,Ship_CryptosleepCasket_East,.,.</li>
<li>.,.,.,Ship_CryptosleepCasket_North,.,.,.,.,.,.,.,.,Ship_CryptosleepCasket_North,.,.,.</li>
<li>.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,Ship_CryptosleepCasket_West,.,.,Ship_CryptosleepCasket_East,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,.,Ship_Beam_North,.,.,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,Ship_CryptosleepCasket_West,.,.,Ship_CryptosleepCasket_East,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,Ship_CryptosleepCasket_West,.,.,Ship_CryptosleepCasket_East,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,Ship_CryptosleepCasket_West,.,.,Ship_CryptosleepCasket_East,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,.,Ship_Beam_North,.,.,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,Ship_CryptosleepCasket_West,.,.,Ship_CryptosleepCasket_East,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,.,.,.,.,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,Ship_CryptosleepCasket_West,.,.,Ship_CryptosleepCasket_East,.,.,.,.,.,.</li>
<li>.,.,.,.,.,.,.,Ship_SensorCluster,.,.,.,.,.,.,.,.</li>
</li>
</layouts>
</KCSG.StructureLayoutDef>
Then we start the creation of the WorldObjectDef:
<WorldObjectDef>
<defName>Wiki_AncientEscapeShip</defName>
<worldObjectClass>Site</worldObjectClass>
<texture>World/WorldObjects/JourneyDestination</texture>
<expandingIcon>true</expandingIcon>
<expandingIconPriority>70</expandingIconPriority>
<canBePlayerHome>true</canBePlayerHome>
<comps>
<li Class="WorldObjectCompProperties_Abandon" />
<li Class="WorldObjectCompProperties_TradeRequest" />
<li Class="WorldObjectCompProperties_FormCaravan" />
<li Class="WorldObjectCompProperties_EnterCooldown" />
</comps>
<modExtensions>
<!-- **This is needed to be spawned at generation** -->
<li Class="KCSG.SpawnAtWorldGen">
<!-- Number to spawn-->
<spawnCount>5</spawnCount>
<parts>
<!-- Like any worldobject, we need sitepart (see below) -->
<li>Wiki_AncientEscapeShip</li>
</parts>
</li>
</modExtensions>
<IncidentTargetTags>
<li>Map_Misc</li>
</IncidentTargetTags>
</WorldObjectDef>
We can now create the SitePartDef
we used:
<SitePartDef>
<defName>Wiki_AncientEscapeShip</defName>
<label>ancient abandonned ship</label>
<description>A really ancient ship. Some part may be missing, taken by salvagers or deteriored to dust.</description>
<siteTexture>World/WorldObjects/Sites/GenericSite</siteTexture>
<expandingIconTexture>World/WorldObjects/Expanding/JourneyDestination</expandingIconTexture>
<disallowsAutomaticDetectionTimerStart>true</disallowsAutomaticDetectionTimerStart>
<tags>
<li>Wiki_AncientEscapeShip</li>
</tags>
</SitePartDef>
<GenStepDef>
<defName>Wiki_AncientEscapeShip</defName>
<linkWithSite>Wiki_AncientEscapeShip</linkWithSite>
<order>450</order>
<genStep Class="KCSG.GenStep_CustomStructureGen">
<structureLayoutDefs>
<li>Wiki_AncientShip</li>
</structureLayoutDefs>
<filthTypes>
<li>Filth_Dirt</li>
<li>Filth_Trash</li>
<li>Filth_RubbleBuilding</li>
</filthTypes>
<symbolResolvers>
<li>kcsg_randomdamage</li>
<li>kcsg_randomfilth</li>
</symbolResolvers>
</genStep>
</GenStepDef>
In this example, we used a SitePartDef
that used custom generation, but you can also use any SitePartDef
.