Skip to content

Commit

Permalink
Merge branch 'master' of github.com:rheirman/GiddyUpCore
Browse files Browse the repository at this point in the history
  • Loading branch information
rheirman committed Mar 23, 2018
2 parents 6065463 + 8724bdd commit 52d9e05
Showing 1 changed file with 3 additions and 25 deletions.
28 changes: 3 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ Check out Patches/Races.xml for an example.
### Restrict used mount per faction.

If you want a certain faction only to use certain mounts, you can create a patch like the following example. You can also directly add a <modExtensions> tag to a FactionDef instead of patching.
In the example, the Pirate faction is patched so that it only uses Muffalos and Cougars. Two patches are used to ensure it also works when the faction already has a modExtensions tag.
In the example, the Pirate faction is patched so that it only uses Muffalos and Cougars.

```xml
<Patch>
<Operation Class="PatchOperationSequence">
<success>Always</success>
<operations>
<li Class="PatchOperationAdd">
<xpath>*/FactionDef[ defName = "Pirate"]/modExtensions</xpath>
<li Class="PatchOperationAddModExtension">
<xpath>*/FactionDef[ defName = "Pirate"]</xpath>
<value>
<li Class="GiddyUpCore.FactionRestrictionsPatch">
<mountChance>30</mountChance>
Expand All @@ -48,27 +48,5 @@ In the example, the Pirate faction is patched so that it only uses Muffalos and
</li>
</operations>
</Operation>

<Operation Class="PatchOperationSequence">
<success>Always</success>
<operations>
<li Class="PatchOperationAdd">
<xpath>*/FactionDef[ defName = "Pirate" and not(DefModExtension)]</xpath>
<value>
<modExtensions>
<li Class="GiddyUpCore.FactionRestrictionsPatch">
<mountChance>30</mountChance>
<!-- wild animals are the animals that can spawn in the wild -->
<wildAnimalWeight>100</wildAnimalWeight> <!--Weights can have any integer value, and the relative fraction to the other weight will determine the change a type of animal spawns-->
<!-- nonWild animals are the animals that cannot spawn in the wild, examples are Thrumbo's, farm animals etc. -->
<nonWildAnimalWeight>0</nonWildAnimalWeight> <!-- setting this to 0 ensures no default domestic animals are spawned -->
<allowedWildAnimalsCSV>Muffalo,Cougar</allowedWildAnimalsCSV> <!--Use a csv with animal DefNames-->
<allowedNonWildAnimalsCSV>""</allowedNonWildAnimalsCSV> <!-- only making this empty will imply no restrictions at all, so make sure domesticAnimalWeight is 0 if you don't want any domestic animals-->
</li>
</modExtensions>
</value>
</li>
</operations>
</Operation>
</Patch>
```

0 comments on commit 52d9e05

Please sign in to comment.