Difference between revisions of "Patches"

From wiki
Jump to: navigation, search
("patch")
(Creating a Patch)
Line 34: Line 34:
 
The final property, "patch", is the important section. This is where you place the [[Modding_Key_Terms#Blob|Blobs]] you want to patch.
 
The final property, "patch", is the important section. This is where you place the [[Modding_Key_Terms#Blob|Blobs]] you want to patch.
  
 +
= Caveats, Warnings and Troubleshooting=
 +
 +
You CAN NOT patch a file if there is a space in the file name. So "mods/Basic Staples/plant.item" can't be patched but "mods/Basic-Staples/plant.item" can be. DON'T USE SPACES IN YOUR FILE NAMES.
 +
 +
Not every file can be patched.
 +
 +
Some files can only be partially patched (Meaning that certain keys can't be edited by patching while others can. Changing the .QB file for a TileObject for instance can't be done, but you can change that object's sell value. You can't change the "code" entry at all.)
 +
 +
Some keys can't be merged and you'll simply have to replace the entire contents of that key (Auto Tiles aren't partially patchable.)
 +
 +
Generally you should avoid using the patch system to try to remove something entirely. You can't remove a key that has already been set, and removing something from a list will require re-writing the list entirely while merging is off. If you ARE trying to remove something please give your patch a low priority so other people's patches can be set higher to override it if they need to.
 +
 +
Two patches set to the same level WILL conflict so try to give your patch priority numbers some buffer room that other modders can work around.
  
 
= Config Options =
 
= Config Options =

Revision as of 17:36, 27 August 2020

In Staxel, *.patch files are used to patch existing files in the game. This doesn't work for everything but will work for most things. Note that you can only patch one file using a *.patch file. You will need to make another file if you use to patch something else.


Creating a Patch

While not as necessary for patches, make sure to follow Modding#Getting Started with Staxel Modding first. Once this is done, create a file with an ending of .patch, and place the following into it.

{
 "file": "staxel/item/complete/IceCream.item",
 "priority": 2, 
 "mergeLists": false, 
 "patch" : {
 "pricing": {
   "catalogueUnlockedFromStart": false,
   "buyable": true,
   "sellPrice": 1008,
   "value": 1680
  }
 }
}

This is a fairly straight forward patch. It is used to change the pricing component of Ice Cream. Feel free to edit these values however you want.


The first property, "file", is the string that contains the file path to the file you want to patch.

The second property, "priority", is used to determine the priority of multiple patches of the same file.

The next property, "mergeList", is self explanatory. It determines whether you wish to merge your patch with existing lists or to completely override the list.

The final property, "patch", is the important section. This is where you place the Blobs you want to patch.

Caveats, Warnings and Troubleshooting

You CAN NOT patch a file if there is a space in the file name. So "mods/Basic Staples/plant.item" can't be patched but "mods/Basic-Staples/plant.item" can be. DON'T USE SPACES IN YOUR FILE NAMES.

Not every file can be patched.

Some files can only be partially patched (Meaning that certain keys can't be edited by patching while others can. Changing the .QB file for a TileObject for instance can't be done, but you can change that object's sell value. You can't change the "code" entry at all.)

Some keys can't be merged and you'll simply have to replace the entire contents of that key (Auto Tiles aren't partially patchable.)

Generally you should avoid using the patch system to try to remove something entirely. You can't remove a key that has already been set, and removing something from a list will require re-writing the list entirely while merging is off. If you ARE trying to remove something please give your patch a low priority so other people's patches can be set higher to override it if they need to.

Two patches set to the same level WILL conflict so try to give your patch priority numbers some buffer room that other modders can work around.

Config Options

"file"

Valid options (String ): A string containing the path to a file.

Default Value: No default value is specified. Always need to provide your own.

The file to use for the patch. This includes the file path as well as the filename extension. The game will not notify you if you have entered an incorrect filepath so ensure that you have entered it correctly.


"priority"

Valid options (Integer): A positive integer number.

Default Value: If not specified, will default to 0.

This is the order in which to apply the patch. The patch with higher priority will display over the top of the patch with lower priority.

"mergeLists"

Valid options (Bool): True or False.

Default Value: If not specified, will default to True.

This value specifies whether or not to mergeLists included in "patch". True will add properties inside of your list to the list of the existing file while false will override the existing list with the list you have provided.

"fileCheck"

Valid options (Bool): True or False.

Default Value: If not specified, will default to True.

This value specifies whether or not to check if the "file" exists. Currently this doesn't seem to work and can be omitted.


"patch"

Valid options (Blobs): JSON objects or properties.

Default Value: No default value is specified. Always need to provide your own.

This is the main part of the .patch file. This blob contains all the components, lists and properties you wish to patch.