After the Collapse – Adding a Crafted Recipe

After the Collapse – Adding a Crafted Recipe 1 - steamlists.com
After the Collapse – Adding a Crafted Recipe 1 - steamlists.com

This is a guide on how to make a mod to add crafted items.
 
 

Introduction

So, you’ve decided you want to add something to the game, but have no idea how? In this walkthrough, I’ll add tomato soup to the game.
 
 
Disclaimer: I may have mixed up a few things. If you know better, please let me know.
 
 
Before getting started, I highly recommend going to where After the Collapse has been installed and look at the “content” and “data” folders and subfolders. A lot of what will be done will mirror those two folders.
 
 
 

Getting Started

The easiest way to do this is by going into the game and selecting “Create from Template” then type what I want to call the mod and select “content” from the drop-down box.
 
 
After the Collapse - Adding a Crafted Recipe - Getting Started - 2ACC508
 
 
Once I hit the “Create” button, it gives me a message that it’s been created. The new files are in the “mods” folder where After The Collapse is installed SteamLibrary > steamapps > common > AfterTheCollapse.
 
 
 

Describe the Mod

Open up the “config.json” file (it can be opened with a simple text editor like Notepad). It’ll have the following:
 

 

 {
 "name": "My New Mod",
 "author": "Me!",
 "description": "A description of my new mod.",
 "version": 1.0
 }

 
Describe the mod. There’s also another line that I’ll need to add somewhere between the squiggly braces. (Note: The comma is important.)
 

"entryPoint": "main.lua",

 
 
So my tomato soup mod’s config.json file looks like this:
 

 

 {
 "name": "Tomato Soup",
 "author": "gata_bella",
 "version": 1.0,
 "entryPoint": "main.lua",
 "description": "A mod to add tomato soup to the game."
 } 

 
Don’t forget to hit save.
 
 
I need to add two subfolders to the “files” folder. Name one folder “Content” and make “data” the name of the other one. More about those in a bit.
 
After the Collapse - Adding a Crafted Recipe - Describe the Mod - 8DEBC87
 
 
 

The Content Folder

The content folder has files (pictures) that change the look of something in the game. There’s a structure in the original game that has to be followed. Since I’m making a food, that’s a material, so in the content folder, I add new folders to have the path Content > objects > materials.
 
After the Collapse - Adding a Crafted Recipe - The Content Folder - B334FF7
 
Note: If I were making a floor, then I’d need to create Content > tiles. To make a hat, I’d create Content > objects > headgear. Basically, find something similar in the original game and make the mod’s folder structure similar.
 
 
I’ll create the food_tomatosoup.png picture. The picture must be sized 64 x 64, and originally saved as a PNG file.
 
After the Collapse - Adding a Crafted Recipe - The Content Folder - 9761EDF
 
 
After snooping around with the original game files, all of the XNB pictures have a same name *.yaml file, so I create the following food_tomatosoup.yaml:
 
 

 xnbData: 
 target: "w"
 compressed: false
 hiDef: false
 readerData: 
 - 
 type: "Microsoft.Xna.Framework.Content.Texture2DReader"
 version: 0


 numSharedResources: 0

 content: #!Texture2D
 format: 0

 extractedImages: 
 - 
 path: ""

 
 
After creating those two files, I need to pack them into a food_tomatosoup.xnb file and put that file into the materials folder.
 
 
If you don’t happen to have a program that creates *.xnb files, I found a link to one while messing around in Stardew Valley’s modding section. The walkthrough “Open, Edit and Repack XNB file” by LUST recommends the “XNB mod toolkit” found through a file that he or she links. If you want more information, I recommend going over and reading LUST’s guide. (I am not that author, so if the walkthrough is missing or the links are broken, I cannot do anything about it. Sorry.)
 
 
 

The Data Folder

There are two subfolders that must be created in the data folder, with a third as an optional folder.
 
 
The two required ones are “items” and “recipes”. The “items” subfolder will also need its own subfolder called “consumable” (since I’m making a food mod, but this sub-subfolder will change depending on what’s being added to the game).
 
 
The third (optional) folder is the “encyclopedia” folder, and it determines whether the mod has an encyclopedia entry in the game.
 
After the Collapse - Adding a Crafted Recipe - The Data Folder - 209B5AC
 
 

The Consumable Folder

 
This folder should hold the item.json file (name matching the *.xnb file created earlier) that describes the item created in the mod.
 
 
I’m making tomato soup, so I have
 
 

{
 "Category": "Food",
 "ConsumptionTime": 7500,
 "AddTraits": [ "effect_wellfed" ],
 "ApplyAllTraits": false,
 "Effects": [
 {
 "Stat": "Eat",
 "Change": -500
 }
 ],
 "UseInZones": ["Eating"],
 "UseInZoneForced": true,
 "NoZoneMoodModifer": -10,
 "MoodModifierOnCorrectUse": 15,
 "AvailableOnStartMenu": false,
 "Name": "Tomato Soup",
 "Desc": "Crushed tomatoes cooked for a while",
 "Tags": [ "Food" ],
 "Weight": 0.5,
 "Value": 85,
 "Stackable": true,
 "InventoryTextureName": "objects/materials/food_tomatosoup"
}

 
This says that eating the soup should be eaten in a dining room (useinzones), will reduce a settler’s hunger by 500 (change), and that the settler will get the “well fed” buff once it’s been eaten (addtraits). Also, be sure to change the InventoryTextureName line to match the file name of the corresponding *.xnb file.
 
 

The Recipes Folder

 
This folder contains the *.json recipe for the item that’s being crafted (truth in advertising!).
 
 
Again, the file name must match what I’m creating, so I create a food_tomatosoup.json file containing
 
 

{
 "Name": "",
 "Skill": "Cooking",
 "SkillBonus": 1,
 "Input": [
 {
 "Category": "FoodIngredients",
 "Item": "ing_tomato",
 "Count": 3
 },
 {
 "Category": "FoodIngredients",
 "Item": "ing_thyme",
 "Count": 1
 }
 ],
 "Output": [
 {
 "Category": "Food",
 "Item": "food_tomatosoup",
 "Count": 1
 }
 ],
 "ProductionTime": 25000
}

 
 
I like a good tomato-and-basil soup. Since basil isn’t in the game (and I don’t feel like going through the process of adding basil), I’m using thyme as the seasoning instead. A settler will use the cooking skill to make the soup. Once made, it will raise his or her skill by 1 point.
 
 
Note that if you want to already in-game items for ingredients, you should go to the game’s data/items folder and find whatever the desired ingredient is.
 
 
By the way, non-food items have a different folder structure and set up. I suggest looking at in-game recipes for non-food items to see how those work.
 
 

The Encyclopedia Folder

 
This folder gives some more information about your mod. I’m not sure if it has to have the same name as everything else, but it’s probably a good idea for consistency.
 
 
Here’s what I have:
 
 

{
 "Title": "Tomato Soup Mod",
 "ShortDesc": "A mod to add tomato soup to the game",
 "IconPath": "objects/materials/food_tomatosoup",
 "LargeImagePath": "",
 "RelatedTech": [],
 "RelatedClutter": [],
 "RelatedItems": 
 [
 {
 "Category": "Food",
 "Item": "food_tomatosoup",
 "Count": 1
 }
 ],
 "Content": "I want a cheap way to make tomatoes edible.",
 "Tips": []
}

 
 
 

The main.lua File

There’s one last file that needs to be created: main.lua (again, it’s just a plain text file).
 
 
This one I’m the least certain about. Here’s what I have that adds the soup to both the basic kitchen and the electric one:
 
 

Mannequin:Import("ClutterData")
Mannequin:Import("Event")
Mannequin:Import("Recipe")

local function addRecipe(clutter, recipe)
 local factory = ClutterData(clutter).Factory
 local recipes = factory:GetRecipeList()
 recipes[#recipes+1] = Recipe(recipe)
 factory:SetRecipeList(recipes)
end

Event.Once("DBLoaded", function()
 addRecipe("craft_basickitchen", "food_tomatosoup")
 addRecipe("craft_electrickitchen", "food_tomatosoup")
end)

 
 
 

It Works!

In-game screenshots of the results:
 
 
1. Cooking the soup.
 
 
After the Collapse - Adding a Crafted Recipe - It Works! - 2C8EEC7
 
 
2. Settler eating the soup…that’s a pinker soup than I had intended, but oh well.
 
 
After the Collapse - Adding a Crafted Recipe - It Works! - D3F7EE6
 
 
3. Encyclopedia entry.
 
 
After the Collapse - Adding a Crafted Recipe - It Works! - 4EEBCA5
 
 
 

Conclusion

Mostly this was written for my future self, when I’ve forgotten how to add a mod, but I hope it helped you.
 
 
If you know anything that’s not quite right or needs a better explanation, please let me know.
 
 
I really want to thank the creators of After the Collapse for making a game that I find fun enough to play for hours at a time and easy enough to mod that even I could do it.
 
 

Written by gata_bella

 
 
This is all about After the Collapse – Adding a Crafted Recipe; I hope you enjoy reading the Guide! If you feel like we should add more information or we forget/mistake, please let us know via commenting below, and thanks! See you soon!
 
 


Be the first to comment

Leave a Reply

Your email address will not be published.


*