Jump to content

Recommended Posts

Posted (edited)

Hello I had some help with with this from Vies, but I really don't want to bother him to much and I feel like I don't understand enough to ask the right questions.
 image.thumb.png.d7b5af8069e15a5310b3f6f676a483e1.png
Currently have this for the folder layout, I've been zipping /assets/thunder-v1/patches/compatibility/wildcraftfruit/itemtypes/food (just realized I've had compatibility misspelled, hope that's not why)
 

[
	{

		"_comment": "Adjusts cloudberry spoil timer to make it more realistic to my needs and desires.",
		"enabled": true,
		"op": "replace",
		"path": "/transitionablePropsByType",
		"value": {
			"*-cloudberry": [
				{
					"type": "Melt",
					"freshHours": { "avg": 192 },
					"transitionHours": { "avg": 256 },
					"transitionedStack": {
						"type": "item",
						"code": "wildcraftfruit:berrymush-cloudberrymush"
					},
					"transitionRatio": 1
				}
			]
			

		},
	
	"file": "wildcraftfruit:assets/wildcraftfruit/itemtypes/food/fruit.json",
	"dependsOn": [ { "modid": "wildcraftfruit" } ]
	}
]

this is the current contents of the file, I'm trying to figure out where I'm going wrong, do the file names matter I'd assume they do but I'm not sure if all or only some matter. The Cloudberries rot too quickly to be useful for anything other than eating right away, I want to make pies with them but with the rate the spoil I'd have to carry around a table and pre made dough with me to be able to achieve my desire. When I have to travel so far afield to find them and by the time I get back to base they are already mush and useless for making pies. Since I can't have them change it for just me, I'd like to figure out how to patch this but I can't figure out how to make it work. Any help would be greatly appreciated.

image.png.1c07fe2c91768f65ce937b6d21135236.png

This is where the file I'm trying to patch is. I have it unzipped to look at and see how it's written it's normally in the zip file as packaged from the original author.
Below is the code I'm looking to patch

image.thumb.png.3c68ef42778dbb8105336bdee23d4856.png

Edited by Odur27
Posted (edited)
11 hours ago, Odur27 said:

just realized I've had compatibility misspelled, hope that's not why

That would contribute to your problem.

Following your patch order, your problem starts with the path. Currently you are replacing the whole transitionablePropsByType property, which includes much more than just the cloudberry definition. The correct path would read

"path": "/transitionablePropsByType/*-cloudberry"

But because you are changing only two values, fresh- and transitionHours it will be much easier to replace only these values. We can do that by navigating all the way to avg.

Keep in mind, *-cloudberry's content is in array format, you have to address the array number you want to open as well (arrays start on position 0, not 1). If you are stumped by this and can't find the solution: I made it a bit easier for you, and marked in the spoiler the correct path to the hours the cloudberries stay fresh. (Of course you would need to write a second patch for transitionHours.)

Spoiler
11 hours ago, Odur27 said:

[
    {
        "_comment": "Adjusts cloudberry spoil timer to make it more realistic to my needs and desires.",
        "enabled": true,
        "op": "replace",
        "path": "/transitionablePropsByType",
        "value": {
            "*-cloudberry": [
                {
                    "type": "Melt",
                    "freshHours": { "avg": 192 },
                    "transitionHours": { "avg": 256 },
                    "transitionedStack": {
                        "type": "item",
                        "code": "wildcraftfruit:berrymush-cloudberrymush"
                    },
                    "transitionRatio": 1
                }
            ]
        },
    
    "file": "wildcraftfruit:assets/wildcraftfruit/itemtypes/food/fruit.json",
    "dependsOn": [ { "modid": "wildcraftfruit" } ]
    }
]

The next problem would be the file property. With the domain wildcraftfruit you already told VintageStory to look in the assets folder of wildcraftfruit. Currently you are essentially telling the game to patch fruit.json in assets/wildcraftfruit/assets/wildcraftfruit/itemtypes/food/. Starting your file path with itemtypes is sufficient.

Edited by Brady_The
  • Thanks 1
Posted
9 hours ago, Brady_The said:

That would contribute to your problem.

Following your patch order, your problem starts with the path. Currently you are replacing the whole transitionablePropsByType property, which includes much more than just the cloudberry definition. The correct path would read

"path": "/transitionablePropsByType/*-cloudberry"

But because you are changing only two values, fresh- and transitionHours it will be much easier to replace only these values. We can do that by navigating all the way to avg.

Keep in mind, *-cloudberry's content is in array format, you have to address the array number you want to open as well (arrays start on position 0, not 1). If you are stumped by this and can't find the solution: I made it a bit easier for you, and marked in the spoiler the correct path to the hours the cloudberries stay fresh. (Of course you would need to write a second patch for transitionHours.)

  Hide contents

 

The next problem would be the file property. With the domain wildcraftfruit you already told VintageStory to look in the assets folder of wildcraftfruit. Currently you are essentially telling the game to patch fruit.json in assets/wildcraftfruit/assets/wildcraftfruit/itemtypes/food/. Starting your file path with itemtypes is sufficient.

I probably should of specified I have basically zero coding knowledge, I have been able to make simple edits and duplicating certain things by copy pasting and changing values. Anything I do know was mostly in XML or C based languages prior to this. Below is what I have after your instructions, but I've got no idea what to remove to make my server boot again, or if I even made the edits correctly. Only thing that's really gotten me this far beyond your information is if visual studio gives me an error or warning and highlights my mistake. Which visual studio currently sees no issue with this. I know best practice is to help others help themselves but I'm at a loss here.
 

[
	{

		"_comment": "Adjusts cloudberry spoil timer to make it more realistic to my needs and desires.",
		"enabled": true,
		"op": "replace",
		"path": "/transitionablePropsByType/*-cloudberry/freshHours { avg",
	
		"value": {
			"*-cloudberry": [
				{
					"type": "Melt",
					"freshHours": { "avg": 192 },
					"transitionHours": { "avg": 24 },
					"transitionedStack": {
						"type": "item",
						"code": "wildcraftfruit:berrymush-cloudberrymush"
					},
					"transitionRatio": 1
				}
			]


		},

		"file": "wildcraftfruit:/itemtypes/food/fruit.json",
		"dependsOn": [ { "modid": "wildcraftfruit" } ]
	}
]

 

  • Like 1
Posted
2 hours ago, Odur27 said:

I know best practice is to help others help themselves but I'm at a loss here.

Don't worry, I explained it too poorly. Did you have a look at https://wiki.vintagestory.at/index.php/Modding:JSON_Patching beforehand? The article should explain everything much better than I did.

I also included my solution in the spoiler. I am no master patcher but technically this should work.

Spoiler

[
  {
    "file": "wildcraftfruit:itemtypes/food/fruit.json",
    "op": "replace",
    "path": "/transitionablePropsByType/*-cloudberry/0/freshHours/avg",
    "value": 192,
    "side": "server",
    "dependsOn": [ { "modid": "wildcraftfruit" } ]
  },
  {
    "file": "wildcraftfruit:itemtypes/food/fruit.json",
    "op": "replace",
    "path": "/transitionablePropsByType/*-cloudberry/0/transitionHours/avg",
    "value": 256,
    "side": "server",
    "dependsOn": [ { "modid": "wildcraftfruit" } ]
  }
]

 

  • Thanks 1
Posted
2 hours ago, Brady_The said:

Don't worry, I explained it too poorly. Did you have a look at https://wiki.vintagestory.at/index.php/Modding:JSON_Patching beforehand? The article should explain everything much better than I did.

I also included my solution in the spoiler. I am no master patcher but technically this should work.

  Hide contents

[
  {
    "file": "wildcraftfruit:itemtypes/food/fruit.json",
    "op": "replace",
    "path": "/transitionablePropsByType/*-cloudberry/0/freshHours/avg",
    "value": 192,
    "side": "server",
    "dependsOn": [ { "modid": "wildcraftfruit" } ]
  },
  {
    "file": "wildcraftfruit:itemtypes/food/fruit.json",
    "op": "replace",
    "path": "/transitionablePropsByType/*-cloudberry/0/transitionHours/avg",
    "value": 256,
    "side": "server",
    "dependsOn": [ { "modid": "wildcraftfruit" } ]
  }
]

 

Thank you so much, that worked perfectly. You have somewhere I can send you some money for a coffee or something?

  • Like 1
Posted (edited)
9 hours ago, Odur27 said:

Thank you so much, that worked perfectly. You have somewhere I can send you some money for a coffee or something?

There's no need for that. I appreciate the thought, though!

Edited by Brady_The
  • Like 1
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.