Guide:MEB/Chapter2

From Starbounder - Starbound Wiki
Jump to: navigation, search

Chapter 2: Our First Mod - Editing Vanilla files

The first thing we need to do before we start modding is to make sure you can see known file extensions. You can find out more info about that here- Microsoft Support
Now that is done, lets setup our mod folder. For sake of consistency create a new folder "Test" inside the starbound/mods folder. So the structure should end up Starbound/mods/test Now open up notepad ++ and copy the following.

{
  "name" : "test",
  "version" : "Beta v. Enraged Koala",
  "path" : ".",
  "dependencies" : [],
  "metadata" : {
    "version" : "1.00",
	"author" : "Test",
	"description" : "test"
  }
}

Fill in the details accordingly. Don't change path and dependency.
Once you are done, save the file as pak.modinfo
pak.modinfo is the name required when you are going to package the file. So it is better to keep the as the standard name for all your modinfo files accordingly from now on.
One of the most important things when editing an already existing file is to make sure the file you make the changes to is the exact same parallel location. In our case we are going to change the recipe file for torch. The torch recipe file is located at

\recipes\starter\plain

now in order to create a parallel location. We need to look at our modinfo file. The modinfo file essentially is equal to your "assets" folder. So in our case we made the folder "Test" in the starbound\mods folder. Inside the test folder we put the pak.modinfo file. So the parallel location of the file would be

test\recipes\starter\plain

Now lets copy the torch.recipe file into our test folder at the parallel location shown above.
Now there is an important thing to note, you can make direct changes to the file and let it work. This is known as a dirty edit. The other option is to create a "merge" command within the file, which only includes in the changes you want. The Merge method allows much more compatibility with other mods. But if you have no plan on using other mods, and simply want your own edits. You do not need to use merge.

MERGING THE FILE

The first place to learn about merging is through the resources provided by Bartwerf.


Lets open the copied file we placed into our test folder in the parallel folder associated with torch. Inside the contents will be

{
  "input" : [
    { "item" : "fullwood1", "count" : 1 },
    { "item" : "coalore", "count" : 1 }
  ],
  "output" : {
    "item" : "torch",
    "count" : 2
  },
  "groups" : [ "plain", "objects", "all" ]
}


Now the only change we want to make is to the input. So lets change our file accordingly.

{ "__merge" : [],
  "input" : [
    { "item" : "money", "count" : 0 }
  ]
}

One thing to note is there are 2 underline characters infront of merge. Now let us make it so torches are free. And that's it. When using the merge command only the part you wish to change needs to be placed. Now when you run the game, and if everything done is right. Your torches will be free.