Game.sbc is a mess to mod

Digi shared this bug 11 hours ago
Submitted

Mods that want to change the explosive stuff or the encounter colors cannot do so without also including all the session components... or without inadvertly removing some because who is checking all their changed files on every game update?


Now if that weren't enough, I was researching if <InheritFrom> can do this, using the Default subtype which most worlds are using, I tried:

<?xml version="1.0" encoding="UTF-8"?>
<Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Definition xsi:type="VR.GameDefinition">
    <Id>
      <TypeId>MyObjectBuilder_GameDefinition</TypeId>
      <SubtypeId>Default</SubtypeId>
    </Id>
    <InheritFrom>Space</InheritFrom>
    <ExplosionAmmoVolumeMin>0</ExplosionAmmoVolumeMin>
    <ExplosionAmmoVolumeMax>0</ExplosionAmmoVolumeMax>
    <ExplosionRadiusMin>0</ExplosionRadiusMin>
    <ExplosionRadiusMax>0</ExplosionRadiusMax>
    <ExplosionDamagePerLiter>0</ExplosionDamagePerLiter>
    <ExplosionDamageMax>0</ExplosionDamageMax>
    <EncounterColors>
      <Color Hex="#FF00FF"/>
    </EncounterColors>
  </Definition>
</Definitions>

Space being the only one that SE's Game.sbc defines, so I tried to inherit from it, yet it does not want to!

Error: Could not find parent definition Space for game definition .
Because the code only looks in GetLoadingSet() which from what I can tell is ONLY the current mod's loaded stuff, so it's only looking to inherit from my own mod.

Also the error is printing the wrong subtype so it always comes up blank, it needs to instead print builder.Id.SubtypeId.


So anyway, got a list of things that need fixing:

- <InheritFrom> needs to look at all contexts not just the current set (simplest fix is probably to remove the GetLoadingSet() part, but might require moving all this to post-process).

- Merge the <SessionComponents> from Game.sbc's Space subtypeId to the VRageDefault and remove'em from Space, that keeps the definition clean for people to copy to their mods, and the InheritFrom fix is required for this to work, otherwise they still have to copy VRageDefault too...


Or move both <EncounterColors> and explosive stuff to dedicated session components so that they can be individually overwritten.


There's also a quirk of <EncounterColors>/RandomColorsForPrefabSpawn being directly read from Space-subtypeId and nowhere else, this can work favorably where you can have a Default definition define the explosive stuff and the Space can define only <EncounterColors>, that way people can copy only the one they want to change... but it's all super spaghetti xD

The session component move is a better way and let people know in the change logs that they moved - whoever is keeping up with updates would see and update accordingly, and whoever abandoned the mod would have a mod that breaks other game systems in either case.

Leave a Comment
 
Attach a file