Adds a feature allowing modders to specify whether a faction should ever spawn any settlements on the world map during world generation.
Rationale
The optional hidden field included in the base game is used to prevent a given faction from ever spawning any settlements on the world map, but also hides them completely from the faction list and prevents them from having leaders generated. This is adequate for factions such as Ancients, Mechanoids and Insects, but is unsuitable for nomadic factions that are supposed to be present on the world map and have leaders.
The proposed code checks to see if a faction's KCSG.FactionSettlement ModExtension (if defined) has a new canSpawnSettlements field specified:
If true or unspecified, settlement generation proceeds as normal (default behaviour)
If false, settlement generation for that faction is skipped
Tested with a local, offline development build of my upcoming Mousekin Race mod, with both Gypsy and Brigand factions not spawning any settlements as expected, while still being displayed in the faction list
No adverse effects on other factions that do not have canSpawnSettlements specified
Over 20 instances of world generation at game start successfully completed without errors
Additions
Rationale
The optional
hidden
field included in the base game is used to prevent a given faction from ever spawning any settlements on the world map, but also hides them completely from the faction list and prevents them from having leaders generated. This is adequate for factions such as Ancients, Mechanoids and Insects, but is unsuitable for nomadic factions that are supposed to be present on the world map and have leaders.The proposed code checks to see if a faction's
KCSG.FactionSettlement
ModExtension (if defined) has a newcanSpawnSettlements
field specified:Usage
Testing
canSpawnSettlements
specified