Modding:Mutations: Difference between revisions

Jump to navigation Jump to search
2,586 bytes added ,  23:50, 25 June 2019
Add info about Construction and Exclusions
imported>CaptainTechnicality54384
(Adding syntax highlighting.)
(Add info about Construction and Exclusions)
Line 415: Line 415:
   
   
public override bool FireEvent(Event E)
public override bool FireEvent(Event E)
</syntaxhighlight>
== Additional Details ==
You may add the following optional elements to a <mutation> tag in Mutations.xml
* Constructor
* Exclusions
=== Constructor ===
This element should be a string argument (or a comma-delimited string of arguments, if there are more than one) to pass to the mutation's class constructor. All such arguments are received as string parameters in the mutation class constructor. For example, Corrosive Gas Generation and Sleep Gas Generation both use the same mutation class, GasGeneration. However, Mutations.xml passes a different argument to the constructor, which indicates which type of gas should be used.
Mutations.xml
<syntaxhighlight lang="xml">
<mutation Name="Sleep Gas Generation" Cost="2" MaxSelected="1" Class="GasGeneration" Constructor="SleepGas" Exclusions="Corrosive Gas Generation" BearerDescription="those whe expel sleep gass" Code="bu"></mutation>
</syntaxhighlight>
GasGeneration.cs
<syntaxhighlight lang="csharp">
namespace XRL.World.Parts.Mutation
{
[Serializable]
public class GasGeneration : BaseMutation
{
public GasGeneration(string _GasObject)
{
this.GasObject = _GasObject;
this.SyncFromBlueprint();
}
</syntaxhighlight>
The GasObject property is set to to "SleepGas" in this case, because that was the value provided in the Constructor element of Mutations.xml.
Theoretically you could create a new mutation that generates any type of gas simply by adding a single <mutation> tag to a Mutations.xml file. For example, this Mutations.xml file alone would create a new mutation called "Confusion Gas Generation"
<syntaxhighlight lang="xml">
<?xml version="1.0" encoding="utf-8" ?>
<mutations>
  <category Name="Physical">
    <mutation Name="Confusion Gas Generation" Cost="2" MaxSelected="1" Class="GasGeneration" Constructor="ConfusionGas" Exclusions="" BearerDescription="those who expel confusion gas" Code="zz"></mutation>
  </category>
</mutations>
</syntaxhighlight>
== Exclusions ==
The Exclusions parameter defines mutations that should be considered mutually exclusive with this mutation. For example, you can only have one type of back-slot mutation, so the game defines the other three types of back-slot mutations as Exclusions in the Mutations.xml file.
Example from Mutations.xml:
<syntaxhighlight lang="xml">
<mutation Name="Stinger (Confusing Venom)" Cost="3" MaxSelected="1" Class="Stinger" Constructor="Confuse" Exclusions="Stinger (Paralyzing Venom),Stinger (Poisoning Venom),Wings" BearerDescription="those with stingers tipped with confusing venom" Code="bx"></mutation>
</syntaxhighlight>
</syntaxhighlight>

Navigation menu