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. bartwe

    bartwe Code Cowboy

    In the next patch functionality will be added to override and merge config files from the base game and other mods.

    Say i make a mod with a /player.config
    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" : "grapplinghook" } ],
        "tier2" : []
      }
    }
    
    This would add the grapplinghook to the initial recipes of new players, it would also make tier2 provide no additional recipes.

    Then to make the grapplinghook craftable without a workbench we then add to our mod /recipes/tier3/grapplinghook.recipe

    Code:
    {
      "__merge" : [],
      "groups" : [ "plain", "objects", "all", "tools"  ]
    }
    
    If you want to merge, at the top level a "__merge" entry must exist.
    Maps and lists are combined if no merge command is specified, other values are overwritten.
    If you want to replace a map or list, use the "overwrite" merge command on that field. Fields can also be deleted using the "delete command.

    Thanks to Rick for making this handy reference table:
    http://mod.gib.me/starbound/merge.html

    See also http://community.playstarbound.com/index.php?threads/extensions-to-the-__merge-command.69962/
     
    Last edited: Feb 9, 2014
  2. nathan00107

    nathan00107 Zero Gravity Genie

    Sweet, this is a huge step for Starbound modding, cheers @bartwe
     
  3. Shamyi

    Shamyi Big Damn Hero

    Edit: after looking at this code some more I'm much less worried
    about added work for modders. I'm assuming "__merge" : [ would
    also have an add option for adding new entries rather then overriding?

    is this a workaround to the the current method of making one config "mod" folder
    with a player.config with all the new recipe entries for ever mod?

    this new method seems like it would make things easy user side but more tedious modder side

    something like a preset up config mod folder with a text that users would need only imput the
    specific line in the specific tier for mods seems like it could use this system but be a better
    middle ground for users and modders using this new merge system.

    I may just be reading this wrong tho so I'll hold off being too worried xD
     
    Last edited: Dec 16, 2013
  4. Tyty

    Tyty Scruffy Nerf-Herder

    This seems like it'll help a lot for races, but users will still have to look out for ID conflicts.

    May have to come up with some fancy lua script or something to automatically assign a race an ID based on how many other playable races are installed.
     
  5. KrazyTheFox

    KrazyTheFox Scruffy Nerf-Herder

    Heh, just days after I finish adding mod merging to my mod manager, too. It's awesome that you guys are supporting all this natively.
     
    aaronlee and Voidnaut like this.
  6. Squeegy

    Squeegy Starship Captain

    Am I the only one who doesn't understand the syntax here? It seems that the example you provided is for overwriting and deleting base recipes, which is something that almost no mod author would want to do. How would this be modified to simply add a recipe to a tier? A list of tags would be more helpful.

    e: Another example: Say I wanted to overwrite an existing item so that it provided a different functionality. What is the bare minimum necessary to merge them?
     
  7. Shamyi

    Shamyi Big Damn Hero

    this can be done without a player.config file, see Better Beds by @Axelzero.
    this new system seems to be a way to merge multiple player.configs which
    are only needed when adding in or changing existing recipes.
     
  8. Squeegy

    Squeegy Starship Captain

    From the description, it seems like more of a general way to merge any file, but it doesn't seem to work that way in practice.
     
  9. Flame080

    Flame080 Red Gang

    mods need to be shown more on youtube so pepole will care more (like lets plays whith mods)
     
  10. Shamyi

    Shamyi Big Damn Hero

    the important thing to notice with his example is that most of it is commented out

    from the example I'm guessing then that to add new items to say tier1 would look something like:

    Code:
    {
    
    "__merge" : [],
    "defaultBlueprints" : {
    "__merge" : [
    [ "add", "tier1" ]
    ],
    "tier1" : [ { "item" : "new_item" } ]
    "tier1" : [ { "item" : "new_item2" } ]
    "tier1" : [ { "item" : "new_item3" } ]
    }
    
    }
     
    Last edited: Dec 16, 2013
  11. Squeegy

    Squeegy Starship Captain

    Where did you get "add" from? It wasn't in his post.

    Also, this doesn't work. It simply overwrites player.config and then the game can't load because it can't find anything.
     
  12. madtulip

    madtulip Phantasmal Quasar

    Code:
    if (in_the_next_patch > now)
      return;
    else
      everyones_happy();
    end
    Im happy that you adress the modding community bartwe. There seems to be a lot going on with the new mod forum section and the recent changes to the /mods folder. I hope the lua API is next on the list :).

    keep up the good work.
     
  13. KrazyTheFox

    KrazyTheFox Scruffy Nerf-Herder

    I believe this isn't in the game yet, but rather, it will be next patch.
     
  14. Rico Penguin

    Rico Penguin Star Wrangler

    Yeah I'm not entirely sure I follow this but I want to. That looks like exactly what I need at the moment.

    edit: Basically I want to remove old tools that have been outmoded by my mods. But at the moment it looks like I'd need to brute force it.

    I also hate having a huge player.config, so this should be a great change.
     
  15. Shamyi

    Shamyi Big Damn Hero

    I assumed add would be a thing if not the default for merge, again this is all an assumption.
    we'll have to wait to see how it actually works, I'm just trying to point out
    that it's not as much of an overhaul modder side as it first may seem.

    also yes, it will not work now either way as this new system is not yet implemented
     
  16. Squeegy

    Squeegy Starship Captain

    Wasn't this the next patch? Offended Koala just came out today. The /mods functionality was also described as "in the next patch," but it's in already (I think? Works for me and it's in the patch notes.)
     
  17. Shamyi

    Shamyi Big Damn Hero

    that was a different mod change, these notes are about the next patch after Offended Koala
     
  18. Squeegy

    Squeegy Starship Captain

    So it's a case of really unclear phrasing. Both this and:
    http://community.playstarbound.com/index.php?threads/making-mod-installation-easier.52349/
    are described as, and I quote, "in the next patch."

    Why are they both stickies? Why didn't anybody go back and edit the wording? Why aren't the Offended Koala patch notes on the site? Good lord.
     
  19. Shamyi

    Shamyi Big Damn Hero

    yes, they could have stated which patch the changes would be in but if you look
    at the time of that post it is Yesterday at 8:18 AM placing it before
    Offended Koala were as this post is brand new suggesting that "next patch" is
    actually this coming patch after Offended Koala

    I'm done, no need to cluter this thread xD
     
  20. aMannus

    aMannus Space Kumquat

    Will I.. Will I.. finally be able to move away from a furnace recipe to teach recipes to my players..? Excited. :)
     
    okok111 and Voidnaut like this.
Thread Status:
Not open for further replies.

Share This Page