Content Patcher Snippets for 1.6

From Stardew Modding Wiki
Jump to navigation Jump to search

Shops

Adding Items to Existing Shops

Here's an example of adding a furniture item to Robin's shop on Mondays. You can paste this into your Changes section and change as needed. The full list of vanilla shops is in Data/Shops, and you can look through them for the full list of options.

{
    "Action": "EditData",
    "Target": "Data/Shops",
    "TargetField": [ "Carpenter", "Items" ],
    "Entries": {
        "(F){{ModId}}_Bonsai1": {
            "Price": 1000,
            "AvailableStock": 1,
            "Id": "(F){{ModId}}_Bonsai1",
            "ItemId": "(F){{ModId}}_Bonsai1",
            "Condition": "DAY_OF_WEEK Monday"
        },
    }
}

Adding a Basic New Shop

There's several things you need to do in order to add a new shop.

This snippet adds the tile property for opening the shop.

{
	"LogName": "Add fireworks shop to festival map",
	"Action": "EditMap",
	"Target": "Maps/Beach-FireworksFestival",
	"MapTiles": [
		{
			"Position": { "X": 25, "Y": 39 },
			"Layer": "Buildings",
			"SetProperties": {
				"Action": "OpenShop {{MainModID}}PurpleBoat"
			}
		}
	]
}

This snippet adds a shop without a specific owner presence needed or specific hours, and one item that can only be purchased once.

{
	"LogName": "Create fireworks shop",
	"Action": "EditData",
	"Target": "Data/Shops",
	"Entries": {
		"{{MainModID}}PurpleBoat": {
			"Currency": 0,
			"Owners": [
				{
					"Portrait": "Portraits\\Birdie",
					"Dialogues": [
						{
							"Id": "Default",
							"Dialogue": "[LocalizedText Strings\\StringsFromCSFiles:vlFireworks.Birdie]",
						}
					],
					"Id": "AnyOrNone",
					"Name": "AnyOrNone"
				}
			],
			"SalableItemTags": [
				"ingredient_firework"
			],
			"Items": [
				{
					"Price": 5000,
					"AvailableStock": -1,
					"Id": "(O){{MainModID}}_RedFirework",
					"ItemId": "(O){{MainModID}}_RedFirework",
				},
				{
					"Price": 50000,
					"AvailableStock": 1,
					"Condition": "!PLAYER_HAS_MAIL Current vl.fireworkslicense",
					"Id": "(O){{MainModID}}_FireworksLicense",
					"ItemId": "(O){{MainModID}}_FireworksLicense",
                    "ActionsOnPurchase": [
                        "AddMail Current vl.fireworkslicense",
                        "MarkCraftingRecipeKnown Current {{MainModID}}_RedFirework"
                    ]
				}
			]
		}
    }
}

Context Tags

Editing Context Tags

In 1.5.6, context tags were stored in Data/ObjectContextTags in a comma-separated string, but in 1.6 they're directly stored in either Data/Objects or Data/BigCraftables, and they're a list. Editing them is a little wonky right now because they don't have IDs, but you can use the following format (and change the number 1 to 2 if you're editing 2 context tags). You can paste this into your Changes section and change as needed ("110" is the object ID).

{
   "Action": "EditData",
   "Target": "Data/BigCraftables",
   "TargetField": ["110", "ContextTags"],
   "Entries": {
      "#-1": "crow_scare_radius_17",
      "#-2": "other_context_tag",
   }
}

Music

Editing Horse Flute Noise

This snippet would swap the horse_flute noise with assets/music.ogg (you can change the name of the music track as needed).

{
    "Action": "EditData",
    "Target": "Data/AudioChanges",
    "Entries": {
        "horse_flute": {
            "ID": "horse_flute",
            "Category": "Sound",
            "FilePaths": [ "{{AbsoluteFilePath: assets/music.ogg}}" ],
            "StreamedVorbis": false,
            "Looped": false
        }
    }
}

Editing Cat Noise

Similarly, this swaps the cat meowing noise for assets/VeeCry.ogg. Note that this would edit all cat noises anywhere in the game; if you want to have a new pet type use a different noise you'd just directly add that noise to the game under a new unique music ID and then set the new pet's data to use the new unique music ID. This snippet is for quick and dirty porting of cat-patching pet mods that create meowing rocks, guinea pigs, foxes, etc.

{
    "Action": "EditData",
    "Target": "Data/AudioChanges",
    "Entries": {
        "cat": {
            "ID": "cat",
            "Category": "Sound",
            "FilePaths": [ "{{AbsoluteFilePath: assets/VeeCry.ogg}}" ],
            "StreamedVorbis": false,
            "Looped": false
        }
    }
}

SpaceCore Features

Animations

This snippet animates the texture for the furniture item that pulls from the texture loaded to Mods/{{ModId}}/arch, by using the 12 frames located horizontally tiled in the image. Without the animation, the furniture would simply show the first frame as a static image. Note that the rectangle likely has to exactly match the rectangle the game is looking for when it draws, similar to how DGA animations used to work. Any DGA animations can generally be 1:1 ported in this way, being mindful of making sure to load any source textures as needed.

{
    "Action": "EditData",
    "Target": "spacechase0.SpaceCore/TextureOverrides",
    "Entries": {
        "{{ModId}}_MagicArchway": {
            "TargetTexture": "Mods/{{ModId}}/arch",
            "TargetRect": {
                "X": 0, "Y": 0, "Width": 48, "Height": 64
            },
            "SourceTexture": "Mods/{{ModId}}/arch:0..11@16"
        }
    }
}