1
0
mirror of https://github.com/mt-mods/homedecor_modpack.git synced 2024-11-18 08:00:40 +01:00
homedecor_modpack/homedecor/init.lua

146 lines
4.4 KiB
Lua
Raw Normal View History

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
-- 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
2015-08-16 17:13:56 +02:00
local modpath = minetest.get_modpath("homedecor")
2015-08-16 17:13:56 +02:00
homedecor = {
modpath = modpath,
2015-08-16 17:13:56 +02:00
-- Boilerplate to support localized strings if intllib mod is installed.
gettext = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end,
2014-08-12 18:11:12 +02:00
2015-08-16 17:13:56 +02:00
-- infinite stacks
expect_infinite_stacks = minetest.setting_getbool("creative_mode") and not minetest.get_modpath("unified_inventory")
}
-- 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-05-15 10:45:21 +02:00
screwdriver = screwdriver or {}
homedecor.plain_wood = "homedecor_generic_wood_plain.png^"..
"(homedecor_generic_wood_boards_overlay.png^[colorize:#a7682020:100)"
homedecor.mahogany_wood = "(homedecor_generic_wood_plain.png^[colorize:#401010:125)^"..
"(homedecor_generic_wood_boards_overlay.png^[colorize:#66493880:200)"
homedecor.white_wood = "(homedecor_generic_wood_plain.png^[colorize:#e0f0ff:200)^"..
"(homedecor_generic_wood_boards_overlay.png^[colorize:#ffffff:200)"
homedecor.dark_wood = "(homedecor_generic_wood_plain.png^[colorize:#140900:200)^"..
"(homedecor_generic_wood_boards_overlay.png^[colorize:#21110180:180)"
-- nodebox arithmetics and helpers
-- (please keep non-generic nodeboxes with their node definition)
2015-08-16 17:13:56 +02:00
dofile(modpath.."/handlers/nodeboxes.lua")
-- expand and unexpand decor
2015-08-16 17:13:56 +02:00
dofile(modpath.."/handlers/expansion.lua")
-- register nodes that cook stuff
2015-08-16 17:13:56 +02:00
dofile(modpath.."/handlers/furnaces.lua")
-- glue it all together into a registration function
2015-08-16 17:13:56 +02:00
dofile(modpath.."/handlers/registration.lua")
-- some nodes have particle spawners
2015-08-16 17:13:56 +02:00
dofile(modpath.."/handlers/water_particles.lua")
dofile(modpath.."/handlers/sit.lua")
-- load various other components
2015-08-16 17:13:56 +02:00
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.."/roofing.lua")
dofile(modpath.."/foyer.lua")
2015-08-16 17:13:56 +02:00
dofile(modpath.."/doors_and_gates.lua")
2015-08-16 17:13:56 +02:00
dofile(modpath.."/fences.lua")
2015-08-16 17:13:56 +02:00
dofile(modpath.."/lighting.lua")
2015-08-16 17:13:56 +02:00
dofile(modpath.."/kitchen_appliances.lua")
dofile(modpath.."/kitchen_furniture.lua")
dofile(modpath.."/gastronomy.lua")
2015-08-16 17:13:56 +02:00
dofile(modpath.."/bathroom_furniture.lua")
dofile(modpath.."/bathroom_sanitation.lua")
dofile(modpath.."/bedroom.lua")
2015-08-16 17:13:56 +02:00
dofile(modpath.."/laundry.lua")
dofile(modpath.."/office.lua")
2015-08-16 17:13:56 +02:00
dofile(modpath.."/clocks.lua")
dofile(modpath.."/electrics.lua")
2015-08-16 17:13:56 +02:00
dofile(modpath.."/window_treatments.lua")
2015-08-16 17:13:56 +02:00
dofile(modpath.."/furniture.lua")
dofile(modpath.."/furniture_medieval.lua")
dofile(modpath.."/furniture_recipes.lua")
dofile(modpath.."/climate-control.lua")
2013-03-26 12:05:22 +01:00
2015-08-16 17:13:56 +02:00
dofile(modpath.."/cobweb.lua")
dofile(modpath.."/books.lua")
dofile(modpath.."/exterior.lua")
dofile(modpath.."/trash_cans.lua")
dofile(modpath.."/wardrobe.lua")
2015-08-16 17:13:56 +02:00
dofile(modpath.."/handlers/locked.lua")
2015-08-16 17:13:56 +02:00
dofile(modpath.."/crafts.lua")
2015-08-16 17:13:56 +02:00
print("[HomeDecor] " .. homedecor.gettext("Loaded!"))