Skip to content

Commit

Permalink
Artisan Benches: Fuel Device: small improvements, fix `get_craft_resu…
Browse files Browse the repository at this point in the history
…lt()` `width`. Relates to #1787
  • Loading branch information
alek13 committed Nov 22, 2024
1 parent c5b12df commit ebebeea
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 5 additions & 1 deletion mods/lord/Core/fuel_device/src/fuel_device/Device.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ end
--- @public
--- @return NodeMetaRef
function Device:get_meta()
return self.meta or get_initiated_meta(self.position)
if not self.meta then
self.meta = get_initiated_meta(self.position)
end

return self.meta
end

--- Sets Node into active device with new hint.
Expand Down
8 changes: 4 additions & 4 deletions mods/lord/Core/fuel_device/src/fuel_device/Processor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ local S = minetest.get_mod_translator()
--- @param inv InvRef
--- @param meta NodeMetaRef
--- @param method string
--- @return boolean, RecipeOutput|nil, RecipeInput|nil, RecipeOutput|nil, RecipeInput|nil
--- @return boolean, RecipeOutput, RecipeInput, RecipeOutput, RecipeInput
local function process_possible(inv, meta, method)
local result_source, remaining_source = minetest.get_craft_result({
method = method,
type = 'cooking',
width = 1,
width = inv:get_size('src'),
items = inv:get_list('src'),
})
if not result_source or result_source.time == 0 then
Expand All @@ -24,8 +24,8 @@ local function process_possible(inv, meta, method)

local result_fuel, remaining_fuel = minetest.get_craft_result({
method = 'fuel',
width = 1,
items = inv:get_list('fuel')
width = inv:get_size('fuel'),
items = inv:get_list('fuel'),
})

local possible =
Expand Down
3 changes: 3 additions & 0 deletions mods/lord/Core/fuel_device/src/fuel_device/node.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ end
--- @param size_of {fuel:number,src:number,dst:number} sizes of corresponding inventories.
--- @param DeviceClass GenericDevice|nil your own device, if you want something extend/change.
--- @param ProcessorClass GenericProcessor|nil your own processor, if you want something extend/change.
--- @return GenericDevice, GenericProcessor
local function register_nodes(device_name, craft_method, nodes_definitions, form, size_of, DeviceClass, ProcessorClass)
local node_name = {
inactive = nodes_definitions.inactive.node_name:replace('^:', ''),
Expand Down Expand Up @@ -90,6 +91,8 @@ local function register_nodes(device_name, craft_method, nodes_definitions, form
nodes_definitions.active.node_name,
table.overwrite(active_node, nodes_definitions.active.definition)
)

return DeviceClass, ProcessorClass
end


Expand Down

0 comments on commit ebebeea

Please sign in to comment.