simplify init.lua a little

This commit is contained in:
Tim 2015-08-16 17:13:56 +02:00
parent 799a652c91
commit 45aef81f55
1 changed files with 46 additions and 66 deletions

View File

@ -7,38 +7,19 @@
-- The code for ovens, nightstands, refrigerators are basically modified
-- 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
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
-- infinite stacks
expect_infinite_stacks = minetest.setting_getbool("creative_mode") and not minetest.get_modpath("unified_inventory")
}
--table copy
function homedecor.table_copy(t)
local nt = { };
for k, v in pairs(t) do
@ -52,7 +33,6 @@ function homedecor.table_copy(t)
end
-- 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)
@ -115,60 +95,60 @@ homedecor.dark_wood = "(homedecor_generic_wood_plain.png^[colorize:#140900:200)^
-- nodebox arithmetics and helpers
-- (please keep non-generic nodeboxes with their node definition)
dofile(homedecor.modpath.."/handlers/nodeboxes.lua")
dofile(modpath.."/handlers/nodeboxes.lua")
-- expand and unexpand decor
dofile(homedecor.modpath.."/handlers/expansion.lua")
dofile(modpath.."/handlers/expansion.lua")
-- register nodes that cook stuff
dofile(homedecor.modpath.."/handlers/furnaces.lua")
dofile(modpath.."/handlers/furnaces.lua")
-- glue it all together into a registration function
dofile(homedecor.modpath.."/handlers/registration.lua")
dofile(modpath.."/handlers/registration.lua")
-- some nodes have particle spawners
dofile(homedecor.modpath.."/handlers/water_particles.lua")
dofile(homedecor.modpath.."/handlers/sit.lua")
dofile(modpath.."/handlers/water_particles.lua")
dofile(modpath.."/handlers/sit.lua")
-- 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(modpath.."/misc-nodes.lua") -- the catch-all for all misc nodes
dofile(modpath.."/tables.lua")
dofile(modpath.."/electronics.lua")
dofile(modpath.."/shutters.lua")
dofile(modpath.."/shingles.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(homedecor.modpath.."/kitchen_furniture.lua")
dofile(homedecor.modpath.."/gastronomy.lua")
dofile(modpath.."/kitchen_appliances.lua")
dofile(modpath.."/kitchen_furniture.lua")
dofile(modpath.."/gastronomy.lua")
dofile(homedecor.modpath.."/bathroom_furniture.lua")
dofile(homedecor.modpath.."/bathroom_sanitation.lua")
dofile(modpath.."/bathroom_furniture.lua")
dofile(modpath.."/bathroom_sanitation.lua")
dofile(homedecor.modpath.."/laundry.lua")
dofile(modpath.."/laundry.lua")
dofile(homedecor.modpath.."/nightstands.lua")
dofile(homedecor.modpath.."/clocks.lua")
dofile(homedecor.modpath.."/electrics.lua")
dofile(modpath.."/nightstands.lua")
dofile(modpath.."/clocks.lua")
dofile(modpath.."/electrics.lua")
dofile(homedecor.modpath.."/window_treatments.lua")
dofile(modpath.."/window_treatments.lua")
dofile(homedecor.modpath.."/furniture.lua")
dofile(homedecor.modpath.."/furniture_medieval.lua")
dofile(homedecor.modpath.."/furniture_recipes.lua")
dofile(homedecor.modpath.."/climate-control.lua")
dofile(modpath.."/furniture.lua")
dofile(modpath.."/furniture_medieval.lua")
dofile(modpath.."/furniture_recipes.lua")
dofile(modpath.."/climate-control.lua")
dofile(homedecor.modpath.."/cobweb.lua")
dofile(homedecor.modpath.."/beds.lua")
dofile(homedecor.modpath.."/books.lua")
dofile(homedecor.modpath.."/exterior.lua")
dofile(homedecor.modpath.."/trash_cans.lua")
dofile(homedecor.modpath.."/wardrobe.lua")
dofile(modpath.."/cobweb.lua")
dofile(modpath.."/beds.lua")
dofile(modpath.."/books.lua")
dofile(modpath.."/exterior.lua")
dofile(modpath.."/trash_cans.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!"))