mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-11-10 01:13:57 +01:00
on_ -> after_ to be consistent with minetest api usage of these prefixes
This commit is contained in:
parent
6d1bc7b3fc
commit
78e081cf25
@ -52,7 +52,7 @@ end
|
|||||||
|
|
||||||
-- note, that this function assumes allready being updated to virtual items
|
-- note, that this function assumes allready being updated to virtual items
|
||||||
-- and doesn't handle recipes with stacksizes > 1
|
-- and doesn't handle recipes with stacksizes > 1
|
||||||
local function on_recipe_change(pos, inventory)
|
local function after_recipe_change(pos, inventory)
|
||||||
-- if we emptied the grid, there's no point in keeping it running or cached
|
-- if we emptied the grid, there's no point in keeping it running or cached
|
||||||
if inventory:is_empty("recipe") then
|
if inventory:is_empty("recipe") then
|
||||||
minetest.get_node_timer(pos):stop()
|
minetest.get_node_timer(pos):stop()
|
||||||
@ -81,7 +81,7 @@ local function on_recipe_change(pos, inventory)
|
|||||||
start_crafter(pos)
|
start_crafter(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function on_inventory_change(pos, inventory)
|
local function after_inventory_change(pos, inventory)
|
||||||
start_crafter(pos)
|
start_crafter(pos)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ local function update_autocrafter(pos)
|
|||||||
stack:set_wear(0)
|
stack:set_wear(0)
|
||||||
inv:set_stack("recipe", idx, stack)
|
inv:set_stack("recipe", idx, stack)
|
||||||
end
|
end
|
||||||
on_recipe_change(pos, inv)
|
after_recipe_change(pos, inv)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ minetest.register_node("pipeworks:autocrafter", {
|
|||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local added = inv:add_item("src", stack)
|
local added = inv:add_item("src", stack)
|
||||||
on_inventory_change(pos, inv)
|
after_inventory_change(pos, inv)
|
||||||
return added
|
return added
|
||||||
end,
|
end,
|
||||||
can_insert = function(pos, node, stack, direction)
|
can_insert = function(pos, node, stack, direction)
|
||||||
@ -217,10 +217,10 @@ minetest.register_node("pipeworks:autocrafter", {
|
|||||||
local stack_copy = ItemStack(stack)
|
local stack_copy = ItemStack(stack)
|
||||||
stack_copy:set_count(1)
|
stack_copy:set_count(1)
|
||||||
inv:set_stack(listname, index, stack_copy)
|
inv:set_stack(listname, index, stack_copy)
|
||||||
on_recipe_change(pos, inv)
|
after_recipe_change(pos, inv)
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
on_inventory_change(pos, inv)
|
after_inventory_change(pos, inv)
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -229,10 +229,10 @@ minetest.register_node("pipeworks:autocrafter", {
|
|||||||
local inv = minetest.get_meta(pos):get_inventory()
|
local inv = minetest.get_meta(pos):get_inventory()
|
||||||
if listname == "recipe" then
|
if listname == "recipe" then
|
||||||
inv:set_stack(listname, index, ItemStack(""))
|
inv:set_stack(listname, index, ItemStack(""))
|
||||||
on_recipe_change(pos, inv)
|
after_recipe_change(pos, inv)
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
on_inventory_change(pos, inv)
|
after_inventory_change(pos, inv)
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@ -243,16 +243,16 @@ minetest.register_node("pipeworks:autocrafter", {
|
|||||||
stack:set_count(count)
|
stack:set_count(count)
|
||||||
if from_list == "recipe" then
|
if from_list == "recipe" then
|
||||||
inv:set_stack(from_list, from_index, ItemStack(""))
|
inv:set_stack(from_list, from_index, ItemStack(""))
|
||||||
on_recipe_change(pos, inv)
|
after_recipe_change(pos, inv)
|
||||||
return 0
|
return 0
|
||||||
elseif to_list == "recipe" then
|
elseif to_list == "recipe" then
|
||||||
local stack_copy = ItemStack(stack)
|
local stack_copy = ItemStack(stack)
|
||||||
stack_copy:set_count(1)
|
stack_copy:set_count(1)
|
||||||
inv:set_stack(to_list, to_index, stack_copy)
|
inv:set_stack(to_list, to_index, stack_copy)
|
||||||
on_recipe_change(pos, inv)
|
after_recipe_change(pos, inv)
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
on_inventory_change(pos, inv)
|
after_inventory_change(pos, inv)
|
||||||
return stack:get_count()
|
return stack:get_count()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user