forked from nalc/homedecor_modpack
60d34095a5
Algorithm tries to find an X-/Z+ or X+/Z- corner first (places the cobweb using the torchlike "on-floor" mode) then an X-/Z- or X+/Z+ corner ("on-ceiling), then opposing X-/X+ walls (nodebox, not rotated), then opposing Z-/Z+ walls (nodebox, rotated 90 degrees), then falls back to plantlike (which also happens to fit places where e.g. three walls come together only 1m apart) ABM added to convert old ones. Node name has changed so if you have cobwebs in your inventory, sorry about that.
115 lines
3.0 KiB
Lua
115 lines
3.0 KiB
Lua
-- Home Decor mod by VanessaE
|
|
--
|
|
-- Mostly my own code, with bits and pieces lifted from Minetest's default
|
|
-- lua files and from ironzorg's flowers mod. Many thanks to GloopMaster
|
|
-- for helping me figure out the inventories used in the nightstands/dressers.
|
|
--
|
|
-- The code for ovens, nightstands, refrigerators are basically modified
|
|
-- copies of the code for chests and furnaces.
|
|
|
|
homedecor = {}
|
|
|
|
homedecor.debug = 0
|
|
|
|
-- detail level for roofing slopes and also cobwebs
|
|
|
|
homedecor.detail_level = 16
|
|
|
|
homedecor.modpath = minetest.get_modpath("homedecor")
|
|
homedecor.intllib_modpath = minetest.get_modpath("intllib")
|
|
|
|
-- Boilerplate to support localized strings if intllib mod is installed.
|
|
local S
|
|
if homedecor.intllib_modpath then
|
|
dofile(homedecor.intllib_modpath.."/intllib.lua")
|
|
S = intllib.Getter(minetest.get_current_modname())
|
|
else
|
|
S = function ( s ) return s end
|
|
end
|
|
homedecor.gettext = S
|
|
|
|
-- debug
|
|
|
|
local dbg = function(s)
|
|
if homedecor.debug == 1 then
|
|
print('[HomeDecor] ' .. s)
|
|
end
|
|
end
|
|
|
|
-- infinite stacks
|
|
|
|
if minetest.get_modpath("unified_inventory") or not minetest.setting_getbool("creative_mode") then
|
|
homedecor.expect_infinite_stacks = false
|
|
else
|
|
homedecor.expect_infinite_stacks = true
|
|
end
|
|
|
|
--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
|
|
|
|
--
|
|
|
|
function homedecor.get_nodedef_field(nodename, fieldname)
|
|
if not minetest.registered_nodes[nodename] then
|
|
return nil
|
|
end
|
|
return minetest.registered_nodes[nodename][fieldname]
|
|
end
|
|
|
|
-- load various other components
|
|
|
|
dofile(homedecor.modpath.."/misc-nodes.lua") -- the catch-all for all misc nodes
|
|
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")
|
|
|
|
dofile(homedecor.modpath.."/door_models.lua")
|
|
dofile(homedecor.modpath.."/doors_and_gates.lua")
|
|
|
|
dofile(homedecor.modpath.."/fences.lua")
|
|
|
|
dofile(homedecor.modpath.."/lighting.lua")
|
|
dofile(homedecor.modpath.."/kitchen_cabinet.lua")
|
|
dofile(homedecor.modpath.."/refrigerator.lua")
|
|
|
|
dofile(homedecor.modpath.."/misc-bathroom.lua")
|
|
|
|
dofile(homedecor.modpath.."/laundry.lua")
|
|
|
|
dofile(homedecor.modpath.."/furnaces.lua")
|
|
dofile(homedecor.modpath.."/nightstands.lua")
|
|
dofile(homedecor.modpath.."/clocks.lua")
|
|
dofile(homedecor.modpath.."/misc-electrical.lua")
|
|
|
|
dofile(homedecor.modpath.."/paintings.lua")
|
|
dofile(homedecor.modpath.."/window_treatments.lua")
|
|
|
|
dofile(homedecor.modpath.."/crafts.lua")
|
|
|
|
dofile(homedecor.modpath.."/furniture.lua")
|
|
dofile(homedecor.modpath.."/furniture_medieval.lua")
|
|
dofile(homedecor.modpath.."/furniture_bathroom.lua")
|
|
dofile(homedecor.modpath.."/furniture_recipes.lua")
|
|
dofile(homedecor.modpath.."/climate-control.lua")
|
|
|
|
dofile(homedecor.modpath.."/cobweb.lua")
|
|
|
|
dofile(homedecor.modpath.."/locked.lua")
|
|
|
|
|
|
|
|
print("[HomeDecor] "..S("Loaded!"))
|