Only Require One Entry in Player.config

Discussion in 'Starbound Modding' started by CrownFox, Dec 11, 2013.

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

    CrownFox Subatomic Cosmonaut

    Something I keep seeing in every mod is a long list of information to be added to the player.config file.

    Like this:
    Code:
    { "item" : "onething" },
    { "item" : "anotherthing" },
    { "item" : "yetanotherthing" },
    { "item" : "athingagain" },
    { "item" : "whysomanythings" }
    However, this is definitely unnecessary.

    You can add your entire list of recipes just by adding one recipe.

    The trick is to add the recipes to an item.

    Lets say you made a mod to add BOOKS to the game. Books that, for some reason, you have to craft. Lets say these books are crafted on a scrawling table! However, people are complaining that you have to add every recipe to the config.

    Well, the fix is easy. Power up your Notepad program and open up your scrawlingtable.object file!

    Now, scroll down all the way to the bottom.

    Just before the last } , add the following

    Code:
    "learnBlueprintsOnPickup" : [
      "bluebook",
      "redbook",
      "greenbook",
      "purplebook",
      "yellowbook",
      "somanybooks"
    ]
    Then, make sure the field before that code has a comma! Never forget commas when they're needed.

    Now that your scrawling table adds all those book recipes when it enters your inventory, all you need to put in the player.config file is:
    Code:
    { "item" : "scrawlingtable" },
    That's it. It's really easy! If you have a bunch of items that have to be crafted at different stages, and from different tables, this is an easy way of getting that done. You can add any item or object to the game and make that object give you recipes. Just add the "learnBlueprintOnPickup" field to any item or object.
     
    Last edited: Dec 11, 2013
    The | Suit, mo'guts and Lynx88 like this.
  2. Droob

    Droob Subatomic Cosmonaut

    Let's say you need to learn the blueprints to craft said scrawling table, what alternatives to editing player.config do you have?
     
  3. CrownFox

    CrownFox Subatomic Cosmonaut

    The only alternatives to editing player.config would be to add the blueprints to various loot drops. Like the blueprints you see for Mushroom doors, Eye chests, and other fun stuff.

    However, if you want the table to be craftable from the start you need to add it to the player.config.
     
  4. Kyrosiris

    Kyrosiris Scruffy Nerf-Herder

    Is it possible to restrict based on tech level in this way, or would that all need to be done through player.config?
     
  5. Manntooth

    Manntooth Space Spelunker

    Couldn't you just add the recipes you want restricted to tier 2 to the Metalwork Station's learnBlueprintsOnPickup property?

    EDIT: Also, I keep seeing comma reminders, lol:

    If anyone is unsure of if they missed any commas, brackets, or braces, run your modified code through a JSON parser. It will fail the eval step if you miss a comma or have an unmatched brace: http://json.parser.online.fr/ Think of it as your own little compiler. :)
     
    Last edited: Dec 14, 2013
  6. Twisted Codex

    Twisted Codex Void-Bound Voyager

    Yeah thats how that works, its exactly what he's trying to do. He can limit it to being on pickup of a boss material, or on using the starmap upgrades.
     
  7. tifel100

    tifel100 Void-Bound Voyager

    Or you could add it to like a torch or something, probably would work, if you drop and pick up your torches.
     
  8. Cayote

    Cayote Aquatic Astronaut

    Or a mod maker could include a player.config in their mod directory using the bootstrap.config method, eliminates the need to edit the player.config completely.
     
  9. tifel100

    tifel100 Void-Bound Voyager

    so does adding it to a torch, you would have to edit torch instead. :p
     
  10. Cayote

    Cayote Aquatic Astronaut

    Except my method, people who download the mod don't have to edit anything but the bootstrap.config but that's an easy edit that doesn't require knowledge of what the mod needs.
     
  11. CrownFox

    CrownFox Subatomic Cosmonaut

    Except, that's not true.

    The thing about the player.config using the bootstrap method is that loading a different version of the player.config overwrites the player.config file previously loaded.
    If you were to play with multiple mods that each edit the player.config, but only use the bootstrap method, only one would work. That one being the last one loaded.

    It works by prioritizing the load order of assets in the bootstrap's selected directories.

    Code:
    assetSources":[
        "../assets",
            "../mods/mod1",
            "../mods/mod2"
    ],
    If mod1 and mod2 both edited player.config, only mod2's player.config would be loaded.
    First it would load ../assets/player.config,
    Then it would load ../mods/mod1/player.config and overwrite ../assets/player.config
    Then it would load ../mods/mod2/player.config and overwrite ../mods/mods1/player.config

    That's why there are modloaders that create a "patched" player.config
    However, those modloaders suffer from various bugs that cause certain mods to not work, or don't have features that would let them be used easier.

    The best results would come from taking all the edits of all the player.config files and making your own ../assetsPatched/player.config containing everything necessary by every mod. This would be the same for every conflicting file in every mod.

    Mainly because one of the mod loaders doesn't support multiple mods editing the same files correctly. The issue being lists. It combines the lists, even if the same items are in both lists.

    The other modloader is much better on file merging, but you have to implicitly state what files need to be merged. While that's okay, it's still a hindrance if you want mods to load together correctly. Because if mod A merges player.config, but mod B doesn't merge player.config, you're screwed. All the default list items in player.config for mod B will end up added to the player.config, creating duplicate entries. While mod A will work perfectly fine. You won't be able to play Mod A and Mod B at the same time.
     
    Cayote likes this.
  12. Cayote

    Cayote Aquatic Astronaut

    Very nice explanation and luckily enough the next patch will fix this problem completely.
     
Thread Status:
Not open for further replies.

Share This Page