mirror of
https://github.com/tacigar/maidroid.git
synced 2024-11-10 12:10:28 +01:00
[ADD] Add swap_node
This commit is contained in:
parent
79eea46fde
commit
486b4139f3
|
@ -95,6 +95,14 @@ local dye_core_map = {
|
|||
)
|
||||
end
|
||||
|
||||
-- swap_node is a helper function that swap two nodes.
|
||||
local function swap_node(pos, name)
|
||||
local node = minetest.get_node(pos)
|
||||
node.name = name
|
||||
|
||||
minetest.swap_node(pos, node)
|
||||
end
|
||||
|
||||
-- on_timer is a common callback for the core writer.
|
||||
local function on_timer(pos, elapsed)
|
||||
local meta = minetest.get_meta(pos)
|
||||
|
@ -119,7 +127,7 @@ local dye_core_map = {
|
|||
meta:set_string("output_core", "")
|
||||
meta:set_string("formspec", formspec_inactive)
|
||||
inventory:set_stack("core", 1, ItemStack(output_core))
|
||||
minetest.swap_node(pos, {name = "maidroid_tool:core_writer"})
|
||||
swap_node(pos, "maidroid_tool:core_writer")
|
||||
|
||||
local core_entity = get_nearest_core_entity(pos)
|
||||
core_entity:stop_rotate()
|
||||
|
@ -140,7 +148,7 @@ local dye_core_map = {
|
|||
dye_stack:take_item()
|
||||
inventory:set_stack("dye", 1, dye_stack)
|
||||
|
||||
minetest.swap_node(pos, {name = "maidroid_tool:core_writer_active"})
|
||||
swap_node(pos, "maidroid_tool:core_writer_active")
|
||||
|
||||
local core_entity = get_nearest_core_entity(pos)
|
||||
core_entity:start_rotate()
|
||||
|
|
Loading…
Reference in New Issue
Block a user