Idea: a method to partially overwrite an existing entity

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
Shivan Hunter
Commonwealth Pilot
Commonwealth Pilot
Posts: 81
Joined: Tue Nov 29, 2011 3:07 am

I have an idea that seems like it would be simple to implement, and would add a lot of functionality to XML definitions. A flag in a definition, let's call it overwrite="True", would mean that the definition is supposed to overwrite another one, and doesn't need to specify anything other than what it's changing/adding/removing. If an existing definition is not found, it could throw an error or be ignored.

For instance, a ship could have an <Items> tag but no <Devices> tag, and its FireRateAdj could be set to 20. Its UNID would be &scTestShip;. Let's say I want to have it not drop any items, have an installed laser cannon, and change its FireRateAdj to 15. I would have to overwrite the <Items>, <Devices> and <AISettings> tags- but other mods could overwrite its <Armor> section and still not conflict with mine! The XML might look like this:

Code: Select all

<ShipClass UNID="&scTestShip;" overwrite="true">
    <Items>
    </Items>

    <Devices>
        <Device deviceID="&itLaserCannon;"/>
    </Devices>

    <AISettings
        fireRateAdj="15"
        />
    <!-- of course, AISettigns would need to include the rest of the original AISettings tag so as not to overwrite it all; the exclusion of other attributes should be understood to mean "set these to defaults" or "leave these out" as in the <Items> example -->
</ShipClass>
This could also save a lot of space in overwrite mods. I've had this idea for a while (FreeSpace has an equivalent), but decided to voice it now because I'm going to have to overwrite the <Image> tags for every weapon in the game to replace their graphics...
I'm here to shift paradigms and chew bubblegum... and I'm all out of bubblegum.

<+The_Shrike> If you install 2 solar panels, you will have 2 solar panels installed.
<DarthGeek|2> :o
FourFire
Militia Captain
Militia Captain
Posts: 567
Joined: Sun Aug 12, 2012 5:56 pm

This sounds like a very good idea.
Great!
(func(Admin Response)= true){
if(admin func(amiable) = true)
Create func(Helpful Posts)
else func(Keep Calm and Post derisive topics)}
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

I'm pretty sure that something you can do with [CDATA] and typCreate.
User avatar
Shivan Hunter
Commonwealth Pilot
Commonwealth Pilot
Posts: 81
Joined: Tue Nov 29, 2011 3:07 am

I'm not looking for something that requires scripting (I'm sure it is doable with scripting, and I might just try it for my graphics mod); I think it would be far simpler to allow this type of modification purely in XML as another option.
I'm here to shift paradigms and chew bubblegum... and I'm all out of bubblegum.

<+The_Shrike> If you install 2 solar panels, you will have 2 solar panels installed.
<DarthGeek|2> :o
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

What about inherit= "UNID" (like how CSC's inherit CSCBase which is basically a bunch of events)?
That might do what you want.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
Shivan Hunter
Commonwealth Pilot
Commonwealth Pilot
Posts: 81
Joined: Tue Nov 29, 2011 3:07 am

brb gonna try it out. Can something inherit from itself? 'Cause that's what I'd have to do... this has to overwrite its base item.

[EDIT] Yeah Trans throws an error. Which makes sense 'cause an item inheriting from itself would be infinite recursion. I think the only other possible option would be getting stuck on one of the loadscreens until I alt+F4 or Trans ran out of memory :P
I'm here to shift paradigms and chew bubblegum... and I'm all out of bubblegum.

<+The_Shrike> If you install 2 solar panels, you will have 2 solar panels installed.
<DarthGeek|2> :o
Post Reply