Overriding and merging config files in mods. (DEPRECATED)

Discussion in 'Starbound Modding' started by bartwe, Dec 16, 2013.

Thread Status:
Not open for further replies.
  1. Kawa

    Kawa Tiy's Beard

    And that means only one mod can make that change and survive.
     
    The | Suit likes this.
  2. Monomer

    Monomer 2.7182818284590...

    Thanks for the replies folks! That's unfortunate for now but at least I've got a better understanding now. Cheers.
     
  3. simplex

    simplex Astral Cartographer

    Only the best shall take The Prize. There can be only one.
     
    Kawa likes this.
  4. ahappydude

    ahappydude Scruffy Nerf-Herder

    Yeah.. I found ot that to yesterday when trying ot the merge command in different ways, hopefully on of the dev will make the command more usefull later on so we dont havve to replace all those lines. You can still merge biomes mod togeheter but its a hassle
     
  5. Woden

    Woden Twenty-three is number one

    Unfortunately, there's probably not an easy way to make it work without restructuring everything that is currently using arrays/lists. There simply isn't a simple way to identify which section should be modified as it currently stands.

    I suppose you could maybe have it be something like having the mod file include an entry for each of the existing array entries, each of which get merged in, but that seems like it would be both cumbersome and prone to big errors if a mod adds or removes entries from the array.
     
    ahappydude likes this.
  6. Kawa

    Kawa Tiy's Beard

    Code:
    {
      "__merge" : [],
      "scriptConfig" : {
        "hound" : {
          "dialog" : {
            "__merge" : [ [ "overlap" : "warnings" ] ] //to signify it should start from [0] instead of adding a [4]
            "warnings" : [
              {
                "sword" : {
                  "felin" : {
                    "default" : [
                      "Put that away before you take out an eye.",
                      "Sheathe it.",
                      "Put the weapon away and carry on."
                    ]
                  }
                },
                ...
    Overlap mode. Doesn't this seem like a neat solution? Use empty blocks to skip unedited parts, or if you like hardmodes, allow "overlap" : "warnings[N]" to define a starting index and such.
     
  7. Corazoor

    Corazoor Void-Bound Voyager

    I like that.
    Except that it would not work very good for sectors: What if you wanted to add biomes to the existings ones and add a completely new sector at the same time?

    You could just add the excess sector to the end of the list in your mod, and the game would put that entry at the end of the original list.
    But then two mods each doing that would actually end up merging their special sector with each other.

    And even if you could fix that, you would get into trouble because you are relying on the order:
    Imagine you wanted to make a simple mod to add a few biomes to one of the modded in sectors of another mod. (thats what "dependencies" are for, i suppose)
    With "overlap mode" you had no way of telling what sector would be modified. It entirely depends on the order in which different mods are loaded.

    But, i had my own thoughts about this, at least for sectors you could do something like this:
    Code:
    {
      "__merge" : [ ["match", "sectors", "id" ] ],
      "sectors" : [
        {
          "id" : "sectorx",
    
          "worldParameters" : {
            "unlockedBiomes" : [ "newbiome"]
          }
        },
        {
          "id" : "foo",
          "name" : "foo Sector",
          ...
        }
      ]
    }
    In this example, the mod would add a new biome to the X-Sector and an entirely new Foo-Sector.

    This will definitely produce less conflicts between biome and sector mods, BUT...
    It does not work at all for the guards (where there is no id)
    Or hairstyles for genders
    Or treasurepools

    Basically its only needed for sectors... So, we need both methods, maybe?
     
    ahappydude likes this.
  8. Kawa

    Kawa Tiy's Beard

    [​IMG]
     
    Kyrosiris and ahappydude like this.
  9. ahappydude

    ahappydude Scruffy Nerf-Herder

    Still its good progress, will look into this more later today, cheers!
     
  10. wsensor

    wsensor Subatomic Cosmonaut

    From what I am reading I wanted to modify the spaceairtank to make it give cold protection and breathprotection. I get an error everytime T_T.

    {
    "__merge" : ["overwrite", "statusEffects"],
    "statusEffects" : [
    { "kind" : "breathprotection" },
    { "kind" : "ColdProtection", "amount" : "50" }
    ]
    }

    I was getting a duplicate item error.

    Now I am getting an could not load item asset spacetank/spaceairtank.back caused by varientexception: no such key in varient::get("itemname")
    007DD9B4
    0058AB0C
    0058C5F7
    004DB33F
    004016D8
    0096597C
    7648336A
    77EA9F72
    77EA9F45


    I have tried merging status effects but... it still errors...


    hmm nevermind it seems to be working somehow now... all i really did was put it in a different folder and remove the image files :rofl:... confusing
     
    Last edited: Jan 2, 2014
  11. falkenbr

    falkenbr Scruffy Nerf-Herder

    Hi.

    I have problems to merge two different things in any species file. I can use one merge per time, but If I have to merge two different points in the same file, I always get an error or the game never finish to load.

    Two examples:

    A - To merge blueprints.
    Code:
    {
      "__merge" : [],
      "defaultBlueprints" : {
        "tier1" : [ { "item" : "specie item 1" } ],
        "tier2" : [ { "item" : "specie item 2" } ]
      }
    }
    B - To merge a racial hair:

    Code:
    {
      "__merge":[
      ["overwrite","genders"]
      ],
      "genders" : [
        {
          "name" : "male",
          "image" : "/interface/title/male.png",
          "characterImage" : "/interface/title/sapemale.png",
          "hairGroup" : "hairmale",
          "hair" : [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "custom_hair01", "custom_hair02",  ],
          "shirt" : [ "apexcommanderjacket", "apexnavyjacket", "apexofficerjacket", "apexspecialistjacket" ],
          "pants" : [ "apexcommanderpants", "apexnavypants", "apexofficerpants", "apexspecialistpants" ],
          "facialHairGroup" : "beardmale",
          "facialHair" : [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" ],
          "facialMaskGroup" : "",
          "facialMask" : [ ]
        }
      ]
    }
    I have problems to find the right point to merge two different points using the same script in the same file. Any suggestion?
     
  12. Applesaur

    Applesaur Space Hobo

    having an issue using the overwrite. it is currently deleting all items in the list (which is good), but isn't adding the new list.

    Code:
    {
      "__merge" : [],
      "defaultBlueprints" : {
          "__merge" : [ ["overwrite", "tier1"] ],
        "tier1" : [ { "item" : "spawner" } ],
        "tier2" : [ { "item" : "watertorch" } ]
      }
    }
    thoughts?
     
  13. ahappydude

    ahappydude Scruffy Nerf-Herder

    Hmm try removing the second merge and add the overwrite under the first or try withouth the overwrite
     
  14. Annuschka

    Annuschka Big Damn Hero

    About the nested array merge issue:

    I posted it in another thread already but...

    If all this syntax-logic-progamming-code is too complicated, maybe it would be a simpler solution to change the structure of all the critical configs, avoiding nested arrays alltogether. I know, this will break a few old mods, but...

    Code:
    "genders" : {
      "male" : {
          "image" : "/interface/title/plantmaleicon.png",
          "characterImage" : "/interface/title/plantmale.png",
          "hair" : [ "1", "2", "3" ],
          "shirt" : [ "floranfurnivourchest", "floranhunterchest"],
          ...
      },
      "female" :  {
          "image" : "/interface/title/plantfemaleicon.png",
          "characterImage" : "/interface/title/plantfemale.png",
          "hair" : [ "1", "2", "3" ],
          "shirt" : [ "floranfurnivourchest", "floranhunterchest" ],
          ...
      }
    }
    Instead of

    Code:
    "genders" : [
      {
        "name" : "male",
        ...
      },
      {
        "name" : "female",
        ...
      }
    ]
    (probably not so clean in other cases...)
    It would be easier to edit nested stuff like this, wouldn't it?

    Here are a few more examples.

    Or does anyone know if objects have a great disadvantage towards arrays? Besides that one has to come up with funky names... And of course, it would be a tedious work to change all those files midway in development...

    To bad that this can't be done by some "Cleaning Mod" that replaces those files. It also has to be changed in the game code:
    VariantException: Improper conversion to VariantList from map in get("genders")
     
    Last edited: Jan 7, 2014
    Woden and ahappydude like this.
  15. Woden

    Woden Twenty-three is number one

    Yes, that sort of thing is about the only way I can see to have the stuff that is currently in nested arrays become safely merge-able. As you pointed out, though, it would require a fair bit of work from the programmers.

    And I don't even think this sort of solution would work for any of the treasurepool arrays, either... those things don't look like it would be even remotely easy to make it possible to use the merge function with (other than completely overwriting the entire nested array, of course).
     
    Annuschka likes this.
  16. ahappydude

    ahappydude Scruffy Nerf-Herder

    Hopefully some of the devs have seen this sticky thread and will make the command easier to use:)
     
  17. arrjaytea

    arrjaytea Sandwich Man

    Would anyone mind having a look at my player.config code and helping me sort out how I'm messing this up?

    Basically what's happening is for new characters, it looks like my mod is eliminating the beta tier recipes for new characters. If the mod is installed after these recipes have been unlocked, no problemo - but if it's used for new characters (per Xirander's last post in the discussion thread), it looks like the beta recipes are blocked.

    I'm fairly certain this is on me, and a poorly written player.config - so I'm hoping someone here can help me learn where I'm going wrong with the merge syntax.

    I really appreciate any help at all.

    Original Code:

    Code:
    
        {
    //  "__merge" : "nil", // sets file to nil, for some configs this will be treated asif the file was deleted
      "__merge" : [],
      "defaultBlueprints" : {
        "__merge" : [
          // ["delete", "tier1" ]
          [ "overwrite", "tier2" ]
        ],
        "tier1" : [ 
        { "item" : "revanchest" },
        { "item" : "revanlegs" },
        { "item" : "revanhead" },
        { "item" : "revancape" },
        { "item" : "vaderchest" },
        { "item" : "vaderlegs" },
        { "item" : "vaderhead" },
        { "item" : "vadercape" },
        { "item" : "sithchest" },
        { "item" : "sithlegs" },
        { "item" : "sithhead" },
        { "item" : "jedichest" },
        { "item" : "jedilegs" },
        { "item" : "jedihead" },
        { "item" : "smugglerchest" },
        { "item" : "smugglerlegs" },
        { "item" : "ScoutChest" },
        { "item" : "ScoutPants" },
        { "item" : "ScoutHead" },
        { "item" : "StormtrooperChest" },
        { "item" : "StormtrooperPants" },
        { "item" : "StormtrooperHead" },
        { "item" : "BoushhChest" },
        { "item" : "BoushhPants" },
        { "item" : "BoushhHead" },
        { "item" : "boushhcape" }, 
        { "item" : "BobaChest" },
        { "item" : "BobaPants" },
        { "item" : "BobaHead" },
        { "item" : "JangoChest" },
        { "item" : "JangoPants" },
        { "item" : "JangoHead" },
        { "item" : "MandaloreChest" },
        { "item" : "MandalorePants" },
        { "item" : "MandaloreHead" },         
        { "item" : "mandalorianjetpack" }  ],
        "tier2" : []
      }
    }
    Edit: Would this be proper form if I'm solely looking to add the items to the default set?

    Code:
        {
      "__merge" : [],
      "defaultBlueprints" : {
      "tier1" : [
        { "item" : "revanchest" },
        { "item" : "revanlegs" },
        { "item" : "revanhead" },
        { "item" : "revancape" },
        { "item" : "vaderchest" },
        { "item" : "vaderlegs" },
        { "item" : "vaderhead" },
        { "item" : "vadercape" },
        { "item" : "sithchest" },
        { "item" : "sithlegs" },
        { "item" : "sithhead" },
        { "item" : "jedichest" },
        { "item" : "jedilegs" },
        { "item" : "jedihead" },
        { "item" : "smugglerchest" },
        { "item" : "smugglerlegs" },
        { "item" : "ScoutChest" },
        { "item" : "ScoutPants" },
        { "item" : "ScoutHead" },
        { "item" : "StormtrooperChest" },
        { "item" : "StormtrooperPants" },
        { "item" : "StormtrooperHead" },
        { "item" : "BoushhChest" },
        { "item" : "BoushhPants" },
        { "item" : "BoushhHead" },
        { "item" : "boushhcape" },   
        { "item" : "BobaChest" },
        { "item" : "BobaPants" },
        { "item" : "BobaHead" },
        { "item" : "JangoChest" },
        { "item" : "JangoPants" },
        { "item" : "JangoHead" },
        { "item" : "MandaloreChest" },
        { "item" : "MandalorePants" },
        { "item" : "MandaloreHead" },           
        { "item" : "mandalorianjetpack" } 
        ]
      }
    }
     
    Last edited: Jan 11, 2014
  18. Mackinz

    Mackinz The Waste of Time

    Hi folks, I'd like to ask for some help because I can't make heads or tails of this __merge stuff.

    My goal is to remove recipes from the Metalwork Station, and then add them and many more to the Wiring Station. How would I go about doing this?
     
  19. Kawa

    Kawa Tiy's Beard

    If I understand recipes correctly, you might be easiest off not using __merge at all. Just copy the .recipe files that refer to the metalwork station and edit their groups.

    For example, to move the robot chest from the metalwork station to the wiring station, the easiest would be to copy assets\recipes\tier1\metalworkstation\robotchest.recipe to mods\mystuff\recipes\wiringstation\robotchest.recipe, then change the "metalworkstation" reference on the last line to "wiringstation". The robotchest.recipe in mods\mystuff will overrule the one in assets entirely. You may then proceed to figure out how to reduce this to a two-line __merge-using variant, leaving other mods capable of safely editing the actual ingredients for a robot chest.
     
  20. Mackinz

    Mackinz The Waste of Time

    I could do that, but I'm prioritizing the last part before I change the recipes. Does anyone have any clue how to do that last part?
     
    Last edited: Jan 11, 2014
Thread Status:
Not open for further replies.

Share This Page