summaryrefslogtreecommitdiff
path: root/compat.lua
diff options
context:
space:
mode:
authorNovatux <nathanael.courant@laposte.net>2013-12-21 11:11:36 +0100
committerNovatux <nathanael.courant@laposte.net>2013-12-21 11:11:36 +0100
commit10cf11e008ad0da51349b175dee7cc23ea951db4 (patch)
tree344340ff9a54c4ce4dfc684af96fda9486751ab3 /compat.lua
parent5a2d57b48523b95aad2294f88da3e03cf35b9942 (diff)
downloadpipeworks-10cf11e008ad0da51349b175dee7cc23ea951db4.tar
pipeworks-10cf11e008ad0da51349b175dee7cc23ea951db4.tar.gz
pipeworks-10cf11e008ad0da51349b175dee7cc23ea951db4.tar.bz2
pipeworks-10cf11e008ad0da51349b175dee7cc23ea951db4.tar.xz
pipeworks-10cf11e008ad0da51349b175dee7cc23ea951db4.zip
A few more fixes (spamming the commit log again...)
Diffstat (limited to 'compat.lua')
-rw-r--r--compat.lua197
1 files changed, 101 insertions, 96 deletions
diff --git a/compat.lua b/compat.lua
index 3bf7d98..6918814 100644
--- a/compat.lua
+++ b/compat.lua
@@ -1,114 +1,117 @@
-- this bit of code modifies the default chests and furnaces to be compatible
-- with pipeworks.
-function pipeworks:clone_node(name)
- local node2={}
- local node=minetest.registered_nodes[name]
- for k,v in pairs(node) do
- node2[k]=v
+function pipeworks.clone_node(name)
+ local node2 = {}
+ local node = minetest.registered_nodes[name]
+ for k, v in pairs(node) do
+ node2[k] = v
end
return node2
end
-local furnace=pipeworks:clone_node("default:furnace")
+local furnace = pipeworks.clone_node("default:furnace")
furnace.tiles[2] = "default_furnace_bottom.png^pipeworks_tube_connection_stony.png"
furnace.tiles[3] = "default_furnace_side.png^pipeworks_tube_connection_stony.png"
furnace.tiles[4] = "default_furnace_side.png^pipeworks_tube_connection_stony.png"
furnace.tiles[5] = "default_furnace_side.png^pipeworks_tube_connection_stony.png"
- -- note we don't redefine entries 1 and 6 (top and front)
- furnace.groups.tubedevice=1
- furnace.groups.tubedevice_receiver=1
- furnace.tube={insert_object = function(pos,node,stack,direction)
- local meta=minetest.get_meta(pos)
- local inv=meta:get_inventory()
- if direction.y==1 then
+ -- note we don't redefine entries 1 and 6 (top and front)
+ furnace.groups.tubedevice = 1
+ furnace.groups.tubedevice_receiver = 1
+ furnace.tube = {
+ insert_object = function(pos, node, stack, direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ if direction.y == 1 then
return inv:add_item("fuel",stack)
else
return inv:add_item("src",stack)
end
end,
- can_insert=function(pos,node,stack,direction)
- local meta=minetest.get_meta(pos)
- local inv=meta:get_inventory()
- if direction.y==1 then
- return inv:room_for_item("fuel",stack)
- elseif direction.y==-1 then
- return inv:room_for_item("src",stack)
- else
- return 0
- end
- end,
- input_inventory="dst",
- connect_sides={left=1, right=1, back=1, bottom=1}}
- furnace.after_place_node= function(pos)
+ can_insert = function(pos,node,stack,direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ if direction.y == 1 then
+ return inv:room_for_item("fuel", stack)
+ else
+ return inv:room_for_item("src", stack)
+ end
+ end,
+ input_inventory = "dst",
+ connect_sides = {left=1, right=1, back=1, bottom=1, front=1, top=1}
+ }
+ furnace.after_place_node = function(pos)
pipeworks.scan_for_tube_objects(pos)
end
furnace.after_dig_node = function(pos)
pipeworks.scan_for_tube_objects(pos)
end
-minetest.register_node(":default:furnace",furnace)
+minetest.register_node(":default:furnace", furnace)
-local furnace=pipeworks:clone_node("default:furnace_active")
- furnace.tiles[2] = "default_furnace_bottom.png^pipeworks_tube_connection_stony.png"
- furnace.tiles[3] = "default_furnace_side.png^pipeworks_tube_connection_stony.png"
- furnace.tiles[4] = "default_furnace_side.png^pipeworks_tube_connection_stony.png"
- furnace.tiles[5] = "default_furnace_side.png^pipeworks_tube_connection_stony.png"
- -- note we don't redefine entries 1 and 6 (top and front)
- furnace.groups.tubedevice=1
- furnace.groups.tubedevice_receiver=1
- furnace.tube={insert_object=function(pos,node,stack,direction)
- local meta=minetest.get_meta(pos)
- local inv=meta:get_inventory()
- if direction.y==1 then
- return inv:add_item("fuel",stack)
- else
- return inv:add_item("src",stack)
- end
- end,
- can_insert=function(pos,node,stack,direction)
- local meta=minetest.get_meta(pos)
- local inv=meta:get_inventory()
- if direction.y==1 then
- return inv:room_for_item("fuel",stack)
- elseif direction.y==-1 then
- return inv:room_for_item("src",stack)
- else
- return 0
- end
- end,
- input_inventory="dst",
- connect_sides={left=1, right=1, back=1, bottom=1}}
- furnace.after_place_node= function(pos)
+local furnace_active = pipeworks.clone_node("default:furnace_active")
+ furnace_active.tiles[2] = "default_furnace_bottom.png^pipeworks_tube_connection_stony.png"
+ furnace_active.tiles[3] = "default_furnace_side.png^pipeworks_tube_connection_stony.png"
+ furnace_active.tiles[4] = "default_furnace_side.png^pipeworks_tube_connection_stony.png"
+ furnace_active.tiles[5] = "default_furnace_side.png^pipeworks_tube_connection_stony.png"
+ -- note we don't redefine entries 1 and 6 (top and front)
+ furnace_active.groups.tubedevice = 1
+ furnace_active.groups.tubedevice_receiver = 1
+ furnace_active.tube = {
+ insert_object = function(pos,node,stack,direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ if direction.y == 1 then
+ return inv:add_item("fuel", stack)
+ else
+ return inv:add_item("src", stack)
+ end
+ end,
+ can_insert = function(pos, node, stack, direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ if direction.y == 1 then
+ return inv:room_for_item("fuel", stack)
+ else
+ return inv:room_for_item("src", stack)
+ end
+ end,
+ input_inventory = "dst",
+ connect_sides = {left=1, right=1, back=1, bottom=1, front=1, top=1}
+ }
+ furnace_active.after_place_node= function(pos)
pipeworks.scan_for_tube_objects(pos)
end
- furnace.after_dig_node = function(pos)
+ furnace_active.after_dig_node = function(pos)
pipeworks.scan_for_tube_objects(pos)
end
- minetest.register_node(":default:furnace_active",furnace)
+minetest.register_node(":default:furnace_active", furnace_active)
-local chest=pipeworks:clone_node("default:chest")
+
+local chest = pipeworks.clone_node("default:chest")
chest.tiles[1] = "default_chest_top.png^pipeworks_tube_connection_wooden.png"
chest.tiles[2] = "default_chest_top.png^pipeworks_tube_connection_wooden.png"
chest.tiles[3] = "default_chest_side.png^pipeworks_tube_connection_wooden.png"
chest.tiles[4] = "default_chest_side.png^pipeworks_tube_connection_wooden.png"
chest.tiles[5] = "default_chest_side.png^pipeworks_tube_connection_wooden.png"
- -- note we don't redefine entry 6 (front).
- chest.groups.tubedevice=1
- chest.groups.tubedevice_receiver=1
- chest.tube={insert_object = function(pos,node,stack,direction)
- local meta=minetest.get_meta(pos)
- local inv=meta:get_inventory()
- return inv:add_item("main",stack)
- end,
- can_insert=function(pos,node,stack,direction)
- local meta=minetest.get_meta(pos)
- local inv=meta:get_inventory()
- return inv:room_for_item("main",stack)
- end,
- input_inventory="main",
- connect_sides={left=1, right=1, back=1, bottom=1, top=1}}
+ -- note we don't redefine entry 6 (front).
+ chest.groups.tubedevice = 1
+ chest.groups.tubedevice_receiver = 1
+ chest.tube = {
+ insert_object = function(pos, node, stack, direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ return inv:add_item("main", stack)
+ end,
+ can_insert = function(pos, node, stack, direction)
+ local meta = minetest.get_meta(pos)
+ local inv = meta:get_inventory()
+ return inv:room_for_item("main", stack)
+ end,
+ input_inventory = "main",
+ connect_sides = {left=1, right=1, back=1, bottom=1, top=1, front=1}
+ }
chest.after_place_node = function(pos)
pipeworks.scan_for_tube_objects(pos)
end
@@ -116,36 +119,38 @@ local chest=pipeworks:clone_node("default:chest")
pipeworks.scan_for_tube_objects(pos)
end
-minetest.register_node(":default:chest",chest)
+minetest.register_node(":default:chest", chest)
-local chest_locked=pipeworks:clone_node("default:chest_locked")
+local chest_locked = pipeworks.clone_node("default:chest_locked")
chest_locked.tiles[1] = "default_chest_top.png^pipeworks_tube_connection_wooden.png"
chest_locked.tiles[2] = "default_chest_top.png^pipeworks_tube_connection_wooden.png"
chest_locked.tiles[3] = "default_chest_side.png^pipeworks_tube_connection_wooden.png"
chest_locked.tiles[4] = "default_chest_side.png^pipeworks_tube_connection_wooden.png"
chest_locked.tiles[5] = "default_chest_side.png^pipeworks_tube_connection_wooden.png"
- -- note we don't redefine entry 6 (front).
- chest_locked.groups.tubedevice=1
- chest_locked.groups.tubedevice_receiver=1
- chest_locked.tube={insert_object = function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
- local inv=meta:get_inventory()
- return inv:add_item("main",stack)
- end,
- can_insert=function(pos,node,stack,direction)
- local meta=minetest.env:get_meta(pos)
- local inv=meta:get_inventory()
- return inv:room_for_item("main",stack)
- end,
- connect_sides={left=1, right=1, back=1, bottom=1, top=1}}
- local old_after_place = minetest.registered_nodes["default:chest_locked"].after_place_node;
+ -- note we don't redefine entry 6 (front).
+ chest_locked.groups.tubedevice = 1
+ chest_locked.groups.tubedevice_receiver = 1
+ chest_locked.tube = {
+ insert_object = function(pos, node, stack, direction)
+ local meta = minetest.env:get_meta(pos)
+ local inv = meta:get_inventory()
+ return inv:add_item("main", stack)
+ end,
+ can_insert = function(pos, node, stack, direction)
+ local meta = minetest.env:get_meta(pos)
+ local inv = meta:get_inventory()
+ return inv:room_for_item("main", stack)
+ end,
+ connect_sides = {left=1, right=1, back=1, bottom=1, top=1, front=1}
+ }
+ local old_after_place = minetest.registered_nodes["default:chest_locked"].after_place_node
chest_locked.after_place_node = function(pos, placer)
pipeworks.scan_for_tube_objects(pos)
- old_after_place(pos, placer)
+ old_after_place(pos, placer)
end
chest_locked.after_dig_node = function(pos)
pipeworks.scan_for_tube_objects(pos)
end
-minetest.register_node(":default:chest_locked",chest_locked)
+minetest.register_node(":default:chest_locked", chest_locked)