Garden Paws

Garden Paws

Not enough ratings
Let's Make A Mod: Cooking Edition
By VexedOwl
In this guide I’m going to walk you through how to make your very own mod for food items and their crafting recipes, one for the Cooking Station and one for the Stone Oven.
   
Award
Favorite
Favorited
Unfavorite
Goals and Requirements
In this guide I’m going to walk you through how to make your very own mod for food items and their crafting recipes, one for the Cooking Station and one for the Stone Oven.

Goals
  • Make Two New Items
  • Make Two New Recipes
  • Successfully Test in Game

Requirements
Visual Studio Code[code.visualstudio.com]: Download it from the blue [Download] button in the top right if you don’t already have it installed. (I won’t be walking through it’s installment)

Set Up
  1. Open File Explorer (Windows Key + E on windows)
  2. Make a new folder in a safe location on your computer, an easy location is your ‘My Documents’ folder.
  3. You're going to want to name your folder something unique so you can find it easily, for this guide let’s call it ‘yourname_TestCooking’.

I store my projects on a secondary drive, with-in a folder named 'projects'. The naming structure i use for my mods is 'name_mod', so 'VexedOwl_Cooking' for my Vexed Cooking mod.

Folder Structure
  1. Open up Visual Studio Code (or from hereout, VSC).
  2. While in VSC, go to File => Open Folder and select your newly created folder.
  3. In the explorer window of VSC, right click and make three new folders: crafting, icons and items.
  4. Make sure they are all lowercase and spelled correctly.
Config File
  1. Right click in the VSC explorer and create a new file, name that file ‘config.json’.
  2. Double left click ‘config.json’ in VSC explorer, it should open up a blank window in VSC that you can type in.
  3. In that window copy paste the code below.

{ "name":"modname", "author":"yourname", "Description":"description goes here." }

Fill in the appropriate answers; here’s an example.

{ "name":"Example Cooking", "author":"VexedOwl", "Description":"My example Cooking Mod." }
Making Items
  1. Right click on the ‘items’ folder and create a new file.
  2. Name the new file ‘scrambled_eggs.json’.
  3. Make sure to include the ‘.json’ or the mod won’t work properly.
  4. Create a second file and name it ‘baked_fish.json’.

Scrambled Eggs Item
1. Open your ‘scrambled_eggs.json’ in your items folder.
2. It should be blank, so copy the text below and we’ll fill it out together.

{ "itemtype": "food", "id": "yourid_item", "name": "name", "desc": "", "icon": "artname", "sell": 100, "stacksTo": 100, "usableType": "UsableLua" }

3. We’ll go through each line of code one by one.
  • “itemtype” there are several ‘tags’ for garden paws items, these are used to identify what items can go in certain containers. As we are making food, it’s classified as food.
    "itemtype": "food",
  • “Id” Your item ID needs to be unique, so it doesn’t override an ID or get overridden by one. I use the first part of my name as my unique ID then followed by the name of the item I'm making. This id must be the same used in your recipe and vice versa.
    "id" : "yourid_scrambled_eggs",
  • “Name” the name your item shows in game.
    "name": "Scrambled Eggs",
  • “Desc” you can add a brief item description here, it shows up in the crafting window.
    "desc": "Cheesy scrambled eggs.",
  • “Icon” this line is for determining what art represents your item in game.
    "icon": "scrambled_eggs",
  • “Sell” this is for how much an item sells for. I calculate this by the value of the ingredients plus a little extra based on how complex the recipe is.
  • A Chicken Egg is 40. Cheese is 170. Together that's 210. One of the ingredients is a processed ingredient. I classify that as an intermediate difficulty, and add a quarter of the item value to the item (52.5). That gives us 262.5. From there we round up to the nearest five, putting it at 265.
    "sell": 265,
  • “stacksTo” is how many items will go in one stack. My rule of thumb is 50 for consumables and 100 for ingredients or materials.
    stacksTo": 50,
  • “usableType” determines if an item does something while pressed on the hotbar. We want our item to be usable, so we need to put ‘UsableLua’
    "usableType": "UsableLua"

4. Now let's take a look at what it should look like all together.

{ "itemtype": "food", "id": "yourid_scrambled_eggs", "name": "Scrambled Eggs", "desc": "Cheesy scrambled eggs.", "icon": "scrambled_eggs", "sell": 50, "stacksTo": 265, "usableType": "UsableLua" }

Make sure that each line ends in a comma, except for the last line. VSC should highlight errors in red or yellow to let you know there’s something wrong.

Baked Fish JSON
1. Open your ‘baked_fish.json’ in your items folder.
2. Using the base template, fill it out on your own and we’ll compare at the end.

{ "itemtype": "food", "id": "yourid_item", "name": "name", "desc": "", "icon": "artname", "sell": 100, "stacksTo": 100, "usableType": "UsableLua" }

3. Now that you’ve filled out your JSON, let's compare!

{ "itemtype": "food", "id": "yourid_baked_fish", "name": "Baked Fish", "desc": "", "icon": "baked_fish", "sell": 105, "stacksTo": 50, "usableType": "UsableLua" }
Making Recipes
1. Right click on the ‘crafting’ folder and create a new file.
2. Name the new file ‘scrambled_eggs.json’.
3. Make sure to include the ‘.json’ or the mod won’t work properly.
4. Create a second file and name it ‘baked_fish.json’.

Scrambled Eggs Recipe
1. Open your ‘recipe_scrambled_eggs.json’.
2. It should be blank, so copy the text below and we’ll fill it out together.

{ "id" : "yourid_item", "craftedFrom" : "item:1,item:1,item:1", "craftingMachine" : "cookingstation", "craftingCommand" : "Cook", "craftingRequires" : "", "craftingTime" : 60, "base" : false }

  • Let’s look at the first line “id”. The ID tells you what item you are making, you can have multiple recipes for one item. This id must be the same used in your recipe and vice versa.
    "id" : "yourid_scrambled_eggs",[/code
  • “craftedFrom” are the items it takes to craft your recipe! In this recipe we’re going to be using chicken eggs and cheese, one of each. You’ll need the item ID of these, you can look up item IDs on the official listing here[www.gardenpawsgame.com] or the fan spreadsheet here[docs.google.com].
    "craftedFrom" : "chickenegg:1,cheese:1",
  • "craftingMachine" is the station your recipe is located at. In this case we’ll be using the Cooking Station.
    "craftingMachine" : "cookingstation",
  • "craftingCommand" is what the little crafting buttons says in the recipe window; You can keep it as Cook or change it to something else that might make sense.
    "craftingCommand" : "Cook",
  • "craftingRequires" is how you lock a recipe behind an event, like a quest. In this recipe we will leave it empty.
  • "craftingTime" is how long the recipe takes to complete. Each ‘1’ is an in game minute. So 1 = 1 minute, 60 = 1 hour and so on. Eggs don’t take a long time to cool, so we’ll go with just a simple 10.
    "craftingTime" : 10,
  • "Base" is used to determine if the recipe is always available across crafting stations. This is mostly used for crafting materials like wood boards. In this case it will remain false.

3. Now that your JSON file is filled out, it should look something like this:

{ "id" : "yourid_scrambled_eggs", "craftedFrom" : "chickenegg:1,cheese:1", "craftingMachine" : "cookingstation", "craftingCommand" : "Cook", "craftingRequires" : "", "craftingTime" : 10, "base" : false }

Baked Fish Recipe
1. This recipe will be using the stone oven, whose craftingMachine ID is ‘oven’.
2. The items for the recipe will be one of each of the following: Fish, Tomato and Lemon.
3. Using the base template, fill it out on your own and we’ll compare at the end.

{ "id" : "yourid_item", "craftedFrom" : "item:1,item:1,item:1", "craftingMachine" : "cookingstation", "craftingCommand" : "Cook", "craftingRequires" : "", "craftingTime" : 60, "base" : false }

4. Now that you’ve filled out your JSON, let's compare!

{ "id" : "yourid_baked_fish", "craftedFrom" : "fish_blue:1,tomato:1,lemon:1", "craftingMachine" : "oven", "craftingCommand" : "Bake", "craftingRequires" : "", "craftingTime" : 300, "base" : false }

Great Job! Let’s move on to the next segment!
Making Items Usable
1. Right click your mod folder in VSC and create a new file.
2. Name it ‘g_testcooking.lua’
3. Why is the ‘g_’ there? It stands for ‘global’ and is used to make the contents of the file work. But we won’t get into depth on that, just make sure it’s there.
4. Here’s a template of what to put into our new blank file.

Console.DebuggingMods(true) function OnTemplate() self.RegisterListener(Messager.UsableStarted, ApplyUsableListeners) self.RegisterListener(Messager.UsableEnded, UsableEnded) end function ApplyUsableListeners(itemID) if itemID == "yourid_baked_fish" then self.RegisterListener(Messager.UsableInteract, TwentyFiveEnergyHandler) elseif itemID == "yourid_scrambled_eggs" then self.RegisterListener(Messager.UsableInteract, TenEnergyHandler) end end function UsableEnded() self.UnregisterListener(Messager.UsableInteract) end function TenEnergyHandler() local currentEnergy = Player.energy Player.energy = currentEnergy + 10 self.ConsumeUsable() end function TwentyFiveEnergyHandler() local currentEnergy = Player.energy Player.energy = currentEnergy + 25 self.ConsumeUsable() end

Breaking Down The Code
We're going to focus on the bits you need to change, lets start with our items.

You can see our items here, I prefer to list things in alphabetical order so I can find them easily.
  • The top most entry must be an 'if' statement, every entry after must be an 'elseif'.
  • 'itemID' tells you what item you are working with.
  • Note that each one has a 'UsableInteract'
  • The names are different, because they represent a different function.
  • This function lets us know how much energy we get from consuming that item.

function ApplyUsableListeners(itemID) if itemID == "yourid_baked_fish" then self.RegisterListener(Messager.UsableInteract, TwentyFiveEnergyHandler) elseif itemID == "yourid_scrambled_eggs" then self.RegisterListener(Messager.UsableInteract, TenEnergyHandler) end end

So lets look at those functions. We currently have two.
  • The top one is called 'TenEnergyHandler',
  • It says that when an item calls this function, it adds 10 to the players current energy amount.
  • The second one is called 'TwentyFiveEnergyHandler'
  • Like the other, when it is called it adds 25 to the players current energy amount.

function TenEnergyHandler() local currentEnergy = Player.energy Player.energy = currentEnergy + 10 self.ConsumeUsable() end function TwentyFiveEnergyHandler() local currentEnergy = Player.energy Player.energy = currentEnergy + 25 self.ConsumeUsable() end
Making Icons
Each item must have an assigned icon, either from the games library or your mod folder, otherwise it will just show as a question mark.

For this exercise I've included two pngs for you to save and add to your folder. These go into the icons folder.


How do I make my own icons?
I got you! So I’ll give you a brief list of tools and tips.

Tools
  • Gimp is a free art program, and my recommendation for starters. Get it Here.[www.gimp.org]
  • The games icons can be found on either its wiki[gardenpaws.fandom.com] or the official datadump[www.gardenpawsgame.com]. Though you'll have to do a little digging at either location to find what you're looking for.

Tips
  • If you're unfamiliar with editing art, start by playing around with the tools.
  • Simple color changes can be done by shifting the hue chroma under the colors dropdown. (like the scrambled_eggs png above)
  • Try using the free select tool and hue chroma to change only certain sections of an image.
  • For more complex color matching try the sample colorize option under Colors => Mapping.
  • Use the free select tool to copy and snip bits of other icons together. (like the baked_fish png above)
Testing
The last steps are often the most important. Testing and Publication.

Testing
You can test your mod out by doing the following:
  • Select your mod and copy it.
  • Paste to ‘yourusername/appdata/LocalLow/BittenToast/GardenPaws/Mods’
  • Load up your game

Modding Console
The modding console lets you type in commands that might help you test your mod. You can learn more details about it here[www.gardenpawsgame.com].
  • Go to ‘yourusername/appdata/LocalLow/BittenToast/GardenPaws’
  • Right Click, Create new text document.
  • Name it ‘moddingconsole.txt

Modding Sandbox
The modding sandbox is a small creative world you can use to test mods in. You can learn more details about it here[www.gardenpawsgame.com].
  • Go to ‘yourusername/appdata/LocalLow/BittenToast/GardenPaws’
  • Right Click, Create new text document.
  • Name it ‘moddingmode.txt

!! Remember to remove this file when you want to play the game normally !!