mirror of
https://github.com/mt-mods/homedecor_modpack.git
synced 2024-12-22 16:10:18 +01:00
whitespace cleanup:
* remove all trailing whitespaces * make inbox and computer use the prevalent indentation rules * CRLF->LF where found
This commit is contained in:
parent
29bf986ea8
commit
be4ed12b6c
@ -1,122 +1,122 @@
|
||||
|
||||
-- Amiga 500 lookalike
|
||||
computer.register("computer:shefriendSOO", {
|
||||
description = "SheFriendSOO";
|
||||
tiles_off = { front=true; };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 0, 0, 17, 32, 32, 12 }, -- Monitor Screen
|
||||
{ 3, 3, 29, 26, 26, 3 }, -- Monitor Tube
|
||||
{ 0, 0, 0, 32, 4, 17 }, -- Keyboard
|
||||
});
|
||||
description = "SheFriendSOO";
|
||||
tiles_off = { front=true; };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 0, 0, 17, 32, 32, 12 }, -- Monitor Screen
|
||||
{ 3, 3, 29, 26, 26, 3 }, -- Monitor Tube
|
||||
{ 0, 0, 0, 32, 4, 17 }, -- Keyboard
|
||||
});
|
||||
});
|
||||
|
||||
-- Some generic laptop
|
||||
computer.register("computer:vanio", {
|
||||
description = "Pony Vanio";
|
||||
tiles_off = { front=true; top=true; left=true; right=true; back=true; };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 0, 0, 4, 32, 3, 24 }, -- Keyboard
|
||||
{ 0, 3, 25, 32, 21, 3 }, -- Screen
|
||||
});
|
||||
node_box_off = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 0, 0, 4, 32, 3, 24 }, -- Keyboard
|
||||
{ 0, 3, 4, 32, 3, 24 }, -- Screen
|
||||
});
|
||||
description = "Pony Vanio";
|
||||
tiles_off = { front=true; top=true; left=true; right=true; back=true; };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 0, 0, 4, 32, 3, 24 }, -- Keyboard
|
||||
{ 0, 3, 25, 32, 21, 3 }, -- Screen
|
||||
});
|
||||
node_box_off = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 0, 0, 4, 32, 3, 24 }, -- Keyboard
|
||||
{ 0, 3, 4, 32, 3, 24 }, -- Screen
|
||||
});
|
||||
});
|
||||
|
||||
-- Sony PlayStation lookalike
|
||||
computer.register("computer:slaystation", {
|
||||
description = "Pony SlayStation";
|
||||
tiles_off = { top=true; };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 0, 0, 11, 32, 6, 21 }, -- Console
|
||||
{ 1, 0, 1, 4, 2, 9 }, -- Controller 1 L Grip
|
||||
{ 10, 0, 1, 4, 2, 9 }, -- Controller 1 R Grip
|
||||
{ 5, 0, 4, 5, 2, 5 }, -- Controller 1 Center
|
||||
{ 18, 0, 1, 4, 2, 9 }, -- Controller 2 L Grip
|
||||
{ 27, 0, 1, 4, 2, 9 }, -- Controller 2 R Grip
|
||||
{ 22, 0, 4, 5, 2, 5 }, -- Controller 2 Center
|
||||
});
|
||||
description = "Pony SlayStation";
|
||||
tiles_off = { top=true; };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 0, 0, 11, 32, 6, 21 }, -- Console
|
||||
{ 1, 0, 1, 4, 2, 9 }, -- Controller 1 L Grip
|
||||
{ 10, 0, 1, 4, 2, 9 }, -- Controller 1 R Grip
|
||||
{ 5, 0, 4, 5, 2, 5 }, -- Controller 1 Center
|
||||
{ 18, 0, 1, 4, 2, 9 }, -- Controller 2 L Grip
|
||||
{ 27, 0, 1, 4, 2, 9 }, -- Controller 2 R Grip
|
||||
{ 22, 0, 4, 5, 2, 5 }, -- Controller 2 Center
|
||||
});
|
||||
});
|
||||
|
||||
-- Sony PlayStation 2 lookalike
|
||||
computer.register("computer:slaystation2", {
|
||||
description = "Pony SlayStation 2";
|
||||
tiles_off = { front=true; };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 2, 2, 11, 28, 3, 19 }, -- Console (Upper part)
|
||||
{ 2, 0, 11, 26, 2, 19 }, -- Console (Lower part)
|
||||
{ 1, 0, 1, 4, 2, 9 }, -- Controller 1 L Grip
|
||||
{ 10, 0, 1, 4, 2, 9 }, -- Controller 1 R Grip
|
||||
{ 5, 0, 1, 5, 2, 8 }, -- Controller 1 Center
|
||||
{ 18, 0, 1, 4, 2, 9 }, -- Controller 2 L Grip
|
||||
{ 27, 0, 1, 4, 2, 9 }, -- Controller 2 R Grip
|
||||
{ 22, 0, 1, 5, 2, 8 }, -- Controller 2 Center
|
||||
});
|
||||
description = "Pony SlayStation 2";
|
||||
tiles_off = { front=true; };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 2, 2, 11, 28, 3, 19 }, -- Console (Upper part)
|
||||
{ 2, 0, 11, 26, 2, 19 }, -- Console (Lower part)
|
||||
{ 1, 0, 1, 4, 2, 9 }, -- Controller 1 L Grip
|
||||
{ 10, 0, 1, 4, 2, 9 }, -- Controller 1 R Grip
|
||||
{ 5, 0, 1, 5, 2, 8 }, -- Controller 1 Center
|
||||
{ 18, 0, 1, 4, 2, 9 }, -- Controller 2 L Grip
|
||||
{ 27, 0, 1, 4, 2, 9 }, -- Controller 2 R Grip
|
||||
{ 22, 0, 1, 5, 2, 8 }, -- Controller 2 Center
|
||||
});
|
||||
});
|
||||
|
||||
-- Sinclair ZX Spectrum lookalike
|
||||
computer.register("computer:specter", {
|
||||
description = "SX Specter";
|
||||
tiles_off = { };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 3, 0, 0, 26, 4, 17 }, -- Keyboard
|
||||
{ 18, 0, 18, 12, 6, 14 }, -- Tape Player
|
||||
});
|
||||
description = "SX Specter";
|
||||
tiles_off = { };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 3, 0, 0, 26, 4, 17 }, -- Keyboard
|
||||
{ 18, 0, 18, 12, 6, 14 }, -- Tape Player
|
||||
});
|
||||
});
|
||||
|
||||
-- Nintendo Wii lookalike
|
||||
computer.register("computer:wee", {
|
||||
description = "Nientiendo Wee";
|
||||
tiles_off = { front=true; };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 11, 0, 3, 10, 6, 26 }, -- Base
|
||||
{ 12, 6, 4, 8, 22, 24 }, -- Top
|
||||
});
|
||||
description = "Nientiendo Wee";
|
||||
tiles_off = { front=true; };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 11, 0, 3, 10, 6, 26 }, -- Base
|
||||
{ 12, 6, 4, 8, 22, 24 }, -- Top
|
||||
});
|
||||
});
|
||||
|
||||
-- Apple iPad lookalike
|
||||
minetest.register_node("computer:piepad", {
|
||||
description = "Snapple Piepad",
|
||||
drawtype = "signlike",
|
||||
tiles = {"computer_piepad_inv.png"},
|
||||
inventory_image = "computer_piepad_inv.png",
|
||||
wield_image = "computer_piepad_inv.png",
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
light_source = 10,
|
||||
walkable = false,
|
||||
groups = { snappy=3, cracky=3, choppy=3, oddly_breakable_by_hand=3},
|
||||
selection_box = {type = "wallmounted"},
|
||||
sounds = default.node_sound_wood_defaults()
|
||||
description = "Snapple Piepad",
|
||||
drawtype = "signlike",
|
||||
tiles = {"computer_piepad_inv.png"},
|
||||
inventory_image = "computer_piepad_inv.png",
|
||||
wield_image = "computer_piepad_inv.png",
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "wallmounted",
|
||||
light_source = 10,
|
||||
walkable = false,
|
||||
groups = { snappy=3, cracky=3, choppy=3, oddly_breakable_by_hand=3},
|
||||
selection_box = {type = "wallmounted"},
|
||||
sounds = default.node_sound_wood_defaults()
|
||||
})
|
||||
|
||||
-- Commodore 64 lookalike
|
||||
computer.register("computer:admiral64", {
|
||||
description = "Admiral64";
|
||||
tiles_off = { };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 0, 0, 0, 32, 4, 18 }, -- Keyboard
|
||||
});
|
||||
description = "Admiral64";
|
||||
tiles_off = { };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 0, 0, 0, 32, 4, 18 }, -- Keyboard
|
||||
});
|
||||
});
|
||||
|
||||
-- Commodore 128 lookalike
|
||||
computer.register("computer:admiral128", {
|
||||
description = "Admiral128";
|
||||
tiles_off = { };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 0, 0, 0, 32, 4, 27 }, -- Keyboard
|
||||
});
|
||||
description = "Admiral128";
|
||||
tiles_off = { };
|
||||
node_box = computer.pixelnodebox(32, {
|
||||
-- X Y Z W H L
|
||||
{ 0, 0, 0, 32, 4, 27 }, -- Keyboard
|
||||
});
|
||||
});
|
||||
|
||||
---------------------------------------------------------------------------------
|
||||
@ -127,8 +127,8 @@ computer.register("computer:admiral128", {
|
||||
minetest.register_node("computer:monitor_on", {
|
||||
description = "Monitor and keyboard",
|
||||
tiles = {"computer_monitor_t.png","computer_monitor_bt.png",
|
||||
"computer_monitor_l.png","computer_monitor_r.png",
|
||||
"computer_monitor_b.png","computer_monitor_f_desktop.png"}, --"computer_monitor_f_on.png"}, --till i get a boot abm inplace
|
||||
"computer_monitor_l.png","computer_monitor_r.png",
|
||||
"computer_monitor_b.png","computer_monitor_f_desktop.png"}, --"computer_monitor_f_on.png"}, --till i get a boot abm inplace
|
||||
paramtype = "light",
|
||||
light_source = 4,
|
||||
paramtype2 = "facedir",
|
||||
@ -150,16 +150,16 @@ minetest.register_node("computer:monitor_on", {
|
||||
},
|
||||
drop = 'computer:monitor',
|
||||
on_rightclick = function ( pos, node, clicker, itemstack)
|
||||
node.name = "computer:monitor";
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos)
|
||||
node.name = "computer:monitor";
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("computer:monitor_bios", {
|
||||
description = "Monitor and keyboard",
|
||||
tiles = {"computer_monitor_t.png","computer_monitor_bt.png","computer_monitor_l.png",
|
||||
"computer_monitor_r.png","computer_monitor_b.png","computer_monitor_f_bios.png"},
|
||||
"computer_monitor_r.png","computer_monitor_b.png","computer_monitor_f_bios.png"},
|
||||
paramtype = "light",
|
||||
light_source = 4,
|
||||
paramtype2 = "facedir",
|
||||
@ -263,7 +263,7 @@ minetest.register_node("computer:monitor_desktop", {
|
||||
minetest.register_node("computer:monitor", {
|
||||
description = "Monitor and keyboard",
|
||||
tiles = {"computer_monitor_t_off.png","computer_monitor_bt.png","computer_monitor_l.png",
|
||||
"computer_monitor_r.png","computer_monitor_b.png","computer_monitor_f_off.png"},
|
||||
"computer_monitor_r.png","computer_monitor_b.png","computer_monitor_f_off.png"},
|
||||
paramtype = "light",
|
||||
light_source = 4,
|
||||
paramtype2 = "facedir",
|
||||
@ -284,9 +284,9 @@ minetest.register_node("computer:monitor", {
|
||||
},
|
||||
},
|
||||
on_rightclick = function ( pos, node, clicker, itemstack)
|
||||
node.name = "computer:monitor_on";
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos)
|
||||
node.name = "computer:monitor_on";
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos)
|
||||
end
|
||||
})
|
||||
|
||||
@ -341,9 +341,9 @@ minetest.register_node("computer:tower_on", {
|
||||
},
|
||||
drop = 'computer:tower',
|
||||
on_rightclick = function ( pos, node, clicker, itemstack)
|
||||
node.name = "computer:tower";
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos)
|
||||
node.name = "computer:tower";
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos)
|
||||
end
|
||||
})
|
||||
|
||||
@ -373,9 +373,9 @@ minetest.register_node("computer:tower", {
|
||||
},
|
||||
},
|
||||
on_rightclick = function ( pos, node, clicker, itemstack)
|
||||
node.name = "computer:tower_on";
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos)
|
||||
node.name = "computer:tower_on";
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos)
|
||||
end
|
||||
})
|
||||
|
||||
@ -408,76 +408,76 @@ minetest.register_node("computer:printer", {
|
||||
|
||||
--Rack Server
|
||||
minetest.register_node("computer:server", {
|
||||
drawtype = "nodebox",
|
||||
description = "Rack Server",
|
||||
tiles = {
|
||||
'computer_server_t.png',
|
||||
'computer_server_bt.png',
|
||||
'computer_server_l.png',
|
||||
'computer_server_r.png',
|
||||
'computer_server_bt.png',
|
||||
'computer_server_f_off.png'
|
||||
},
|
||||
inventory_image = "computer_server_inv.png",
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
groups = {snappy=3},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.25, 0.5, 1.125, 0.4375},
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.25, 0.5, 1.125, 0.4375},
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_rightclick = function ( pos, node, clicker, itemstack)
|
||||
node.name = "computer:server_on";
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos)
|
||||
drawtype = "nodebox",
|
||||
description = "Rack Server",
|
||||
tiles = {
|
||||
'computer_server_t.png',
|
||||
'computer_server_bt.png',
|
||||
'computer_server_l.png',
|
||||
'computer_server_r.png',
|
||||
'computer_server_bt.png',
|
||||
'computer_server_f_off.png'
|
||||
},
|
||||
inventory_image = "computer_server_inv.png",
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
groups = {snappy=3},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.25, 0.5, 1.125, 0.4375},
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.25, 0.5, 1.125, 0.4375},
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_rightclick = function ( pos, node, clicker, itemstack)
|
||||
node.name = "computer:server_on";
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos)
|
||||
end,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pos = pointed_thing.above
|
||||
if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then
|
||||
minetest.chat_send_player( placer:get_player_name(), "Not enough vertical space to place a server!" )
|
||||
return
|
||||
end
|
||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
||||
end
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local pos = pointed_thing.above
|
||||
if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" then
|
||||
minetest.chat_send_player( placer:get_player_name(), "Not enough vertical space to place a server!" )
|
||||
return
|
||||
end
|
||||
return minetest.item_place(itemstack, placer, pointed_thing)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_node("computer:server_on", {
|
||||
drawtype = "nodebox",
|
||||
description = "Rack Server",
|
||||
tiles = {
|
||||
'computer_server_t.png',
|
||||
'computer_server_bt.png',
|
||||
'computer_server_r.png',
|
||||
'computer_server_l.png',
|
||||
'computer_server_bt.png',
|
||||
'computer_server_f_on.png',
|
||||
},
|
||||
inventory_image = "computer_server_inv.png",
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
groups = {snappy=3,not_in_creative_inventory=1},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.25, 0.5, 1.125, 0.4375},
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.25, 0.5, 1.125, 0.4375},
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drawtype = "nodebox",
|
||||
description = "Rack Server",
|
||||
tiles = {
|
||||
'computer_server_t.png',
|
||||
'computer_server_bt.png',
|
||||
'computer_server_r.png',
|
||||
'computer_server_l.png',
|
||||
'computer_server_bt.png',
|
||||
'computer_server_f_on.png',
|
||||
},
|
||||
inventory_image = "computer_server_inv.png",
|
||||
sunlight_propagates = false,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
walkable = true,
|
||||
groups = {snappy=3,not_in_creative_inventory=1},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.25, 0.5, 1.125, 0.4375},
|
||||
},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.25, 0.5, 1.125, 0.4375},
|
||||
},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
drop = 'computer:server',
|
||||
on_rightclick = function ( pos, node, clicker, itemstack)
|
||||
node.name = "computer:server";
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos)
|
||||
node.name = "computer:server";
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos)
|
||||
end
|
||||
})
|
||||
|
@ -2,99 +2,99 @@
|
||||
computer = { };
|
||||
|
||||
computer.register = function ( name, def )
|
||||
local nodename = name;
|
||||
if (name:sub(1, 1) == ":") then name = name:sub(2); end
|
||||
local modname, basename = name:match("^([^:]+):(.*)");
|
||||
local TEXPFX = modname.."_"..basename.."_";
|
||||
local ONSTATE = modname..":"..basename;
|
||||
local OFFSTATE = modname..":"..basename.."_off";
|
||||
local def = def;
|
||||
minetest.register_node(ONSTATE, {
|
||||
drawtype = "nodebox";
|
||||
paramtype = "light";
|
||||
paramtype2 = "facedir";
|
||||
description = def.description;
|
||||
groups = { snappy=2, choppy=2, oddly_breakable_by_hand=2 };
|
||||
tiles = {
|
||||
TEXPFX.."tp.png",
|
||||
TEXPFX.."bt.png",
|
||||
TEXPFX.."rt.png",
|
||||
TEXPFX.."lt.png",
|
||||
TEXPFX.."bk.png",
|
||||
TEXPFX.."ft.png",
|
||||
};
|
||||
node_box = def.node_box;
|
||||
selection_box = def.node_box;
|
||||
on_rightclick = function ( pos, node, clicker, itemstack)
|
||||
if (def.on_turn_off) then
|
||||
if (def.on_turn_off(pos, node, clicker, itemstack)) then return; end
|
||||
end
|
||||
node.name = OFFSTATE;
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos);
|
||||
end;
|
||||
});
|
||||
minetest.register_node(OFFSTATE, {
|
||||
drawtype = "nodebox";
|
||||
paramtype = "light";
|
||||
paramtype2 = "facedir";
|
||||
groups = { snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
not_in_creative_inventory=1 };
|
||||
tiles = {
|
||||
(TEXPFX.."tp"..(def.tiles_off.top and "_off" or "")..".png"),
|
||||
(TEXPFX.."bt"..(def.tiles_off.bottom and "_off" or "")..".png"),
|
||||
(TEXPFX.."rt"..(def.tiles_off.right and "_off" or "")..".png"),
|
||||
(TEXPFX.."lt"..(def.tiles_off.left and "_off" or "")..".png"),
|
||||
(TEXPFX.."bk"..(def.tiles_off.back and "_off" or "")..".png"),
|
||||
(TEXPFX.."ft"..(def.tiles_off.front and "_off" or "")..".png"),
|
||||
};
|
||||
node_box = def.node_box_off or def.node_box;
|
||||
selection_box = def.node_box_off or def.node_box;
|
||||
on_rightclick = function ( pos, node, clicker, itemstack)
|
||||
if (def.on_turn_on) then
|
||||
if (def.on_turn_on(pos, node, clicker, itemstack)) then return; end
|
||||
end
|
||||
node.name = ONSTATE;
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos);
|
||||
end;
|
||||
drop = ONSTATE;
|
||||
});
|
||||
local nodename = name;
|
||||
if (name:sub(1, 1) == ":") then name = name:sub(2); end
|
||||
local modname, basename = name:match("^([^:]+):(.*)");
|
||||
local TEXPFX = modname.."_"..basename.."_";
|
||||
local ONSTATE = modname..":"..basename;
|
||||
local OFFSTATE = modname..":"..basename.."_off";
|
||||
local def = def;
|
||||
minetest.register_node(ONSTATE, {
|
||||
drawtype = "nodebox";
|
||||
paramtype = "light";
|
||||
paramtype2 = "facedir";
|
||||
description = def.description;
|
||||
groups = { snappy=2, choppy=2, oddly_breakable_by_hand=2 };
|
||||
tiles = {
|
||||
TEXPFX.."tp.png",
|
||||
TEXPFX.."bt.png",
|
||||
TEXPFX.."rt.png",
|
||||
TEXPFX.."lt.png",
|
||||
TEXPFX.."bk.png",
|
||||
TEXPFX.."ft.png",
|
||||
};
|
||||
node_box = def.node_box;
|
||||
selection_box = def.node_box;
|
||||
on_rightclick = function ( pos, node, clicker, itemstack)
|
||||
if (def.on_turn_off) then
|
||||
if (def.on_turn_off(pos, node, clicker, itemstack)) then return; end
|
||||
end
|
||||
node.name = OFFSTATE;
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos);
|
||||
end;
|
||||
});
|
||||
minetest.register_node(OFFSTATE, {
|
||||
drawtype = "nodebox";
|
||||
paramtype = "light";
|
||||
paramtype2 = "facedir";
|
||||
groups = { snappy=2, choppy=2, oddly_breakable_by_hand=2,
|
||||
not_in_creative_inventory=1 };
|
||||
tiles = {
|
||||
(TEXPFX.."tp"..(def.tiles_off.top and "_off" or "")..".png"),
|
||||
(TEXPFX.."bt"..(def.tiles_off.bottom and "_off" or "")..".png"),
|
||||
(TEXPFX.."rt"..(def.tiles_off.right and "_off" or "")..".png"),
|
||||
(TEXPFX.."lt"..(def.tiles_off.left and "_off" or "")..".png"),
|
||||
(TEXPFX.."bk"..(def.tiles_off.back and "_off" or "")..".png"),
|
||||
(TEXPFX.."ft"..(def.tiles_off.front and "_off" or "")..".png"),
|
||||
};
|
||||
node_box = def.node_box_off or def.node_box;
|
||||
selection_box = def.node_box_off or def.node_box;
|
||||
on_rightclick = function ( pos, node, clicker, itemstack)
|
||||
if (def.on_turn_on) then
|
||||
if (def.on_turn_on(pos, node, clicker, itemstack)) then return; end
|
||||
end
|
||||
node.name = ONSTATE;
|
||||
minetest.set_node(pos, node);
|
||||
nodeupdate(pos);
|
||||
end;
|
||||
drop = ONSTATE;
|
||||
});
|
||||
end
|
||||
|
||||
computer.register_handheld = function ( name, def )
|
||||
local nodename = name;
|
||||
if (name:sub(1, 1) == ":") then name = name:sub(2); end
|
||||
local modname, basename = name:match("^([^:]+):(.*)");
|
||||
local TEXPFX = modname.."_"..basename.."_inv";
|
||||
local ONSTATE = modname..":"..basename;
|
||||
local OFFSTATE = modname..":"..basename.."_off";
|
||||
local on_use = def.on_use;
|
||||
minetest.register_craftitem(ONSTATE, {
|
||||
description = def.description;
|
||||
inventory_image = TEXPFX..".png";
|
||||
wield_image = TEXPFX..".png";
|
||||
});
|
||||
local nodename = name;
|
||||
if (name:sub(1, 1) == ":") then name = name:sub(2); end
|
||||
local modname, basename = name:match("^([^:]+):(.*)");
|
||||
local TEXPFX = modname.."_"..basename.."_inv";
|
||||
local ONSTATE = modname..":"..basename;
|
||||
local OFFSTATE = modname..":"..basename.."_off";
|
||||
local on_use = def.on_use;
|
||||
minetest.register_craftitem(ONSTATE, {
|
||||
description = def.description;
|
||||
inventory_image = TEXPFX..".png";
|
||||
wield_image = TEXPFX..".png";
|
||||
});
|
||||
end
|
||||
|
||||
computer.pixelnodebox = function ( size, boxes )
|
||||
local fixed = { };
|
||||
local i, box;
|
||||
for i, box in ipairs(boxes) do
|
||||
local x, y, z, w, h, l = unpack(box);
|
||||
fixed[#fixed + 1] = {
|
||||
(x / size) - 0.5,
|
||||
(y / size) - 0.5,
|
||||
(z / size) - 0.5,
|
||||
((x + w) / size) - 0.5,
|
||||
((y + h) / size) - 0.5,
|
||||
((z + l) / size) - 0.5,
|
||||
};
|
||||
end
|
||||
return {
|
||||
type = "fixed";
|
||||
fixed = fixed;
|
||||
};
|
||||
local fixed = { };
|
||||
local i, box;
|
||||
for i, box in ipairs(boxes) do
|
||||
local x, y, z, w, h, l = unpack(box);
|
||||
fixed[#fixed + 1] = {
|
||||
(x / size) - 0.5,
|
||||
(y / size) - 0.5,
|
||||
(z / size) - 0.5,
|
||||
((x + w) / size) - 0.5,
|
||||
((y + h) / size) - 0.5,
|
||||
((z + l) / size) - 0.5,
|
||||
};
|
||||
end
|
||||
return {
|
||||
type = "fixed";
|
||||
fixed = fixed;
|
||||
};
|
||||
end
|
||||
|
||||
local MODPATH = minetest.get_modpath("computer");
|
||||
|
@ -14,63 +14,63 @@ end
|
||||
|
||||
if (not minetest.get_modpath("homedecor")) then
|
||||
|
||||
minetest.register_craftitem(":homedecor:plastic_sheeting", {
|
||||
description = S("Plastic sheet"),
|
||||
inventory_image = "homedecor_plastic_sheeting.png",
|
||||
})
|
||||
minetest.register_craftitem(":homedecor:plastic_sheeting", {
|
||||
description = S("Plastic sheet"),
|
||||
inventory_image = "homedecor_plastic_sheeting.png",
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":homedecor:plastic_base", {
|
||||
description = S("Unprocessed Plastic base"),
|
||||
wield_image = "homedecor_plastic_base.png",
|
||||
inventory_image = "homedecor_plastic_base_inv.png",
|
||||
})
|
||||
minetest.register_craftitem(":homedecor:plastic_base", {
|
||||
description = S("Unprocessed Plastic base"),
|
||||
wield_image = "homedecor_plastic_base.png",
|
||||
inventory_image = "homedecor_plastic_base_inv.png",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'homedecor:plastic_base 6',
|
||||
recipe = { "default:junglegrass",
|
||||
"default:junglegrass",
|
||||
"default:junglegrass"
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'homedecor:plastic_base 6',
|
||||
recipe = { "default:junglegrass",
|
||||
"default:junglegrass",
|
||||
"default:junglegrass"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'homedecor:plastic_base 3',
|
||||
recipe = { "default:dry_shrub",
|
||||
"default:dry_shrub",
|
||||
"default:dry_shrub"
|
||||
},
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'homedecor:plastic_base 3',
|
||||
recipe = { "default:dry_shrub",
|
||||
"default:dry_shrub",
|
||||
"default:dry_shrub"
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'homedecor:plastic_base 4',
|
||||
recipe = { "default:leaves",
|
||||
"default:leaves",
|
||||
"default:leaves",
|
||||
"default:leaves",
|
||||
"default:leaves",
|
||||
"default:leaves"
|
||||
}
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'homedecor:plastic_base 4',
|
||||
recipe = { "default:leaves",
|
||||
"default:leaves",
|
||||
"default:leaves",
|
||||
"default:leaves",
|
||||
"default:leaves",
|
||||
"default:leaves"
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "homedecor:plastic_sheeting",
|
||||
recipe = "homedecor:plastic_base",
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "homedecor:plastic_sheeting",
|
||||
recipe = "homedecor:plastic_base",
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'fuel',
|
||||
recipe = 'homedecor:plastic_base',
|
||||
burntime = 30,
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = 'fuel',
|
||||
recipe = 'homedecor:plastic_base',
|
||||
burntime = 30,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = 'fuel',
|
||||
recipe = 'homedecor:plastic_sheeting',
|
||||
burntime = 30,
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = 'fuel',
|
||||
recipe = 'homedecor:plastic_sheeting',
|
||||
burntime = 30,
|
||||
})
|
||||
|
||||
end -- not homedecor
|
||||
|
@ -3,132 +3,132 @@
|
||||
-- License is WTFPL (see README.txt).
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:shefriendSOO";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:glass", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:wood", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
output = "computer:shefriendSOO";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:glass", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:wood", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:slaystation";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:wood", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
output = "computer:slaystation";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:wood", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:vanio";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "", "", },
|
||||
{ "default:glass", "", "" },
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
output = "computer:vanio";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "", "", },
|
||||
{ "default:glass", "", "" },
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:specter";
|
||||
recipe = {
|
||||
{ "", "", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
output = "computer:specter";
|
||||
recipe = {
|
||||
{ "", "", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:slaystation2";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:steel_ingot", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
output = "computer:slaystation2";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:steel_ingot", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:admiral64";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "default:wood", "default:wood", "default:wood", },
|
||||
};
|
||||
output = "computer:admiral64";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "default:wood", "default:wood", "default:wood", },
|
||||
};
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:admiral128";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot", },
|
||||
};
|
||||
output = "computer:admiral128";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "default:steel_ingot", "default:steel_ingot", "default:steel_ingot", },
|
||||
};
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:wee";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:copper_ingot", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
output = "computer:wee";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:copper_ingot", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:piepad";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:glass", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
output = "computer:piepad";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:glass", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
});
|
||||
|
||||
--new stuff
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:monitor";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "default:glass","", },
|
||||
{ "homedecor:plastic_sheeting", "default:glass","", },
|
||||
{ "homedecor:plastic_sheeting", "default:mese_crystal_fragment", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
output = "computer:monitor";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "default:glass","", },
|
||||
{ "homedecor:plastic_sheeting", "default:glass","", },
|
||||
{ "homedecor:plastic_sheeting", "default:mese_crystal_fragment", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:router";
|
||||
recipe = {
|
||||
{ "default:steel_ingot","","", },
|
||||
{ "default:steel_ingot" ,"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "default:mese_crystal_fragment","homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
output = "computer:router";
|
||||
recipe = {
|
||||
{ "default:steel_ingot","","", },
|
||||
{ "default:steel_ingot" ,"homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
{ "default:mese_crystal_fragment","homedecor:plastic_sheeting", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:tower";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "default:steel_ingot", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:mese_crystal", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:steel_ingot", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
output = "computer:tower";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "default:steel_ingot", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:mese_crystal", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:steel_ingot", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:printer";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "default:steel_ingot","", },
|
||||
{ "homedecor:plastic_sheeting", "default:mese_crystal", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:coal_lump", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
output = "computer:printer";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "default:steel_ingot","", },
|
||||
{ "homedecor:plastic_sheeting", "default:mese_crystal", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "default:coal_lump", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:printer";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "default:steel_ingot","", },
|
||||
{ "homedecor:plastic_sheeting", "default:mese_crystal", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "dye:black", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
output = "computer:printer";
|
||||
recipe = {
|
||||
{ "homedecor:plastic_sheeting", "default:steel_ingot","", },
|
||||
{ "homedecor:plastic_sheeting", "default:mese_crystal", "homedecor:plastic_sheeting", },
|
||||
{ "homedecor:plastic_sheeting", "dye:black", "homedecor:plastic_sheeting", },
|
||||
};
|
||||
});
|
||||
|
||||
minetest.register_craft({
|
||||
output = "computer:server";
|
||||
recipe = {
|
||||
{ "computer:tower", "computer:tower", "computer:tower", },
|
||||
{ "computer:tower", "computer:tower", "computer:tower", },
|
||||
{ "computer:tower", "computer:tower", "computer:tower", },
|
||||
};
|
||||
output = "computer:server";
|
||||
recipe = {
|
||||
{ "computer:tower", "computer:tower", "computer:tower", },
|
||||
{ "computer:tower", "computer:tower", "computer:tower", },
|
||||
{ "computer:tower", "computer:tower", "computer:tower", },
|
||||
};
|
||||
});
|
||||
|
154
inbox/init.lua
154
inbox/init.lua
@ -6,86 +6,86 @@ TODO
|
||||
]]
|
||||
|
||||
minetest.register_craft({
|
||||
output ="inbox:empty",
|
||||
recipe = {
|
||||
{"","default:steel_ingot",""},
|
||||
{"default:steel_ingot","","default:steel_ingot"},
|
||||
{"default:steel_ingot","default:steel_ingot","default:steel_ingot"}
|
||||
}
|
||||
output ="inbox:empty",
|
||||
recipe = {
|
||||
{"","default:steel_ingot",""},
|
||||
{"default:steel_ingot","","default:steel_ingot"},
|
||||
{"default:steel_ingot","default:steel_ingot","default:steel_ingot"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_node("inbox:empty", {
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-4/12, -6/12, -6/12, 4/12, 0/12, 6/12},
|
||||
{-3/12, 0/12, -6/12, 3/12, 2/12, 6/12},
|
||||
{3/12, 0/12, -4/12, 4/12, 5/12, -2/12},
|
||||
{3/12, 3/12, -2/12, 4/12, 5/12, 0/12}
|
||||
}
|
||||
},
|
||||
description = "Mailbox",
|
||||
tiles = {"inbox_top.png", "inbox_bottom.png", "inbox_east.png",
|
||||
"inbox_west.png", "inbox_back.png", "inbox_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy=2,oddly_breakable_by_hand=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = placer:get_player_name()
|
||||
meta:set_string("owner", owner)
|
||||
meta:set_string("infotext", owner.."'s Mailbox")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
inv:set_size("drop", 1)
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local player = clicker:get_player_name()
|
||||
local owner = meta:get_string("owner")
|
||||
local meta = minetest.get_meta(pos)
|
||||
if owner == player then
|
||||
minetest.show_formspec(
|
||||
clicker:get_player_name(),
|
||||
"default:chest_locked",
|
||||
inbox.get_inbox_formspec(pos))
|
||||
else
|
||||
minetest.show_formspec(
|
||||
clicker:get_player_name(),
|
||||
"default:chest_locked",
|
||||
inbox.get_inbox_insert_formspec(pos))
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local owner = meta:get_string("owner")
|
||||
local inv = meta:get_inventory()
|
||||
return player:get_player_name() == owner and inv:is_empty("main")
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if listname == "drop" and inv:room_for_item("main", stack) then
|
||||
inv:remove_item("drop", stack)
|
||||
inv:add_item("main", stack)
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
if listname == "main" then
|
||||
return 0
|
||||
end
|
||||
if listname == "drop" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if inv:room_for_item("main", stack) then
|
||||
return -1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
end,
|
||||
paramtype = "light",
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-4/12, -6/12, -6/12, 4/12, 0/12, 6/12},
|
||||
{-3/12, 0/12, -6/12, 3/12, 2/12, 6/12},
|
||||
{3/12, 0/12, -4/12, 4/12, 5/12, -2/12},
|
||||
{3/12, 3/12, -2/12, 4/12, 5/12, 0/12}
|
||||
}
|
||||
},
|
||||
description = "Mailbox",
|
||||
tiles = {"inbox_top.png", "inbox_bottom.png", "inbox_east.png",
|
||||
"inbox_west.png", "inbox_back.png", "inbox_front.png"},
|
||||
paramtype2 = "facedir",
|
||||
groups = {choppy=2,oddly_breakable_by_hand=2},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local owner = placer:get_player_name()
|
||||
meta:set_string("owner", owner)
|
||||
meta:set_string("infotext", owner.."'s Mailbox")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size("main", 8*4)
|
||||
inv:set_size("drop", 1)
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local player = clicker:get_player_name()
|
||||
local owner = meta:get_string("owner")
|
||||
local meta = minetest.get_meta(pos)
|
||||
if owner == player then
|
||||
minetest.show_formspec(
|
||||
clicker:get_player_name(),
|
||||
"default:chest_locked",
|
||||
inbox.get_inbox_formspec(pos))
|
||||
else
|
||||
minetest.show_formspec(
|
||||
clicker:get_player_name(),
|
||||
"default:chest_locked",
|
||||
inbox.get_inbox_insert_formspec(pos))
|
||||
end
|
||||
end,
|
||||
can_dig = function(pos,player)
|
||||
local meta = minetest.get_meta(pos);
|
||||
local owner = meta:get_string("owner")
|
||||
local inv = meta:get_inventory()
|
||||
return player:get_player_name() == owner and inv:is_empty("main")
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if listname == "drop" and inv:room_for_item("main", stack) then
|
||||
inv:remove_item("drop", stack)
|
||||
inv:add_item("main", stack)
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||
if listname == "main" then
|
||||
return 0
|
||||
end
|
||||
if listname == "drop" then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if inv:room_for_item("main", stack) then
|
||||
return -1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
function inbox.get_inbox_formspec(pos)
|
||||
|
Loading…
Reference in New Issue
Block a user