Starbound

Starbound

JSON Item Manager
5 Comments
yunyu  [author] 20 Aug, 2023 @ 5:40pm 
Thank you. Indeed, the explanation about modifying the safeScripts option was insufficient, so I have updated the explanatory text.

Thank you for your suggestion. We will consider implementing the export functionality using logs in a future update (for instance, making use of logs when the user's safeScripts are set to true). However, if exporting through logs is already possible with RexmecK's ItemEditor, then I might not need to implement that feature in my Mod. I will consider this as well.
Anter583 20 Aug, 2023 @ 12:43pm 
If you want to do this more safely, I would recommend printing the json into the log and the player would then need to copy that json from the log, create the json file in the custom mod folder (or in the "user" folder found within the assets folder) and paste the json code inside it.


This can be done with the following lua call for saving to log in a compacted json format:
sb.logInfo("%s", sb.printJson(JSON_CODE_HERE))

And you can access any json file with the use of the following function, although you might want to pcall it, as it causes a script error if it can't find the inputed entry:
root.assetJson(`String` assetPath)


This should completely remove the need to disable script safety, at the cost of like 20 secs of manual labour on the user's part.
Anter583 20 Aug, 2023 @ 10:11am 
You should probably put a big warning about safeScripts, it's a rather dangerous option to just nonchalantly disable, especially by people that don't know its true nature (it has the potential of turning SB into a virus if you install a mod with hidden malicious intents).

That's one of the big reasons why nobody has made mods that need it disabled, so many things would be possible if it was safe to disable it.


Furthermore, RexmecK Item Editor already allows you to partially do this in a much safer way, albeit being a bit more manual.
yunyu  [author] 20 Aug, 2023 @ 7:05am 
This mod was created with the purpose of simplifying the import and export of in-game items to and from JSON files.

For example, when creating custom items, they need to be treated as JSON files. However, if you wanted to edit items obtained in-game using a text editor, you would need to use external tools like StarCheat, or convert the player file to JSON format to inspect its contents. This mod allows you to directly export items to JSON files in a folder, making it easy to convert custom items to JSON without using external tools.

Furthermore, when importing custom items back into the game after editing, the usual method required entering single-player mode and enabling the /admin command to use /spawnitem. However, with this mod, if there are JSON files in the folder, you can import items into the game in multiplayer mode as well.
COVID-19 20 Aug, 2023 @ 6:48am 
Looks interesting, but what exactly is the use-case for this?

Do you export an in-game item under a custom name, edit the sprite, and re-import it? In which case it would basically just be a simplified modding process for edited items/sprites?

Or is this some kind of solution to have custom items in the game clientside?

I'm interested in it, but not sure exactly what it's for.