1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-12-23 08:20:21 +01:00

simplify init.lua a little

This commit is contained in:
Tim 2015-08-16 17:13:56 +02:00
parent 799a652c91
commit 45aef81f55

View File

@ -7,38 +7,19 @@
-- The code for ovens, nightstands, refrigerators are basically modified -- The code for ovens, nightstands, refrigerators are basically modified
-- copies of the code for chests and furnaces. -- copies of the code for chests and furnaces.
homedecor = {} local modpath = minetest.get_modpath("homedecor")
homedecor.debug = 0 homedecor = {
modpath = modpath,
-- detail level for roofing slopes and also cobwebs -- Boilerplate to support localized strings if intllib mod is installed.
gettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end,
homedecor.detail_level = 16 -- infinite stacks
expect_infinite_stacks = minetest.setting_getbool("creative_mode") and not minetest.get_modpath("unified_inventory")
homedecor.modpath = minetest.get_modpath("homedecor") }
-- Boilerplate to support localized strings if intllib mod is installed.
local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s 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 --table copy
function homedecor.table_copy(t) function homedecor.table_copy(t)
local nt = { }; local nt = { };
for k, v in pairs(t) do for k, v in pairs(t) do
@ -52,7 +33,6 @@ function homedecor.table_copy(t)
end end
-- Determine if the item being pointed at is the underside of a node (e.g a ceiling) -- 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) function homedecor.find_ceiling(itemstack, placer, pointed_thing)
-- most of this is copied from the rotate-and-place function in builtin -- most of this is copied from the rotate-and-place function in builtin
local unode = core.get_node_or_nil(pointed_thing.under) local unode = core.get_node_or_nil(pointed_thing.under)
@ -115,60 +95,60 @@ homedecor.dark_wood = "(homedecor_generic_wood_plain.png^[colorize:#140900:200)^
-- nodebox arithmetics and helpers -- nodebox arithmetics and helpers
-- (please keep non-generic nodeboxes with their node definition) -- (please keep non-generic nodeboxes with their node definition)
dofile(homedecor.modpath.."/handlers/nodeboxes.lua") dofile(modpath.."/handlers/nodeboxes.lua")
-- expand and unexpand decor -- expand and unexpand decor
dofile(homedecor.modpath.."/handlers/expansion.lua") dofile(modpath.."/handlers/expansion.lua")
-- register nodes that cook stuff -- register nodes that cook stuff
dofile(homedecor.modpath.."/handlers/furnaces.lua") dofile(modpath.."/handlers/furnaces.lua")
-- glue it all together into a registration function -- glue it all together into a registration function
dofile(homedecor.modpath.."/handlers/registration.lua") dofile(modpath.."/handlers/registration.lua")
-- some nodes have particle spawners -- some nodes have particle spawners
dofile(homedecor.modpath.."/handlers/water_particles.lua") dofile(modpath.."/handlers/water_particles.lua")
dofile(homedecor.modpath.."/handlers/sit.lua") dofile(modpath.."/handlers/sit.lua")
-- load various other components -- load various other components
dofile(homedecor.modpath.."/misc-nodes.lua") -- the catch-all for all misc nodes dofile(modpath.."/misc-nodes.lua") -- the catch-all for all misc nodes
dofile(homedecor.modpath.."/tables.lua") dofile(modpath.."/tables.lua")
dofile(homedecor.modpath.."/electronics.lua") dofile(modpath.."/electronics.lua")
dofile(homedecor.modpath.."/shutters.lua") dofile(modpath.."/shutters.lua")
dofile(homedecor.modpath.."/shingles.lua") dofile(modpath.."/shingles.lua")
dofile(homedecor.modpath.."/slopes.lua") dofile(modpath.."/slopes.lua")
dofile(homedecor.modpath.."/doors_and_gates.lua") dofile(modpath.."/doors_and_gates.lua")
dofile(homedecor.modpath.."/fences.lua") dofile(modpath.."/fences.lua")
dofile(homedecor.modpath.."/lighting.lua") dofile(modpath.."/lighting.lua")
dofile(homedecor.modpath.."/kitchen_appliances.lua") dofile(modpath.."/kitchen_appliances.lua")
dofile(homedecor.modpath.."/kitchen_furniture.lua") dofile(modpath.."/kitchen_furniture.lua")
dofile(homedecor.modpath.."/gastronomy.lua") dofile(modpath.."/gastronomy.lua")
dofile(homedecor.modpath.."/bathroom_furniture.lua") dofile(modpath.."/bathroom_furniture.lua")
dofile(homedecor.modpath.."/bathroom_sanitation.lua") dofile(modpath.."/bathroom_sanitation.lua")
dofile(homedecor.modpath.."/laundry.lua") dofile(modpath.."/laundry.lua")
dofile(homedecor.modpath.."/nightstands.lua") dofile(modpath.."/nightstands.lua")
dofile(homedecor.modpath.."/clocks.lua") dofile(modpath.."/clocks.lua")
dofile(homedecor.modpath.."/electrics.lua") dofile(modpath.."/electrics.lua")
dofile(homedecor.modpath.."/window_treatments.lua") dofile(modpath.."/window_treatments.lua")
dofile(homedecor.modpath.."/furniture.lua") dofile(modpath.."/furniture.lua")
dofile(homedecor.modpath.."/furniture_medieval.lua") dofile(modpath.."/furniture_medieval.lua")
dofile(homedecor.modpath.."/furniture_recipes.lua") dofile(modpath.."/furniture_recipes.lua")
dofile(homedecor.modpath.."/climate-control.lua") dofile(modpath.."/climate-control.lua")
dofile(homedecor.modpath.."/cobweb.lua") dofile(modpath.."/cobweb.lua")
dofile(homedecor.modpath.."/beds.lua") dofile(modpath.."/beds.lua")
dofile(homedecor.modpath.."/books.lua") dofile(modpath.."/books.lua")
dofile(homedecor.modpath.."/exterior.lua") dofile(modpath.."/exterior.lua")
dofile(homedecor.modpath.."/trash_cans.lua") dofile(modpath.."/trash_cans.lua")
dofile(homedecor.modpath.."/wardrobe.lua") dofile(modpath.."/wardrobe.lua")
dofile(homedecor.modpath.."/handlers/locked.lua") dofile(modpath.."/handlers/locked.lua")
dofile(homedecor.modpath.."/crafts.lua") dofile(modpath.."/crafts.lua")
print("[HomeDecor] "..S("Loaded!")) print("[HomeDecor] " .. homedecor.gettext("Loaded!"))