SANDBOX — this is a test environment. No servers are actually deployed and no real payments are charged.
Back to NxLabs

NxLabs / Vintage Story

PatchDebug

GBy goxmeor

This is a tool for mod developers. Dumps JSON to logs before and after selected patches are made....

Description

<p class="code-line code-line" data-line="2">This is a tool for mod developers.</p> <p class="code-line code-line" data-line="4">Dumps JSON to logs before and after selected patches are made.</p> <p class="code-line code-line" data-line="6">Rename your patch file to include&nbsp;<code>.debug.</code>&nbsp;in its filename to trigger dumping. For example,&nbsp;<code>assets/ropeorganization/patches/ropetricks.debug.json</code>.</p> <p class="code-line code-line" data-line="8">Copious amounts of JSON will be dumped to your&nbsp;<code>server-debug.txt</code>&nbsp;and/or&nbsp;<code>client-debug.txt</code>&nbsp;log files.</p> <p class="code-line code-line" data-line="10">Please make sure to rename your files back when you're done!</p> <h2 id="example" class="code-line code-line" data-line="12">Example</h2> <p class="code-line code-line" data-line="14"><code>assets/ropeorganization/patches/ropetricks.debug.json</code>:</p> <pre><code class="code-line code-line" data-line="16"><code></code></code></pre> <pre>[ { "file": "game:itemtypes/resource/rope.json", "op": "add", "path": "/creativeinventory", "value": { "made_of_plants": ["*"], "long_and_thin": ["*"] }, } ]</pre> <pre><code class="code-line code-line" data-line="16"><code></code></code></pre> <p class="code-line code-line" data-line="30">Excerpt from&nbsp;<code>server-debug.txt</code>:</p> <pre><code class="code-line code-line" data-line="32"><code></code></code></pre> <pre>15.4.2021 03:29:36 [VerboseDebug] = PatchDebug = patches/ropetricks.debug.json =&gt; game:itemtypes/resource/rope.json #0 = BEFORE = 15.4.2021 03:29:36 [VerboseDebug] { code: "rope", texture: { base: "item/resource/rope" }, creativeinventory: { "general": ["*"], "items": ["*"] }, maxstacksize: 16, materialDensity: 510 } 15.4.2021 03:29:36 [VerboseDebug] = PatchDebug = patches/ropetricks.debug.json =&gt; game:itemtypes/resource/rope.json #0 = /BEFORE = 15.4.2021 03:29:36 [VerboseDebug] = PatchDebug = patches/ropetricks.debug.json =&gt; game:itemtypes/resource/rope.json #0 = AFTER = 15.4.2021 03:29:36 [VerboseDebug] { "code": "rope", "texture": { "base": "item/resource/rope" }, "creativeinventory": { "made_of_plants": [ "*" ], "long_and_thin": [ "*" ] }, "maxstacksize": 16, "materialDensity": 510 } 15.4.2021 03:29:36 [VerboseDebug] = PatchDebug = patches/ropetricks.debug.json =&gt; game:itemtypes/resource/rope.json #0 = /AFTER =</pre> <pre><code class="code-line code-line" data-line="32"><code></code></code></pre> <p class="code-line code-line" data-line="62">Oops!&nbsp;<code>/creativeinventory</code>&nbsp;got replaced, deleting&nbsp;<code>"general": ["*"], "items": ["*"]</code>.</p> <h2 id="solution" class="code-line code-line" data-line="64">Solution</h2> <p class="code-line code-line" data-line="66">The purpose of this mod is to help identify problems, but for posterity, here is the correct way to solve the problem above of adding multiple keys:</p> <pre><code class="code-line code-line" data-line="68"><code></code></code></pre> <pre>[ { "file": "game:itemtypes/resource/rope.json", "op": "add", "path": "/creativeinventory/made_of_plants", "value": ["*"] }, { "file": "game:itemtypes/resource/rope.json", "op": "add", "path": "/creativeinventory/long_and_thin", "value": ["*"] } ]</pre> <pre><code class="code-line code-line" data-line="68"><code></code></code></pre>

Download

No download link is available for this entry right now.

Ratings & reviews

No ratings yet

Sign in to leave a rating or comment.