Created
May 12, 2020 13:49
-
-
Save fusspawn/2d1137b120e44be1a55d52ab4516e186 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function INJECT_CRAFTING(self) | |
local orig_load = SurvivalGame.loadCraftingRecipes | |
SurvivalGame.loadCraftingRecipes = function(self) | |
orig_load() | |
local extra = { | |
{ -- Water + Ember => Milk | |
itemId = "2c4a2633-153a-4800-ba3d-2ac0d993b9c8", -- what gets made | |
quantity = 1, -- how many get made | |
craftTime = 12, | |
ingredientList = { | |
{ | |
itemId="869d4736-289a-4952-96cd-8a40117a2d28", | |
quantity=5 | |
},{ | |
itemId="267e0c93-62e3-45ad-9470-a14035cb9ca4", | |
quantity=1 | |
} | |
} | |
} | |
} | |
local recipies = g_craftingRecipes["craftbot"].recipes | |
local recipiesByIndex = g_craftingRecipes["craftbot"].recipesByIndex | |
for idx, recipe in pairs( extra ) do | |
recipe.craftTime = math.ceil( recipe.craftTime * 40 ) -- Seconds to ticks | |
for _,ingredient in ipairs( recipe.ingredientList ) do | |
ingredient.itemId = sm.uuid.new( ingredient.itemId ) -- Prepare uuid | |
end | |
recipies[recipe.itemId] = recipe | |
recipiesByIndex[#recipiesByIndex + 1] = recipe | |
end | |
-- NOTE: THIS IS HACKY AS SHIT. I NEED TO BUILD HE JSON BELOW AT THE PATH BELOW AT RUNTIME. CURRENTLY ITS JUST A COPY OF THE STANDARD CraftingRecipies/craftbot.json with the above extra entry added. | |
-- just save my copy of the recipies data to disk as json prior to calling this | |
g_craftingRecipes["craftbot"] = { path = "$SURVIVAL_DATA/Scripts/mods/waypoints/consumables/extended_crafting_recipies.json", recipes = recipies, recipesByIndex = recipiesByIndex } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment