2019-04-20 21:49:36 +02:00
|
|
|
-- Home Decor API/functions, and common textures and models
|
|
|
|
-- by VanessaE
|
2012-07-12 23:56:15 +02:00
|
|
|
|
2019-04-20 21:49:36 +02:00
|
|
|
local modpath = minetest.get_modpath("homedecor_common")
|
2013-10-09 18:47:22 +02:00
|
|
|
|
2017-08-12 23:52:29 +02:00
|
|
|
homedecor = {}
|
|
|
|
homedecor.modpath = modpath
|
2013-04-17 09:14:09 +02:00
|
|
|
|
2014-09-18 22:29:28 +02:00
|
|
|
-- 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 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
|
|
|
|
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
|
|
|
|
|
2017-01-25 10:22:28 +01:00
|
|
|
homedecor.plain_wood = { name = "homedecor_generic_wood_plain.png", color = 0xffa76820 }
|
|
|
|
homedecor.mahogany_wood = { name = "homedecor_generic_wood_plain.png", color = 0xff7d2506 }
|
|
|
|
homedecor.white_wood = "homedecor_generic_wood_plain.png"
|
|
|
|
homedecor.dark_wood = { name = "homedecor_generic_wood_plain.png", color = 0xff39240f }
|
|
|
|
homedecor.lux_wood = { name = "homedecor_generic_wood_luxury.png", color = 0xff643f23 }
|
2022-04-02 22:32:44 +02:00
|
|
|
homedecor.glass = "default_glass.png"
|
|
|
|
|
|
|
|
if not minetest.get_modpath("default") then
|
|
|
|
homedecor.glass =
|
|
|
|
"[combine:16x16:" ..
|
|
|
|
"0,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff:" ..
|
|
|
|
"0,0=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
|
|
|
|
"0,15=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
|
|
|
|
"15,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff"
|
|
|
|
end
|
2017-01-25 10:22:28 +01:00
|
|
|
|
|
|
|
homedecor.color_black = 0xff303030
|
|
|
|
homedecor.color_dark_grey = 0xff606060
|
|
|
|
homedecor.color_med_grey = 0xffa0a0a0
|
2015-08-19 22:37:45 +02:00
|
|
|
|
|
|
|
-- load different handler subsystems
|
2019-04-20 21:49:36 +02:00
|
|
|
dofile(modpath.."/nodeboxes.lua")
|
|
|
|
dofile(modpath.."/expansion.lua")
|
|
|
|
dofile(modpath.."/furnaces.lua")
|
|
|
|
dofile(modpath.."/inventory.lua")
|
2022-04-02 22:32:44 +02:00
|
|
|
dofile(modpath.."/materials.lua")
|
2019-04-20 21:49:36 +02:00
|
|
|
dofile(modpath.."/registration.lua")
|
|
|
|
dofile(modpath.."/water_particles.lua")
|
|
|
|
dofile(modpath.."/sit.lua")
|
2015-08-16 17:13:56 +02:00
|
|
|
dofile(modpath.."/crafts.lua")
|
2015-04-27 09:04:22 +02:00
|
|
|
|
2018-05-14 06:00:29 +02:00
|
|
|
if minetest.settings:get_bool("log_mod") then
|
2020-08-05 02:36:06 +02:00
|
|
|
minetest.log("action", "[HomeDecor API] Loaded!")
|
2018-05-14 06:00:29 +02:00
|
|
|
end
|