2012-07-12 23:56:15 +02:00
|
|
|
-- Home Decor mod by VanessaE
|
|
|
|
--
|
|
|
|
-- Mostly my own code, with bits and pieces lifted from Minetest's default
|
Various changes
Recipe changes:
Brass and wrought iron poles, table legs, and fences/railings were too
expensive in practice. Increased recipe outputs.
Small square glass table now comes from one small round table (instead of
three-to-two). Large square glass comes from one small square insted of two. Small round, small square, and large wooden tables follow the same pattern.
All glass tables can be recycled back into glass blocks via the Vessels mod's
recipes. All are 3:1 with glass fragments (and thus, 3:1 with glass blocks),
so there's no glass wasted.
All wooden tables can be crafted into sticks by putting three of a given item
onto the crafting grid. Any such craft yields 4 sticks, so there's no waste.
Other changes:
3d-ified nightstands, improved their textures somewhat.
New nodes:
* Added working oven (really just a furnace with new textures)
* Added mini-fridge that stores 24 slots
* Added kitchen cabinet that stores 24 slots
* Added half-size kitchen cabinet that stores 12 slots (6x2)
* Added kitchen sink with under-sink cabinet that stores 16 slots.
* Added slab-sized and half-slab-sized glowlights (e.g. ceiling fixtures)
* Added curtains in 6 colors: red, green, blue, purple, pink, white
Notes:
This mod now requires Moreblocks for some recipes - namely fridge and oven.
2012-09-30 07:51:59 +02:00
|
|
|
-- lua files and from ironzorg's flowers mod. Many thanks to GloopMaster
|
|
|
|
-- for helping me figure out the inventories used in the nightstands/dressers.
|
2012-07-12 23:56:15 +02:00
|
|
|
--
|
2015-01-20 23:59:50 +01:00
|
|
|
-- The code for ovens, nightstands, refrigerators are basically modified
|
Various changes
Recipe changes:
Brass and wrought iron poles, table legs, and fences/railings were too
expensive in practice. Increased recipe outputs.
Small square glass table now comes from one small round table (instead of
three-to-two). Large square glass comes from one small square insted of two. Small round, small square, and large wooden tables follow the same pattern.
All glass tables can be recycled back into glass blocks via the Vessels mod's
recipes. All are 3:1 with glass fragments (and thus, 3:1 with glass blocks),
so there's no glass wasted.
All wooden tables can be crafted into sticks by putting three of a given item
onto the crafting grid. Any such craft yields 4 sticks, so there's no waste.
Other changes:
3d-ified nightstands, improved their textures somewhat.
New nodes:
* Added working oven (really just a furnace with new textures)
* Added mini-fridge that stores 24 slots
* Added kitchen cabinet that stores 24 slots
* Added half-size kitchen cabinet that stores 12 slots (6x2)
* Added kitchen sink with under-sink cabinet that stores 16 slots.
* Added slab-sized and half-slab-sized glowlights (e.g. ceiling fixtures)
* Added curtains in 6 colors: red, green, blue, purple, pink, white
Notes:
This mod now requires Moreblocks for some recipes - namely fridge and oven.
2012-09-30 07:51:59 +02:00
|
|
|
-- copies of the code for chests and furnaces.
|
2012-07-12 23:56:15 +02:00
|
|
|
|
2013-10-09 18:47:22 +02:00
|
|
|
homedecor = {}
|
|
|
|
|
2013-10-10 02:14:52 +02:00
|
|
|
homedecor.debug = 0
|
2013-10-09 18:47:22 +02:00
|
|
|
|
2014-08-12 18:11:12 +02:00
|
|
|
-- detail level for roofing slopes and also cobwebs
|
|
|
|
|
|
|
|
homedecor.detail_level = 16
|
|
|
|
|
2013-10-09 18:47:22 +02:00
|
|
|
homedecor.modpath = minetest.get_modpath("homedecor")
|
|
|
|
homedecor.intllib_modpath = minetest.get_modpath("intllib")
|
2012-07-12 23:56:15 +02:00
|
|
|
|
2013-03-05 08:18:56 +01:00
|
|
|
-- Boilerplate to support localized strings if intllib mod is installed.
|
2013-10-16 16:30:41 +02:00
|
|
|
local S
|
2014-12-27 07:13:05 +01:00
|
|
|
if minetest.get_modpath("intllib") then
|
|
|
|
S = intllib.Getter()
|
2013-10-16 16:30:41 +02:00
|
|
|
else
|
2014-12-27 07:13:05 +01:00
|
|
|
S = function(s) return s end
|
2013-10-16 16:30:41 +02:00
|
|
|
end
|
2013-10-22 02:31:54 +02:00
|
|
|
homedecor.gettext = S
|
2013-03-05 08:18:56 +01:00
|
|
|
|
2013-10-28 03:51:56 +01:00
|
|
|
-- debug
|
|
|
|
|
2012-07-12 23:56:15 +02:00
|
|
|
local dbg = function(s)
|
2013-10-09 18:47:22 +02:00
|
|
|
if homedecor.debug == 1 then
|
2012-07-12 23:56:15 +02:00
|
|
|
print('[HomeDecor] ' .. s)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-10-28 03:51:56 +01:00
|
|
|
-- infinite stacks
|
|
|
|
|
2013-04-17 09:14:09 +02:00
|
|
|
if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then
|
2013-10-09 18:47:22 +02:00
|
|
|
homedecor.expect_infinite_stacks = false
|
2013-04-17 09:14:09 +02:00
|
|
|
else
|
2013-10-09 18:47:22 +02:00
|
|
|
homedecor.expect_infinite_stacks = true
|
2013-04-17 09:14:09 +02:00
|
|
|
end
|
|
|
|
|
2013-10-28 03:51:56 +01:00
|
|
|
--table copy
|
|
|
|
|
|
|
|
function homedecor.table_copy(t)
|
|
|
|
local nt = { };
|
|
|
|
for k, v in pairs(t) do
|
|
|
|
if type(v) == "table" then
|
|
|
|
nt[k] = homedecor.table_copy(v)
|
|
|
|
else
|
|
|
|
nt[k] = v
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return nt
|
|
|
|
end
|
|
|
|
|
2015-01-20 23:59:50 +01:00
|
|
|
--
|
2014-06-29 16:47:25 +02:00
|
|
|
|
|
|
|
function homedecor.get_nodedef_field(nodename, fieldname)
|
|
|
|
if not minetest.registered_nodes[nodename] then
|
|
|
|
return nil
|
|
|
|
end
|
|
|
|
return minetest.registered_nodes[nodename][fieldname]
|
|
|
|
end
|
2013-11-08 03:22:16 +01:00
|
|
|
|
2015-01-03 07:52:39 +01:00
|
|
|
-- Place a two-node-tall single object (e.g. a floor lamp)
|
|
|
|
|
|
|
|
function homedecor.place_twonode_vertical(itemstack, placer, pointed_thing, node)
|
|
|
|
local pos = pointed_thing.under
|
|
|
|
local pnode = minetest.get_node(pointed_thing.under)
|
|
|
|
local rnodedef = minetest.registered_nodes[pnode.name]
|
|
|
|
|
|
|
|
if not rnodedef["buildable_to"] then
|
|
|
|
pos = pointed_thing.above
|
|
|
|
end
|
|
|
|
|
|
|
|
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
|
|
|
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
|
|
|
|
|
|
|
|
local tnode = minetest.get_node(pos)
|
|
|
|
local tnode2 = minetest.get_node(pos2)
|
|
|
|
|
|
|
|
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
|
|
|
|
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
|
|
|
|
and not minetest.is_protected(pos, placer:get_player_name())
|
|
|
|
and not minetest.is_protected(pos2, placer:get_player_name()) then
|
|
|
|
minetest.add_node(pos, { name = node, param2 = fdir })
|
|
|
|
if not homedecor.expect_infinite_stacks then
|
|
|
|
itemstack:take_item()
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-07 21:01:51 +02:00
|
|
|
-- Stack one node above another
|
|
|
|
|
|
|
|
function homedecor.stack_vertically(itemstack, placer, pointed_thing, node1, node2)
|
|
|
|
local pos = pointed_thing.under
|
|
|
|
local pnode = minetest.get_node(pointed_thing.under)
|
|
|
|
local rnodedef = minetest.registered_nodes[pnode.name]
|
|
|
|
|
|
|
|
if not rnodedef["buildable_to"] then
|
|
|
|
pos = pointed_thing.above
|
|
|
|
end
|
|
|
|
|
|
|
|
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
|
|
|
local pos2 = { x = pos.x, y=pos.y + 1, z = pos.z }
|
|
|
|
|
|
|
|
local tnode = minetest.get_node(pos)
|
|
|
|
local tnode2 = minetest.get_node(pos2)
|
|
|
|
|
|
|
|
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
|
|
|
|
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
|
|
|
|
and not minetest.is_protected(pos, placer:get_player_name())
|
|
|
|
and not minetest.is_protected(pos2, placer:get_player_name()) then
|
|
|
|
minetest.add_node(pos, { name = node1, param2 = fdir })
|
|
|
|
minetest.add_node(pos2, { name = node2, param2 = fdir })
|
|
|
|
if not homedecor.expect_infinite_stacks then
|
|
|
|
itemstack:take_item()
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Place one node right of or behind another
|
|
|
|
|
|
|
|
homedecor.fdir_to_right = {
|
|
|
|
{ 1, 0 },
|
|
|
|
{ 0, -1 },
|
|
|
|
{ -1, 0 },
|
|
|
|
{ 0, 1 },
|
|
|
|
}
|
|
|
|
|
|
|
|
homedecor.fdir_to_fwd = {
|
|
|
|
{ 0, 1 },
|
|
|
|
{ 1, 0 },
|
|
|
|
{ 0, -1 },
|
|
|
|
{ -1, 0 },
|
|
|
|
}
|
|
|
|
|
|
|
|
function homedecor.stack_sideways(itemstack, placer, pointed_thing, node1, node2, dir)
|
|
|
|
local pos = pointed_thing.under
|
|
|
|
local pnode = minetest.get_node(pointed_thing.under)
|
|
|
|
local rnodedef = minetest.registered_nodes[pnode.name]
|
|
|
|
|
|
|
|
if not rnodedef["buildable_to"] then
|
|
|
|
pos = pointed_thing.above
|
|
|
|
end
|
|
|
|
|
|
|
|
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
|
|
|
local pos2
|
|
|
|
if dir then
|
|
|
|
pos2 = { x = pos.x + homedecor.fdir_to_right[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_right[fdir+1][2] }
|
|
|
|
else
|
|
|
|
pos2 = { x = pos.x + homedecor.fdir_to_fwd[fdir+1][1], y=pos.y, z = pos.z + homedecor.fdir_to_fwd[fdir+1][2] }
|
|
|
|
end
|
|
|
|
|
|
|
|
local tnode = minetest.get_node(pos)
|
|
|
|
local tnode2 = minetest.get_node(pos2)
|
|
|
|
|
|
|
|
if homedecor.get_nodedef_field(tnode.name, "buildable_to")
|
|
|
|
and homedecor.get_nodedef_field(tnode2.name, "buildable_to")
|
|
|
|
and not minetest.is_protected(pos, placer:get_player_name())
|
|
|
|
and not minetest.is_protected(pos2, placer:get_player_name()) then
|
|
|
|
minetest.add_node(pos, { name = node1, param2 = fdir })
|
|
|
|
minetest.add_node(pos2, { name = node2, param2 = fdir })
|
|
|
|
if not homedecor.expect_infinite_stacks then
|
|
|
|
itemstack:take_item()
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-09-18 22:29:28 +02:00
|
|
|
-- Determine if the item being pointed at is the underside of a node (e.g a ceiling)
|
|
|
|
|
|
|
|
function homedecor.find_ceiling(itemstack, placer, pointed_thing)
|
|
|
|
-- most of this is copied from the rotate-and-place function in builtin
|
|
|
|
local unode = core.get_node_or_nil(pointed_thing.under)
|
|
|
|
if not unode then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
local undef = core.registered_nodes[unode.name]
|
|
|
|
if undef and undef.on_rightclick then
|
|
|
|
undef.on_rightclick(pointed_thing.under, unode, placer,
|
|
|
|
itemstack, pointed_thing)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
local pitch = placer:get_look_pitch()
|
|
|
|
local fdir = core.dir_to_facedir(placer:get_look_dir())
|
|
|
|
local wield_name = itemstack:get_name()
|
|
|
|
|
|
|
|
local above = pointed_thing.above
|
|
|
|
local under = pointed_thing.under
|
|
|
|
local iswall = (above.y == under.y)
|
|
|
|
local isceiling = not iswall and (above.y < under.y)
|
|
|
|
local anode = core.get_node_or_nil(above)
|
|
|
|
if not anode then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
local pos = pointed_thing.above
|
|
|
|
local node = anode
|
|
|
|
|
|
|
|
if undef and undef.buildable_to then
|
|
|
|
pos = pointed_thing.under
|
|
|
|
node = unode
|
|
|
|
iswall = false
|
|
|
|
end
|
|
|
|
|
|
|
|
if core.is_protected(pos, placer:get_player_name()) then
|
|
|
|
core.record_protection_violation(pos,
|
|
|
|
placer:get_player_name())
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local ndef = core.registered_nodes[node.name]
|
|
|
|
if not ndef or not ndef.buildable_to then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
return isceiling, pos
|
|
|
|
end
|
|
|
|
|
2015-01-21 19:19:14 +01:00
|
|
|
dofile(homedecor.modpath.."/registration_handler.lua")
|
2013-11-08 03:22:16 +01:00
|
|
|
|
2015-01-21 19:19:14 +01:00
|
|
|
-- load various other components
|
2014-06-27 03:33:27 +02:00
|
|
|
dofile(homedecor.modpath.."/misc-nodes.lua") -- the catch-all for all misc nodes
|
2013-10-09 18:47:22 +02:00
|
|
|
dofile(homedecor.modpath.."/tables.lua")
|
|
|
|
dofile(homedecor.modpath.."/electronics.lua")
|
|
|
|
dofile(homedecor.modpath.."/shutters.lua")
|
|
|
|
dofile(homedecor.modpath.."/shingles.lua")
|
|
|
|
dofile(homedecor.modpath.."/slopes.lua")
|
Various changes
Recipe changes:
Brass and wrought iron poles, table legs, and fences/railings were too
expensive in practice. Increased recipe outputs.
Small square glass table now comes from one small round table (instead of
three-to-two). Large square glass comes from one small square insted of two. Small round, small square, and large wooden tables follow the same pattern.
All glass tables can be recycled back into glass blocks via the Vessels mod's
recipes. All are 3:1 with glass fragments (and thus, 3:1 with glass blocks),
so there's no glass wasted.
All wooden tables can be crafted into sticks by putting three of a given item
onto the crafting grid. Any such craft yields 4 sticks, so there's no waste.
Other changes:
3d-ified nightstands, improved their textures somewhat.
New nodes:
* Added working oven (really just a furnace with new textures)
* Added mini-fridge that stores 24 slots
* Added kitchen cabinet that stores 24 slots
* Added half-size kitchen cabinet that stores 12 slots (6x2)
* Added kitchen sink with under-sink cabinet that stores 16 slots.
* Added slab-sized and half-slab-sized glowlights (e.g. ceiling fixtures)
* Added curtains in 6 colors: red, green, blue, purple, pink, white
Notes:
This mod now requires Moreblocks for some recipes - namely fridge and oven.
2012-09-30 07:51:59 +02:00
|
|
|
|
2013-10-09 18:47:22 +02:00
|
|
|
dofile(homedecor.modpath.."/door_models.lua")
|
|
|
|
dofile(homedecor.modpath.."/doors_and_gates.lua")
|
2013-01-23 11:45:42 +01:00
|
|
|
|
2013-10-09 18:47:22 +02:00
|
|
|
dofile(homedecor.modpath.."/fences.lua")
|
2013-02-08 08:31:40 +01:00
|
|
|
|
2013-10-09 18:47:22 +02:00
|
|
|
dofile(homedecor.modpath.."/lighting.lua")
|
|
|
|
dofile(homedecor.modpath.."/kitchen_cabinet.lua")
|
|
|
|
dofile(homedecor.modpath.."/refrigerator.lua")
|
2014-06-25 07:02:26 +02:00
|
|
|
|
2014-06-27 03:33:27 +02:00
|
|
|
dofile(homedecor.modpath.."/misc-bathroom.lua")
|
|
|
|
|
2014-06-25 07:02:26 +02:00
|
|
|
dofile(homedecor.modpath.."/laundry.lua")
|
|
|
|
|
2013-10-09 18:47:22 +02:00
|
|
|
dofile(homedecor.modpath.."/furnaces.lua")
|
|
|
|
dofile(homedecor.modpath.."/nightstands.lua")
|
2014-06-25 11:59:34 +02:00
|
|
|
dofile(homedecor.modpath.."/clocks.lua")
|
2014-06-26 05:08:20 +02:00
|
|
|
dofile(homedecor.modpath.."/misc-electrical.lua")
|
|
|
|
|
2014-06-25 13:31:50 +02:00
|
|
|
dofile(homedecor.modpath.."/paintings.lua")
|
2014-06-27 02:13:16 +02:00
|
|
|
dofile(homedecor.modpath.."/window_treatments.lua")
|
2013-01-23 11:45:42 +01:00
|
|
|
|
2013-10-09 18:47:22 +02:00
|
|
|
dofile(homedecor.modpath.."/crafts.lua")
|
2013-01-23 11:45:42 +01:00
|
|
|
|
2013-10-09 18:47:22 +02:00
|
|
|
dofile(homedecor.modpath.."/furniture.lua")
|
|
|
|
dofile(homedecor.modpath.."/furniture_medieval.lua")
|
|
|
|
dofile(homedecor.modpath.."/furniture_bathroom.lua")
|
|
|
|
dofile(homedecor.modpath.."/furniture_recipes.lua")
|
2014-07-18 16:22:44 +02:00
|
|
|
dofile(homedecor.modpath.."/climate-control.lua")
|
2013-03-26 12:05:22 +01:00
|
|
|
|
2014-09-04 22:27:05 +02:00
|
|
|
dofile(homedecor.modpath.."/cobweb.lua")
|
|
|
|
|
2013-10-09 18:47:22 +02:00
|
|
|
dofile(homedecor.modpath.."/locked.lua")
|
2013-07-12 22:41:11 +02:00
|
|
|
|
2014-07-18 15:01:00 +02:00
|
|
|
|
|
|
|
|
2013-03-05 08:18:56 +01:00
|
|
|
print("[HomeDecor] "..S("Loaded!"))
|