247 lines
8.8 KiB
Lua
247 lines
8.8 KiB
Lua
minetest.register_node('furniture:chest_small', {
|
|
description = 'Small Chest',
|
|
drawtype = 'mesh',
|
|
mesh = 'furniture_chest_small.obj',
|
|
tiles = {'furniture_chest_small.png'},
|
|
overlay_tiles = {{name='furniture_chest_small_overlay.png', color='white'}},
|
|
paramtype = 'light',
|
|
paramtype2 = 'colorfacedir',
|
|
palette = 'furniture_stain_palette.png',
|
|
selection_box = {
|
|
type = 'fixed',
|
|
fixed = {-.4, -.5, -.3, .4, .2, .4},
|
|
},
|
|
collision_box = {
|
|
type = 'fixed',
|
|
fixed = {-.4, -.5, -.3, .4, .2, .4},
|
|
},
|
|
groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
|
|
on_construct = function(pos)
|
|
local meta = minetest.get_meta(pos)
|
|
meta:set_string('formspec', furniture.storage_24_form(pos, ''))
|
|
local inv = meta:get_inventory()
|
|
inv:set_size('main', 24)
|
|
end,
|
|
can_dig = function(pos,player)
|
|
local meta = minetest.get_meta(pos)
|
|
local inv = meta:get_inventory()
|
|
return inv:is_empty('main')
|
|
end,
|
|
on_receive_fields = function(pos, formname, fields, sender)
|
|
local player_name = sender:get_player_name()
|
|
if minetest.is_protected(pos, player_name) and not minetest.check_player_privs(sender, 'protection_bypass') then
|
|
return
|
|
end
|
|
local meta = minetest.get_meta(pos)
|
|
if fields ['save'] then
|
|
meta:set_string('infotext', fields.description)
|
|
meta:set_string('formspec', furniture.storage_24_form(pos, fields.description))
|
|
elseif fields ['sort'] then
|
|
furniture.sort_inventory(meta:get_inventory())
|
|
end
|
|
end,
|
|
allow_metadata_inventory_put = furniture.inv_take_put,
|
|
allow_metadata_inventory_take = furniture.inv_take_put,
|
|
allow_metadata_inventory_move = furniture.inv_manipulate,
|
|
})
|
|
|
|
minetest.register_node('furniture:chest', {
|
|
description = 'Chest',
|
|
drawtype = 'mesh',
|
|
mesh = 'furniture_chest.obj',
|
|
tiles = {'furniture_chest.png'},
|
|
overlay_tiles = {{name='furniture_chest_overlay.png', color='white'}},
|
|
paramtype = 'light',
|
|
paramtype2 = 'colorfacedir',
|
|
palette = 'furniture_stain_palette.png',
|
|
selection_box = {
|
|
type = 'fixed',
|
|
fixed = {-.45, -.5, -.4, .45, .4, .5},
|
|
},
|
|
collision_box = {
|
|
type = 'fixed',
|
|
fixed = {-.45, -.5, -.4, .45, .4, .5},
|
|
},
|
|
groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
|
|
on_construct = function(pos)
|
|
local meta = minetest.get_meta(pos)
|
|
meta:set_string('formspec', furniture.storage_32_form(pos, ''))
|
|
local inv = meta:get_inventory()
|
|
inv:set_size('main', 32)
|
|
end,
|
|
can_dig = function(pos,player)
|
|
local meta = minetest.get_meta(pos)
|
|
local inv = meta:get_inventory()
|
|
return inv:is_empty('main')
|
|
end,
|
|
on_receive_fields = function(pos, formname, fields, sender)
|
|
local player_name = sender:get_player_name()
|
|
if minetest.is_protected(pos, player_name) and not minetest.check_player_privs(sender, 'protection_bypass') then
|
|
return
|
|
end
|
|
local meta = minetest.get_meta(pos)
|
|
if fields ['save'] then
|
|
meta:set_string('infotext', fields.description)
|
|
meta:set_string('formspec', furniture.storage_32_form(pos, fields.description))
|
|
elseif fields ['sort'] then
|
|
furniture.sort_inventory(meta:get_inventory())
|
|
end
|
|
end,
|
|
allow_metadata_inventory_put = furniture.inv_take_put,
|
|
allow_metadata_inventory_take = furniture.inv_take_put,
|
|
allow_metadata_inventory_move = furniture.inv_manipulate,
|
|
})
|
|
|
|
minetest.register_node('furniture:chest_large', {
|
|
description = 'Large Chest',
|
|
drawtype = 'mesh',
|
|
mesh = 'furniture_chest_large.obj',
|
|
tiles = {'furniture_chest_large.png'},
|
|
overlay_tiles = {{name='furniture_chest_large_overlay.png', color='white'}},
|
|
paramtype = 'light',
|
|
paramtype2 = 'colorfacedir',
|
|
palette = 'furniture_stain_palette.png',
|
|
selection_box = {
|
|
type = 'fixed',
|
|
fixed = {-.5, -.5, -.4, 1.5, .3, .5},
|
|
},
|
|
collision_box = {
|
|
type = 'fixed',
|
|
fixed = {-.5, -.5, -.4, 1.5, .3, .5},
|
|
},
|
|
groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
|
|
after_place_node = function(pos, placer, itemstack)
|
|
if not epic.space_to_side(pos) then
|
|
minetest.remove_node(pos)
|
|
return itemstack
|
|
end
|
|
end,
|
|
on_construct = function(pos)
|
|
local meta = minetest.get_meta(pos)
|
|
meta:set_string('formspec', furniture.storage_60_form(pos, ''))
|
|
local inv = meta:get_inventory()
|
|
inv:set_size('main', 60)
|
|
end,
|
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
epic.remove_side_node(pos, oldnode)
|
|
end,
|
|
can_dig = function(pos,player)
|
|
local meta = minetest.get_meta(pos)
|
|
local inv = meta:get_inventory()
|
|
return inv:is_empty('main')
|
|
end,
|
|
on_receive_fields = function(pos, formname, fields, sender)
|
|
local player_name = sender:get_player_name()
|
|
if minetest.is_protected(pos, player_name) and not minetest.check_player_privs(sender, 'protection_bypass') then
|
|
return
|
|
end
|
|
local meta = minetest.get_meta(pos)
|
|
if fields ['save'] then
|
|
meta:set_string('infotext', fields.description)
|
|
meta:set_string('formspec', furniture.storage_60_form(pos, fields.description))
|
|
elseif fields ['sort'] then
|
|
furniture.sort_inventory(meta:get_inventory())
|
|
end
|
|
end,
|
|
on_rotate = function(pos, node)
|
|
return false
|
|
end,
|
|
allow_metadata_inventory_put = furniture.inv_take_put,
|
|
allow_metadata_inventory_take = furniture.inv_take_put,
|
|
allow_metadata_inventory_move = furniture.inv_manipulate,
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node('furniture:cabinet_wall', {
|
|
description = 'Wall Mounted Cabinet',
|
|
drawtype = 'mesh',
|
|
mesh = 'furniture_cabinet_wall.obj',
|
|
tiles = {'furniture_cabinet_wall.png'},
|
|
paramtype = 'light',
|
|
paramtype2 = 'colorfacedir',
|
|
palette = 'furniture_stain_palette.png',
|
|
selection_box = {
|
|
type = 'fixed',
|
|
fixed = {-.5, -.5, -.3, .5, .5, .5},
|
|
},
|
|
collision_box = {
|
|
type = 'fixed',
|
|
fixed = {-.5, -.5, -.3, .5, .5, .5},
|
|
},
|
|
groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
|
|
on_construct = function(pos)
|
|
local meta = minetest.get_meta(pos)
|
|
meta:set_string('formspec', furniture.storage_24_form(pos, ''))
|
|
local inv = meta:get_inventory()
|
|
inv:set_size('main', 24)
|
|
end,
|
|
can_dig = function(pos,player)
|
|
local meta = minetest.get_meta(pos)
|
|
local inv = meta:get_inventory()
|
|
return inv:is_empty('main')
|
|
end,
|
|
on_receive_fields = function(pos, formname, fields, sender)
|
|
local player_name = sender:get_player_name()
|
|
if minetest.is_protected(pos, player_name) and not minetest.check_player_privs(sender, 'protection_bypass') then
|
|
return
|
|
end
|
|
local meta = minetest.get_meta(pos)
|
|
if fields ['save'] then
|
|
meta:set_string('infotext', fields.description)
|
|
meta:set_string('formspec', furniture.storage_24_form(pos, fields.description))
|
|
elseif fields ['sort'] then
|
|
furniture.sort_inventory(meta:get_inventory())
|
|
end
|
|
end,
|
|
allow_metadata_inventory_put = furniture.inv_take_put,
|
|
allow_metadata_inventory_take = furniture.inv_take_put,
|
|
allow_metadata_inventory_move = furniture.inv_manipulate,
|
|
})
|
|
|
|
minetest.register_node('furniture:cabinet_counter', {
|
|
description = 'Cabinet with Countertop',
|
|
drawtype = 'mesh',
|
|
mesh = 'furniture_cabinet_counter.obj',
|
|
tiles = {'furniture_cabinet_counter.png'},
|
|
paramtype = 'light',
|
|
paramtype2 = 'colorfacedir',
|
|
palette = 'furniture_stain_palette.png',
|
|
selection_box = {
|
|
type = 'fixed',
|
|
fixed = {-.5, -.5, -.5, .5, .5, .5},
|
|
},
|
|
collision_box = {
|
|
type = 'fixed',
|
|
fixed = {-.5, -.5, -.5, .5, .5, .5},
|
|
},
|
|
groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
|
|
on_construct = function(pos)
|
|
local meta = minetest.get_meta(pos)
|
|
meta:set_string('formspec', furniture.storage_24_form(pos, ''))
|
|
local inv = meta:get_inventory()
|
|
inv:set_size('main', 24)
|
|
end,
|
|
can_dig = function(pos,player)
|
|
local meta = minetest.get_meta(pos)
|
|
local inv = meta:get_inventory()
|
|
return inv:is_empty('main')
|
|
end,
|
|
on_receive_fields = function(pos, formname, fields, sender)
|
|
local player_name = sender:get_player_name()
|
|
if minetest.is_protected(pos, player_name) and not minetest.check_player_privs(sender, 'protection_bypass') then
|
|
return
|
|
end
|
|
local meta = minetest.get_meta(pos)
|
|
if fields ['save'] then
|
|
meta:set_string('infotext', fields.description)
|
|
meta:set_string('formspec', furniture.storage_24_form(pos, fields.description))
|
|
elseif fields ['sort'] then
|
|
furniture.sort_inventory(meta:get_inventory())
|
|
end
|
|
end,
|
|
allow_metadata_inventory_put = furniture.inv_take_put,
|
|
allow_metadata_inventory_take = furniture.inv_take_put,
|
|
allow_metadata_inventory_move = furniture.inv_manipulate,
|
|
})
|