The new JSON patching system discussed way back on June 25 has landed. There might be a few edge cases that aren’t implemented correctly, but it’s passed all of the tests I threw at it. Let me know if you find an edge case I missed.

“__merge” style patches no longer work. You can override files fully, or you can use the patch system. To use a patch, name the file “whatever.config.patch” where “whatever.config” is the file you want to patch. It should support the entirety of RFC6902 and RFC6901.

Q: Can you give us an example?

A: Sure:

Here’s a short example.

Let’s say you have a file named… oh I don’t know, “player.config” And let’s say you want to change the hitbox of the player by changing around the standing poly.

You would create a file called “player.config.patch” and it could contain, for example, the following:



[

{ "op" : "replace", "path" : "/techControllerSettings/baseMovementParameters/standingPoly/2", "value" : [ 1.35, -2.5] },

{ "op" : "replace", "path" : "/techControllerSettings/baseMovementParameters/standingPoly/3", "value" : [ 1.75, -2.0] },

{ "op" : "replace", "path" : "/techControllerSettings/baseMovementParameters/standingPoly/4", "value" : [ 1.75, 0.65] },

{ "op" : "replace", "path" : "/techControllerSettings/baseMovementParameters/standingPoly/5", "value" : [ 1.35, 1.22] }

]



What that will do is change the values in the file from:



"techControllerSettings" : {

"baseMovementParameters" : {

"standingPoly" : [ [-0.75, -2.0], [-0.35, -2.5], [0.35, -2.5], [0.75, -2.0], [0.75, 0.65], [0.35, 1.22], [-0.35, 1.22], [-0.75, 0.65] ],

"crouchingPoly" : [ [-0.75, -2.0], [-0.35, -2.5], [0.35, -2.5], [0.75, -2.0], [0.75, -1], [0.35, -0.5], [-0.35, -0.5], [-0.75, -1] ],

"airFriction" : 0.2,

"mass" : 0.6,

// should keep the player from teleporting through walls

"maximumCorrection" : 1,

"maxMovementPerStep" : 0.4

}

},



to



"techControllerSettings" : {

"baseMovementParameters" : {

"standingPoly" : [ [-0.75, -2.0], [-0.35, -2.5], [1.35, -2.5], [1.75, -2.0], [1.75, 0.65], [1.35, 1.22], [-0.35, 1.22], [-0.75, 0.65] ],

"crouchingPoly" : [ [-0.75, -2.0], [-0.35, -2.5], [0.35, -2.5], [0.75, -2.0], [0.75, -1], [0.35, -0.5], [-0.35, -0.5], [-0.75, -1] ],

"airFriction" : 0.2,

"mass" : 0.6,

// should keep the player from teleporting through walls

"maximumCorrection" : 1,

"maxMovementPerStep" : 0.4

}

},



Possible values for “op” are: “test”, “add”, “remove”, “move”, “copy”, and “replace”. They do what it says on the tin. The only one potentially confusing is “test” which simply tests the path for some value, and if it’s not correct it aborts the patch.

“test”, “add”, and “replace” take “path” and “value”

“remove” just takes “path”

“move” and “copy” take “from” and “path”

There’s other stuff like “-” for end of list and using ~1 and ~0 to reference “/” and “~” respectively. But that’s pretty much it.