Modding:Basic Property Modification

From Starbounder - Starbound Wiki
Jump to: navigation, search
Mining Hazard Sign.png
Work In Progress!
Mining Hazard Sign.png

This article or section is currently in the process of an expansion or major restructuring.
You are welcome to assist in its construction by editing it as well.

Last edited by 😺 on 2017-04-29 09:11:50.

As of 2017, this page contains outdated info - it needs a rewrite taking the patching system into account. For now, please refer to this page's external links section for references

Introduction

This tutorial will show you how to edit a vanilla file and create an associated mod. In this example we will be modifying the fuel value of coalore.


Setup

Before we start - make sure you have unpacked your assets and created a mod folder with a modinfo file. You can learn all those things at Modding Basics.

Important Notes

One of the most important things to be wary of when editing vanilla files is that the modified vanillia file should be in the exact parallel directory as the vanilla file.

For example

Vanilla location Assets \ items \ generic \ crafting \ coalore.item
Mod location Starbound \ mods \ mymod \ items \ generic \ crafting \ coalore.item

As you can see mymod = assets, so where coalore needs to follow the folder structure after assets. This is so the game will use the asset in your mod folder instead of that in the vanilla directory.

This is an extremely important step and if not done properly might crash the game. Once you've created the folder structure as shown in the above example, copy the coalore item from your unpacked assets into the correct parallel folder as the example.

Now its time to edit the information.

File Editing

{
  "itemName" : "coalore",
  "rarity" : "Common",
  "inventoryIcon" : "coalore.png",
  "description" : "It's coal. A decent source of fuel.",
  "shortdescription" : "Coal",
  "fuelAmount" : 2
}

( Coal Ore Item Code )

Now we have two options in how we want to proceed. One option is famously known as a "Dirty Edit" this means simply editing the file and saving it. Because the file is in the exact same mirror location as in vanilla. The game will automatically replace the modded file with the new one. If it is in the wrong location the game will crash with a Starbound.log error of duplicate file. ( An important point to keep in mind )

The biggest issue with a dirty edit is, it is highly incompatible with any other mod which wishes to edit that file. Which is why the Merge feature was added in Angry Koala. If you are planning on playing alone without other peoples mods. Feel free to use Dirty edits - but if you plan on Publishing your mod - read about merging.

Merging

NOTE: "__merge" style patches no longer work. See this article for details.

Merging is a massive topic by it self, and quite complex - so we are only going to just briefly discuss it. For more information on merging, I suggest checking out Bartwe's post found here : http://community.playstarbound.com/index.php?threads/overriding-and-merging-config-files-in-mods.53775/

Now to merge the coal ore item with the new information is quite simple. Delete all the information inside of the coalore.item inside of the mod folder ( do not delete the file it self ) and replace it with the following code.

{
  "__merge" : [],
  "description" : "Super Powered Coal.",
  "fuelAmount" : 500
}

( Merge Example 1 )

It is as simple as that. Now when you save the file and load the game, every-time you put coalore into the fuel tank you will be getting 500 fuel per coal. Also the description has been changed to "Super Powered Coal"

The same rules of JSON still apply. No comma's on the last line of the data set, so if you want to make multiple edits make sure you watch your comma and bracket placements.

Important Note This is an extremely basic example of how to merge one type of data. There are many types of data in JSON files from arrays to maps. None of which is covered here. I strongly suggest reading Bartwe's link provided above to get a more detailed idea of merge functions.

Summary

To quickly summarize You created a new folder inside Starbound \ mods such as "mymod" So the folder you are working inside is Starbound \ mods \ mymod

Inside mymod folder you have a mymod.modinfo file as described by the Modding Basics link provided above.

Inside mymod folder you also have the directory structure as follows

mods
-mymod --> (modinfo located here)
--items
---generic
----crafting
-----coalore.item

and the code for coalore.item has been replaced with the Merge Example 1.


You are now ready to start modding basic vanilla files.


Quick Navigation