table fix

This commit is contained in:
2026-02-20 20:25:01 -05:00
parent ab93b2152d
commit 28c1c3602a
2 changed files with 92 additions and 82 deletions

View File

@@ -1,6 +1,8 @@
require 'recipecode'
function Recipe.OnCreate.FromConditionInheriter(craftRecipeData, player)
ConditionInheriter = ConditionInheriter or {}
function ConditionInheriter.FromConditionInheriter(craftRecipeData, player)
local items = craftRecipeData:getAllConsumedItems();
local results = craftRecipeData:getAllCreatedItems()
local box = items:get(0);
@@ -13,7 +15,7 @@ function Recipe.OnCreate.FromConditionInheriter(craftRecipeData, player)
end
end
function Recipe.OnCreate.ToConditionInheriter(craftRecipeData, player)
function ConditionInheriter.ToConditionInheriter(craftRecipeData, player)
local results = craftRecipeData:getAllCreatedItems()
local items = craftRecipeData:getAllConsumedItems();
@@ -24,4 +26,12 @@ function Recipe.OnCreate.ToConditionInheriter(craftRecipeData, player)
box:getModData()["condition" .. i] = item:getCondition();
end
end
end
end
if type(Recipe) == "table" then
if type(Recipe.OnCreate) ~= "table" then
Recipe.OnCreate = {}
end
Recipe.OnCreate.FromConditionInheriter = ConditionInheriter.FromConditionInheriter
Recipe.OnCreate.ToConditionInheriter = ConditionInheriter.ToConditionInheriter
end