All4n wrote:Ahh. Thanks!
That's a shame, event mods will overwrite each other easily then.
We really need a .merge file/function then.
Yes, this is correct. Anything that modifies two of the same events/root tags will end up overwriting each other until we work out a valid means of "merging" mods.
One idea I'm working with is adding a "mergeChildren" attribute that mod authors can add to .xml.merge files (actually, I dislike that convention and if I implement it will more likely set them as '.merge.xml' files, so that people with syntax highlighting editors don't need to manually set the language).
In this case, you'd set particular attributes to be set to "MERGE_NAME", "MERGE_TAG", "MERGE_ALL", "APPEND_ALL", "REMOVE_ALL", "OVERWRITE_ALL", "OVERWRITE_NAME", or "OVERWRITE_TAG".
So, given the following source XML:
Code: Select all
<!-- Source -->
<event name="FINISH_BEACON">
<text>You've arrived at the Long-Range Beacon. When the FTL Drive is charged you can jump to the next Sector.</text>
<choice hidden="true">
<text>Continue...</text>
<event load="NON_HOSTILE"/>
</choice>
</event>
This mod would replace the entire event with itself:
Code: Select all
<!-- Mod -->
<event name="FINISH_BEACON" mergeChildren="OVERWRITE_ALL">
<text>This is the end. Prepare yourself!</text>
<choice hidden="true">
<text>Continue...</text>
<event />
</choice>
<choice hidden="true">
<text>Pick a fight!</text>
<event load="HOSTILE1"/>
</choice>
<choice hidden="true">
<text>Go shopping!</text>
<store />
</choice>
</event>
This mod would simply add another choice to the event without changing anything else:
Code: Select all
<event name="FINISH_BEACON" mergeChildren="APPEND_ALL">
<choice hidden="true">
<text>Go shopping!</text>
<store />
</choice>
</event>
This mod would make the event completely empty (note: I have no clue what this would do to the game):
Code: Select all
<event name="FINISH_BEACON" mergeChildren="REMOVE_ALL" />
To demonstrate the "MERGE" attributes, I'll instead use the following source example:
Code: Select all
<shipBlueprint name="PLAYER_SHIP_HARD" layout="kestral" img="kestral">
<class>Kestrel Cruiser</class>
<name>The Kestrel</name>
<desc>This class of ship was decommissioned from Federation service years ago. After a number of refits and updating this classic ship is ready for battle.</desc>
<systemList>
<pilot power="1" room="0" start="true" img="room_pilot">
<slot>
<direction>right</direction>
<number>0</number>
</slot>
</pilot>
<doors power="1" room="2" start="true" img="room_doors"/>
<sensors power="1" room="3" start="true" img="room_sensors"/>
<medbay power="1" room="4" start="true" img="room_medbay">
<slot>
<number>1</number>
</slot>
</medbay>
<oxygen power="1" room="13" start="true" img="room_oxygen"/>
<shields power="2" room="5" start="true" img="room_shields"/>
<engines power="2" room="14" start="true" img="room_engines"/>
<weapons power="3" room="10" start="true" img="room_weapons"/>
<drones power="2" room="1" start="false"/>
<teleporter power="1" room="15" start="false"/>
<cloaking power="1" room="8" start="false"/>
</systemList>
<weaponSlots>4</weaponSlots>
<droneSlots>2</droneSlots>
<weaponList count="2" missiles="8">
<weapon name="MISSILES_2_PLAYER"/>
<weapon name="LASER_BURST_3"/>
</weaponList>
<health amount="30"/>
<maxPower amount ="8"/>
<crewCount amount = "3" class="human"/>
</shipBlueprint>
The following mod would alter the existing ship to start with L2 cloaking:
Code: Select all
<shipBlueprint name="PLAYER_SHIP_HARD" mergeChildren="MERGE_TAG">
<systemList mergeChildren="OVERWRITE_TAG">
<cloaking power="2" room="8" start="true"/>
</systemList>
</shipBlueprint>
Open issues which I don't know how to handle yet:
If I want to add L2 cloaking and change the number of crewmembers to 2, rather than 3, how would I do that?
This mod wouldn't modify the crew:
Code: Select all
<shipBlueprint name="PLAYER_SHIP_HARD" mergeChildren="MERGE_TAG">
<systemList mergeChildren="OVERWRITE_TAG">
<cloaking power="2" room="8" start="true"/>
</systemList>
<crewCount amount="2" class="human" />
</shipBlueprint>
This mod would remove every system
other than the Cloaking room:
Code: Select all
<shipBlueprint name="PLAYER_SHIP_HARD" mergeChildren="OVERWRITE_TAG">
<systemList mergeChildren="OVERWRITE_TAG">
<cloaking power="2" room="8" start="true"/>
</systemList>
<crewCount amount="2" class="human" />
</shipBlueprint>
I could possibly add a second tag (ie allow both a "mergeSelf" and a "mergeChildren") but I'm trying to keep it simple.
Any ideas?