mirror of
https://github.com/Sokomine/locks.git
synced 2025-07-01 06:20:21 +02:00
added support for pipeworks mod
This commit is contained in:
@ -1,10 +1,46 @@
|
||||
-- 09.01.13 Added support for pipeworks.
|
||||
|
||||
|
||||
locks.chest_add = {};
|
||||
locks.chest_add.tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
|
||||
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"};
|
||||
locks.chest_add.groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2};
|
||||
locks.chest_add.tube = {};
|
||||
|
||||
-- additional/changed definitions for pipeworks;
|
||||
-- taken from pipeworks/compat.lua
|
||||
if( locks.pipeworks_enabled ) then
|
||||
locks.chest_add.tiles = {
|
||||
"default_chest_top.png^pipeworks_tube_connection_wooden.png",
|
||||
"default_chest_top.png^pipeworks_tube_connection_wooden.png",
|
||||
"default_chest_side.png^pipeworks_tube_connection_wooden.png",
|
||||
"default_chest_side.png^pipeworks_tube_connection_wooden.png",
|
||||
"default_chest_side.png^pipeworks_tube_connection_wooden.png"};
|
||||
locks.chest_add.groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,
|
||||
tubedevice = 1, tubedevice_receiver = 1 };
|
||||
locks.chest_add.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,
|
||||
input_inventory = "main",
|
||||
connect_sides = {left=1, right=1, back=1, front=1, bottom=1, top=1}
|
||||
};
|
||||
end
|
||||
|
||||
|
||||
minetest.register_node("locks:shared_locked_chest", {
|
||||
description = "Shared locked chest",
|
||||
tiles = {"default_chest_top.png", "default_chest_top.png", "default_chest_side.png",
|
||||
"default_chest_side.png", "default_chest_side.png", "default_chest_front.png"},
|
||||
tiles = locks.chest_add.tiles,
|
||||
paramtype2 = "facedir",
|
||||
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
|
||||
groups = locks.chest_add.groups,
|
||||
tube = locks.chest_add.tube,
|
||||
legacy_facedir_simple = true,
|
||||
|
||||
on_construct = function(pos)
|
||||
@ -26,6 +62,11 @@ minetest.register_node("locks:shared_locked_chest", {
|
||||
end,
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
|
||||
if( locks.pipeworks_enabled ) then
|
||||
pipeworks.scan_for_tube_objects( pos );
|
||||
end
|
||||
|
||||
locks:lock_set_owner( pos, placer, "Shared locked chest" );
|
||||
end,
|
||||
|
||||
@ -78,6 +119,11 @@ minetest.register_node("locks:shared_locked_chest", {
|
||||
end,
|
||||
|
||||
|
||||
after_dig_node = function( pos )
|
||||
if( locks.pipeworks_enabled ) then
|
||||
pipeworks.scan_for_tube_objects(pos)
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
|
Reference in New Issue
Block a user