Starbound

Starbound

Not enough ratings
JSON Item Manager
2
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
62.299 KB
20 Aug, 2023 @ 1:59am
1 Change Note ( view )

Subscribe to download
JSON Item Manager

Description
A simple UI MOD that allows you to import custom item files in JSON format into the game or export in-game items as JSON files.

*Attention!*
To use this mod, you need to disable the "safeScripts" property in Starbound.
By disabling this property, there is a security risk against malicious mods.
Please be aware of the above risk when using this mod.



This mod requires Stardust Core Lite as a prerequisite. Additionally, in order to make the mod work, you'll need to reconfigure certain game settings and create folders. The installation process is described below.

Installation:
  1. Subscribe to this mod and the Stardust Core Lite.
  2. Open "Starbound\storage\" and open starbound.config with a text editor.
  3. Change the value of "safeScripts" to false and save.
  4. Under "Starbound\mods\", create a directory named "\jsonItemManager\customitems"
    (ex - "Starbound\mods\jsonItemManager\customitems\")

Note:
  • If you intend to import the JSON files you've added to the "customitems" folder using the in-game UI, make sure to press the resource reload key (usually F8) beforehand.
  • Furthermore, a collection of sample furniture items is included as an added bonus. You can import these items into the game by typing "manager_testitem" (rest assured, this item is fully compatible with multiplayer mode!).

-------------------------------------------

json形式のカスタムアイテムファイルをゲーム内に取り込んだり、インゲームアイテムをjsonファイルとしてエクスポートする事が出来るシンプルなUI MODです。

注意!
このModを使用するには、Starboundの"safeScripts"プロパティを無効化する必要があります。
このプロパティを無効化することによって、悪意のあるModに対するセキュリティリスクが発生するため、このModを使用する際は、上記のリスクがある事をご理解ください。



このmodは前提MODとして、Stardust Core Liteが必要です。
また、MODを動作させるために一部ゲームのコンフィグの再設定や、フォルダを作成する必要があります。下記にインストール方法について記載します。

インストール方法:
  1. 当ModとStardust Core Liteをサブスクライブします。
  2. "Starbound\storage\"を開き、starbound.configをテキストエディタで開きます。
  3. "safeScripts" の値をfalseに変更し、保存します。
  4. "Starbound\mods"下に、"\jsonItemManager\customitems"というディレクトリを作成します。
    (最終的なファイルパス:"Starbound\mods\jsonItemManager\customitems\")

備考:
  • customitemsフォルダに追加したJSONファイルをUIでインポートしたい時は、先にリソースのリロード(デフォルトではF8キー)を実行してください。
  • サンプルの家具アイテムが付録として含まれています。"manager_testitem"を入力する事でゲーム内にインポートできます。(このアイテムはもちろんマルチプレイ対応です!)
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.