1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-11-16 07:10:35 +01:00
homedecor_modpack/init.lua

108 lines
3.0 KiB
Lua
Raw Normal View History

2012-07-12 23:56:15 +02:00
-- Home Decor mod by VanessaE
-- 2013-03-17
2012-07-12 23:56:15 +02:00
--
-- 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.
2012-07-12 23:56:15 +02:00
--
-- The code for ovens, nightstands, refrigerators are basically modified
-- copies of the code for chests and furnaces.
2012-07-12 23:56:15 +02:00
--
-- License: LGPL 2.0 or higher
2012-07-12 23:56:15 +02:00
--
homedecor = {}
homedecor.disable_signs = minetest.setting_getbool("homedecor.disable_signs")
homedecor.debug = 0
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
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
2013-03-05 08:18:56 +01:00
-- debug
2012-07-12 23:56:15 +02:00
local dbg = function(s)
if homedecor.debug == 1 then
2012-07-12 23:56:15 +02:00
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
-- protection wrapper for 6d stuff
function homedecor.protect_and_rotate(itemstack, placer, pointed_thing)
if not homedecor.node_is_owned(pointed_thing.under, placer)
and not homedecor.node_is_owned(pointed_thing.above, placer) then
local keys=placer:get_player_control()
minetest.rotate_and_place(itemstack, placer, pointed_thing,
homedecor.expect_infinite_stacks, {invert_wall = keys.sneak})
end
return itemstack
end
-- load various other components
dofile(homedecor.modpath.."/ownership.lua")
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.."/signs_lib.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.."/furnaces.lua")
dofile(homedecor.modpath.."/nightstands.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")
2013-03-26 12:05:22 +01:00
dofile(homedecor.modpath.."/locked.lua")
2013-03-05 08:18:56 +01:00
print("[HomeDecor] "..S("Loaded!"))