Custom faction settlement - AndroidQuazar/VanillaExpandedFramework GitHub Wiki
Now that you have exported your own structure(s) (see Exporting buildings if you didn't), you can use them to create custom settlement for factions.
Add the extension to your faction. You need to add it to your FactionDef
, directly or using patches. Use StructureLayoutDef
when your layout should be a full settlement. Use SettlementLayoutDef
when your layouts are rooms that need to be randomly placed to create a settlement.
<modExtensions>
<li Class="KCSG.CustomGenOption">
<!-- The following option will prevent lake/marsh and
patches in general to generate. Use this if you
don't want your settlement to have to use bridges -->
<preventBridgeable>true</preventBridgeable>
<!-- If you want the structure to not be generated in the center,
but in a free of mountain space (will default to center if
no such space exist)-->
<tryFindFreeArea>True</tryFindFreeArea>
<!-- Premade resolver, you can add or remove any of them, and
also add custom ones -->
<symbolResolvers>
<li>kcsg_randomdamage</li>
<li>kcsg_randomfilth</li>
<li>kcsg_randomterrainremoval</li>
<li>kcsg_randomroofremoval</li>
<li>kcsg_randomitemremoval</li>
<li>kcsg_removeperishable</li>
<li>kcsg_destroyrefuelablelightsource</li>
<li>kcsg_scatterstuffaround</li>
</symbolResolvers>
<!-- Only if tou use kcsg_randomfilth -->
<filthTypes>
<li>Filth_Dirt</li>
<li>Filth_Trash</li>
<li>Filth_RubbleBuilding</li>
</filthTypes>
<!-- Only if tou use kcsg_scatterstuffaround-->
<scatterThings>
<li>Gold</li>
<li>Silver</li>
</scatterThings>
<scatterChance>0.02</scatterChance>
</li>
</modExtensions>
If you are using it for your own faction, simply add the extension to its definition. Else, you can use a patch:
<Operation Class="PatchOperationFindMod">
<mods>
<li>Royalty</li>
</mods>
<match Class="PatchOperationAddModExtension">
<xpath>/Defs/FactionDef[defName="Empire"]</xpath>
<value>
<li Class="KCSG.CustomGenOption">
<preventBridgeable>true</preventBridgeable>
[...]
</li>
</value>
</match>
</Operation>
You will need to add a list of StructureLayoutDef
(list tag is chooseFromlayouts
) in the modExtension. There are no limits in the amount of StructureLayoutDef
you can use. Layouts mods requirements, if any, will be applied at generation. Example of list:
<chooseFromlayouts>
<li>Wiki_Struct1</li>
<li>Wiki_Struct2</li>
<li>...</li>
</chooseFromlayouts>
You will need to add a list of SettlementLayoutDef
(list tag is chooseFromSettlements
) in the modExtension. There are no limits in the amount of SettlementLayoutDef
you can use. Example of list:
<chooseFromlayouts>
<li>Wiki_SettlementDef1</li>
<li>Wiki_SettlementDef2</li>
<li>...</li>
</chooseFromlayouts>
Here we will take the example of Vanilla Base Generation Expanded. In the mod, we use an abstract def that is the base of multiple settlements def:
<KCSG.SettlementLayoutDef Abstract="True" Name="VBGE_BaseOutlander">
<!-- Size of the settlement -->
<settlementSize>65,65</settlementSize>
<!-- Inner settlement part -->
<centerBuildings>
<!-- Inner size, can be the same size -->
<centerSize>65,65</centerSize>
<!-- A list of allowed tag -->
<allowedStructures>
<li>
<!-- min~max -->
<count>1~3</count>
<tag>GenericPower</tag>
</li>
<li>
<count>1~2</count>
<tag>GenericBattery</tag>
</li>
<li>
<count>1~3</count>
<tag>GenericSecurity</tag>
</li>
<li>
<count>0~1</count>
<tag>GenericPodLauncher</tag>
</li>
<li>
<count>1~1</count>
<tag>GenericKitchen</tag>
</li>
<li>
<count>1~4</count>
<tag>GenericStockpile</tag>
</li>
<li>
<count>2~10</count>
<tag>GenericBedroom</tag>
</li>
<li>
<count>0~1</count>
<tag>GenericGrave</tag>
</li>
<li>
<count>0~1</count>
<tag>GenericRecroom</tag>
</li>
</allowedStructures>
</centerBuildings>
<!-- If you want to spawn props (buildings) around, you can use the following ->
<propsOptions>
<addMainRoadProps>true</addMainRoadProps>
<!-- Props spawned on main roads, if any -->
<mainRoadPropsDefs>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarForklift</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarDeliveryBlack</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarFamilyBlack</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarPickupBlack</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarVintageBlack</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarDeliveryWhite</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarFamilyWhite</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarPickupWhite</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarVintageWhite</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarDeliverySilver</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarFamilySilver</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarPickupSilver</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarVintageSilver</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarDeliveryBlue</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarFamilyBlue</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarPickupBlue</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarVintageBlue</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarDeliveryRed</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarFamilyRed</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarPickupRed</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CarVintageRed</li>
</mainRoadPropsDefs>
<mainRoadPropsChance>0.03</mainRoadPropsChance>
<mainRoadMinDistance>9</mainRoadMinDistance>
<!-- Props spawned on link roads, if any -->
<addLinkRoadProps>true</addLinkRoadProps>
<linkRoadPropsDefs>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_Cone</li>
<li MayRequire="VanillaExpanded.VFECore">Light_Streetlamp</li>
</linkRoadPropsDefs>
<linkRoadMinDistance>12</linkRoadMinDistance>
<!-- Props scattered around -->
<scatterProps>true</scatterProps>
<scatterMinDistance>8</scatterMinDistance>
<scatterMaxAmount>150</scatterMaxAmount>
<scatterPropsDefs>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_BinBag</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_BoxLarge</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_BoxSmall</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CardboardBoxLarge</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_CardboardBoxSmall</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_BrickPile</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_BarrelGreen</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_BarrelGrey</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_BarrelRed</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_BarrelYellow</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_BarrelBlue</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_PalletCardboard</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_PalletBoxes</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_Pallet</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_PalletBarrelGreen</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_PalletBarrelGrey</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_PalletBarrelRed</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_PalletBarrelYellow</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_PalletBarrelBlue</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_ContainerGreen</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_ContainerGrey</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_ContainerRed</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_ContainerYellow</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_ContainerBlue</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_Pipes</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_Planks</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_ConcreteBags</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_WoodenLogs</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_WoodenLogsLarge</li>
<li MayRequire="VanillaExpanded.VFEPropsandDecor">VFEPD_WoodenWagon</li>
</scatterPropsDefs>
</propsOptions>
<!-- Defines roads here -->
<roadOptions>
<!-- Main road are road that traverse a settlement -->
<addMainRoad>true</addMainRoad>
<mainRoadCount>3</mainRoadCount>
<mainRoadDef>PavedTile</mainRoadDef>
<mainRoadWidth>3</mainRoadWidth>
<!-- Link road are road that link all doors together -->
<addLinkRoad>true</addLinkRoad>
<linkRoadDef>Concrete</linkRoadDef>
<linkRoadWidth>1</linkRoadWidth>
</roadOptions>
<!-- You can customize the settlement defense here -->
<defenseOptions>
<addEdgeDefense>true</addEdgeDefense>
<addSandbags>false</addSandbags>
<addTurrets>true</addTurrets>
<cellsPerTurret>20</cellsPerTurret>
<allowedTurretsDefs>
<li>Turret_MiniTurret</li>
<li MayRequire="VanillaExpanded.VFESecurity">VFES_Turret_MilitaryTurret</li>
<li MayRequire="VanillaExpanded.VFESecurity">VFES_Turret_Searchlight</li>
<li MayRequire="VanillaExpanded.VFESecurity">VFES_Turret_Flame</li>
</allowedTurretsDefs>
<addMortars>true</addMortars>
<cellsPerMortar>60</cellsPerMortar>
<allowedMortarsDefs>
<li>Turret_Mortar</li>
</allowedMortarsDefs>
<!-- 1 for default number of pawns -->
<pawnGroupMultiplier>1.7</pawnGroupMultiplier>
</defenseOptions>
<stockpileOptions>
<stockpileValueMultiplier>2.0</stockpileValueMultiplier>
</stockpileOptions>
</KCSG.SettlementLayoutDef>
Now that we have a base settlement, let's see a def based on it:
<KCSG.SettlementLayoutDef ParentName="VBGE_BaseOutlander">
<defName>VBGE_OutlanderFields</defName>
<!-- Reducing center size -->
<centerBuildings>
<centerSize>45,45</centerSize>
</centerBuildings>
<!-- Adding peripheral buildings -->
<peripheralBuildings>
<allowedStructures>
<li>
<count>2~5</count>
<tag>GenericField</tag>
</li>
<li>
<count>2~5</count>
<tag>GenericAnimal</tag>
</li>
</allowedStructures>
</peripheralBuildings>
<!-- With this you can fill any storage building, like shelves -->
<stockpileOptions>
<fillStorageBuildings>true</fillStorageBuildings>
<fillWithDefs>
<li>Milk</li>
<li>EggChickenUnfertilized</li>
<li>EggGooseUnfertilized</li>
<li>RawPotatoes</li>
<li>RawRice</li>
<li>RawBerries</li>
<li>RawHops</li>
<li>SmokeleafLeaves</li>
<li>Leather_Plain</li>
<li>Leather_Bluefur</li>
<li>Kibble</li>
<li>WoolAlpaca</li>
<li>Cloth</li>
<li>PsychicAnimalPulser</li>
<li>PsychicSoothePulser</li>
<li>Chocolate</li>
<li>ThrumboHorn</li>
<li>ElephantTusk</li>
<li>MechSerumHealer</li>
</fillWithDefs>
</stockpileOptions>
</KCSG.SettlementLayoutDef>