Added the ability to specify the number of items in primitive crafting recipes and results
This commit is contained in:
@@ -18,7 +18,7 @@ local stageTypes = {
|
||||
---Immersive crafting aimed at a more logical process of crafting items.
|
||||
---@class CraftSystem.ImmersiveCraft : CraftSystem.BaseCraft
|
||||
---@field startStageName string
|
||||
---@field triggerItem string
|
||||
---@field triggerItem ItemStackString
|
||||
---@field output ItemStackString
|
||||
---@field stagesByName table<string, CraftSystem.ImmersiveCraftStage>
|
||||
local ImmersiveCraft = extend(BaseCraft, {})
|
||||
@@ -28,8 +28,8 @@ local ImmersiveCraft = extend(BaseCraft, {})
|
||||
---**Only for EmmyLua.**
|
||||
---@class CraftSystem.ImmersiveCraftDef : CraftSystem.BaseCraftDef
|
||||
---@field startStageName string
|
||||
---@field triggerItem string
|
||||
---@field output string
|
||||
---@field triggerItem ItemStackString
|
||||
---@field output ItemStackString
|
||||
---@field stages CraftSystem.ImmersiveCraftStageDef[]
|
||||
|
||||
---@param name string
|
||||
|
||||
@@ -7,7 +7,7 @@ local require = modInfo.require
|
||||
local BaseCraft = require('CraftSystem.BaseCraft')
|
||||
|
||||
---@class CraftSystem.PrimitiveCraft : CraftSystem.BaseCraft
|
||||
---@field output string
|
||||
---@field output ItemStackString
|
||||
---@field recipe CraftSystem.CraftRecipe
|
||||
---@field returnItems ItemStackString[]
|
||||
local PrimitiveCraft = extend(BaseCraft, {})
|
||||
@@ -16,7 +16,7 @@ local PrimitiveCraft = extend(BaseCraft, {})
|
||||
---
|
||||
---**Only for EmmyLua.**
|
||||
---@class CraftSystem.PrimitiveCraftDef : CraftSystem.BaseCraftDef
|
||||
---@field output string
|
||||
---@field output ItemStackString
|
||||
---@field recipe CraftSystem.CraftRecipe
|
||||
---@field returnItems ItemStackString[]?
|
||||
|
||||
|
||||
@@ -202,61 +202,13 @@ local function registerWood(name, x, def)
|
||||
recipe = {
|
||||
'wood:'..name..'_log'
|
||||
},
|
||||
output = 'wood:'..name..'_planks',
|
||||
output = 'wood:'..name..'_planks 4',
|
||||
group = 'test'
|
||||
})
|
||||
|
||||
PrimitiveCraftHandler:registerCraft('wood:'..name..'_log_stripped', {
|
||||
recipe = {
|
||||
'wood:'..name..'_log'
|
||||
},
|
||||
output = 'wood:'..name..'_log_stripped',
|
||||
group = 'test'
|
||||
})
|
||||
|
||||
PrimitiveCraftHandler:registerCraft('wood:'..name..'_log_stripped_1', {
|
||||
recipe = {
|
||||
'wood:'..name..'_log'
|
||||
},
|
||||
output = 'wood:'..name..'_log_stripped',
|
||||
group = 'test'
|
||||
})
|
||||
|
||||
PrimitiveCraftHandler:registerCraft('wood:'..name..'_log_stripped_2', {
|
||||
recipe = {
|
||||
'wood:'..name..'_log'
|
||||
},
|
||||
output = 'wood:'..name..'_log_stripped',
|
||||
group = 'test'
|
||||
})
|
||||
|
||||
PrimitiveCraftHandler:registerCraft('wood:'..name..'_log_stripped_3', {
|
||||
recipe = {
|
||||
'wood:'..name..'_log'
|
||||
},
|
||||
output = 'wood:'..name..'_log_stripped',
|
||||
group = 'test'
|
||||
})
|
||||
|
||||
PrimitiveCraftHandler:registerCraft('wood:'..name..'_log_stripped_11', {
|
||||
recipe = {
|
||||
'wood:'..name..'_log'
|
||||
},
|
||||
output = 'wood:'..name..'_log_stripped',
|
||||
group = 'test'
|
||||
})
|
||||
|
||||
PrimitiveCraftHandler:registerCraft('wood:'..name..'_log_stripped_22', {
|
||||
recipe = {
|
||||
'wood:'..name..'_log'
|
||||
},
|
||||
output = 'wood:'..name..'_log_stripped',
|
||||
group = 'test'
|
||||
})
|
||||
|
||||
PrimitiveCraftHandler:registerCraft('wood:'..name..'_log_stripped_33', {
|
||||
recipe = {
|
||||
'wood:'..name..'_log'
|
||||
'wood:'..name..'_log 2'
|
||||
},
|
||||
output = 'wood:'..name..'_log_stripped',
|
||||
group = 'test'
|
||||
|
||||
@@ -79,14 +79,17 @@ local function getCraftPane(self, playerName, paneType)
|
||||
|
||||
if selectedCraft ~= nil then
|
||||
local craft = PrimitiveCraftHandler:getCraftByName(selectedCraft)
|
||||
local itemName = craft.output
|
||||
local item = ItemStack(craft.output)
|
||||
local itemDef = item:get_definition()
|
||||
|
||||
local recipe = ''
|
||||
for _, itemName in ipairs(craft.recipe) do
|
||||
recipe = recipe..'- '..core.registered_items[itemName]._title..'\n'
|
||||
local recipeItem = ItemStack(itemName)
|
||||
recipe = recipe..'- '..core.strip_colors(recipeItem:get_definition()._title)..' x'..recipeItem:get_count()..'\n'
|
||||
end
|
||||
local itemDef = core.registered_items[itemName]
|
||||
|
||||
CraftPane:
|
||||
itemImage(5.5, 0.5, 2, 2, itemName):
|
||||
itemImage(5.5, 0.5, 2, 2, craft.output):
|
||||
areaLabel(5.5, 3, 4, 4,
|
||||
itemDef._title..'\n'..
|
||||
itemDef._description..'\n\n'..
|
||||
|
||||
Reference in New Issue
Block a user