forked from nalc/homedecor_modpack
Added additional autoplace code for wall lights to turn them into ceiling
lights where appropriate. Added a number of alternate crafting recipes to split thick wall lights into thin regular ones or into cubes, and to recycle excess cubes.
This commit is contained in:
parent
0c0ee930f9
commit
d0c62410f8
50
crafts.lua
50
crafts.lua
|
@ -1177,6 +1177,13 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "homedecor:glowlight_thin_yellow 6",
|
||||
recipe = {
|
||||
{"homedecor:glowlight_thick_yellow_wall", "homedecor:glowlight_thick_yellow_wall", "homedecor:glowlight_thick_yellow_wall" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "homedecor:glowlight_small_cube_yellow 16",
|
||||
recipe = {
|
||||
|
@ -1185,6 +1192,20 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "homedecor:glowlight_small_cube_yellow 4",
|
||||
recipe = {
|
||||
{"homedecor:glowlight_thick_yellow" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "homedecor:glowlight_small_cube_yellow 4",
|
||||
recipe = {
|
||||
{"homedecor:glowlight_thick_yellow_wall" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "homedecor:glowlight_thick_yellow",
|
||||
recipe = {
|
||||
|
@ -1193,6 +1214,14 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "homedecor:glowlight_thick_yellow",
|
||||
recipe = {
|
||||
{"homedecor:glowlight_small_cube_yellow_ceiling","homedecor:glowlight_small_cube_yellow_ceiling"},
|
||||
{"homedecor:glowlight_small_cube_yellow_ceiling","homedecor:glowlight_small_cube_yellow_ceiling"}
|
||||
}
|
||||
})
|
||||
|
||||
-- white
|
||||
|
||||
minetest.register_craft({
|
||||
|
@ -1220,6 +1249,13 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "homedecor:glowlight_thin_white 6",
|
||||
recipe = {
|
||||
{"homedecor:glowlight_thick_white_wall", "homedecor:glowlight_thick_white_wall", "homedecor:glowlight_thick_white_wall" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "homedecor:glowlight_small_cube_white 8",
|
||||
recipe = {
|
||||
|
@ -1228,6 +1264,20 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "homedecor:glowlight_small_cube_white 4",
|
||||
recipe = {
|
||||
{"homedecor:glowlight_thick_white" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "homedecor:glowlight_small_cube_white 4",
|
||||
recipe = {
|
||||
{"homedecor:glowlight_thick_white_wall" },
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "homedecor:glowlight_thick_white",
|
||||
recipe = {
|
||||
|
|
156
lighting.lua
156
lighting.lua
|
@ -93,6 +93,32 @@ minetest.register_node('homedecor:glowlight_thick_yellow_wall', {
|
|||
groups = { snappy = 3, not_in_creative_inventory=1 },
|
||||
light_source = LIGHT_MAX,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
local node = minetest.env:get_node(pointed_thing.under)
|
||||
if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then
|
||||
|
||||
local above = pointed_thing.above
|
||||
local under = pointed_thing.under
|
||||
local pitch = placer:get_look_pitch()
|
||||
local node = minetest.env:get_node(above)
|
||||
|
||||
if node.name ~= "air" then return end
|
||||
|
||||
if above.x ~= under.x or above.z ~= under.z then
|
||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
minetest.env:add_node(above, {name = 'homedecor:glowlight_thick_yellow_wall', param2 = fdir})
|
||||
else
|
||||
minetest.env:add_node(above, {name = 'homedecor:glowlight_thick_yellow'})
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
else
|
||||
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
|
||||
end
|
||||
end,
|
||||
drop = 'homedecor:glowlight_thick_yellow'
|
||||
})
|
||||
|
||||
|
@ -176,6 +202,32 @@ minetest.register_node('homedecor:glowlight_thin_yellow_wall', {
|
|||
groups = { snappy = 3, not_in_creative_inventory=1 },
|
||||
light_source = LIGHT_MAX-1,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
local node = minetest.env:get_node(pointed_thing.under)
|
||||
if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then
|
||||
|
||||
local above = pointed_thing.above
|
||||
local under = pointed_thing.under
|
||||
local pitch = placer:get_look_pitch()
|
||||
local node = minetest.env:get_node(above)
|
||||
|
||||
if node.name ~= "air" then return end
|
||||
|
||||
if above.x ~= under.x or above.z ~= under.z then
|
||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
minetest.env:add_node(above, {name = 'homedecor:glowlight_thin_yellow_wall', param2 = fdir})
|
||||
else
|
||||
minetest.env:add_node(above, {name = 'homedecor:glowlight_thin_yellow'})
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
else
|
||||
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
|
||||
end
|
||||
end,
|
||||
drop = 'homedecor:glowlight_thin_yellow'
|
||||
})
|
||||
|
||||
|
@ -231,8 +283,6 @@ minetest.register_node('homedecor:glowlight_small_cube_yellow', {
|
|||
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
})
|
||||
|
||||
minetest.register_node('homedecor:glowlight_small_cube_yellow_ceiling', {
|
||||
|
@ -261,6 +311,31 @@ minetest.register_node('homedecor:glowlight_small_cube_yellow_ceiling', {
|
|||
groups = { snappy = 3, not_in_creative_inventory=1 },
|
||||
light_source = LIGHT_MAX-1,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
local node = minetest.env:get_node(pointed_thing.under)
|
||||
if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then
|
||||
|
||||
local above = pointed_thing.above
|
||||
local under = pointed_thing.under
|
||||
local pitch = placer:get_look_pitch()
|
||||
local node = minetest.env:get_node(above)
|
||||
|
||||
if node.name ~= "air" then return end
|
||||
|
||||
if above.x == under.x and above.z == under.z and pitch > 0 then
|
||||
minetest.env:add_node(above, {name = 'homedecor:glowlight_small_cube_white_ceiling'})
|
||||
else
|
||||
minetest.env:add_node(above, {name = 'homedecor:glowlight_small_cube_white'})
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
else
|
||||
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
|
||||
end
|
||||
end,
|
||||
drop = "homedecor:glowlight_small_cube_yellow",
|
||||
})
|
||||
|
||||
|
@ -346,6 +421,32 @@ minetest.register_node('homedecor:glowlight_thick_white_wall', {
|
|||
groups = { snappy = 3, not_in_creative_inventory=1 },
|
||||
light_source = LIGHT_MAX,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
local node = minetest.env:get_node(pointed_thing.under)
|
||||
if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then
|
||||
|
||||
local above = pointed_thing.above
|
||||
local under = pointed_thing.under
|
||||
local pitch = placer:get_look_pitch()
|
||||
local node = minetest.env:get_node(above)
|
||||
|
||||
if node.name ~= "air" then return end
|
||||
|
||||
if above.x ~= under.x or above.z ~= under.z then
|
||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
minetest.env:add_node(above, {name = 'homedecor:glowlight_thick_white_wall', param2 = fdir})
|
||||
else
|
||||
minetest.env:add_node(above, {name = 'homedecor:glowlight_thick_white'})
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
else
|
||||
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
|
||||
end
|
||||
end,
|
||||
drop = 'homedecor:glowlight_thick_white'
|
||||
})
|
||||
|
||||
|
@ -429,6 +530,32 @@ minetest.register_node('homedecor:glowlight_thin_white_wall', {
|
|||
groups = { snappy = 3, not_in_creative_inventory=1 },
|
||||
light_source = LIGHT_MAX-1,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
local node = minetest.env:get_node(pointed_thing.under)
|
||||
if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then
|
||||
|
||||
local above = pointed_thing.above
|
||||
local under = pointed_thing.under
|
||||
local pitch = placer:get_look_pitch()
|
||||
local node = minetest.env:get_node(above)
|
||||
|
||||
if node.name ~= "air" then return end
|
||||
|
||||
if above.x ~= under.x or above.z ~= under.z then
|
||||
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
minetest.env:add_node(above, {name = 'homedecor:glowlight_thin_white_wall', param2 = fdir})
|
||||
else
|
||||
minetest.env:add_node(above, {name = 'homedecor:glowlight_thin_white'})
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
else
|
||||
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
|
||||
end
|
||||
end,
|
||||
drop = 'homedecor:glowlight_thin_white'
|
||||
})
|
||||
|
||||
|
@ -511,5 +638,30 @@ minetest.register_node('homedecor:glowlight_small_cube_white_ceiling', {
|
|||
groups = { snappy = 3, not_in_creative_inventory=1 },
|
||||
light_source = LIGHT_MAX-1,
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
|
||||
local node = minetest.env:get_node(pointed_thing.under)
|
||||
if not minetest.registered_nodes[node.name] or not minetest.registered_nodes[node.name].on_rightclick then
|
||||
|
||||
local above = pointed_thing.above
|
||||
local under = pointed_thing.under
|
||||
local pitch = placer:get_look_pitch()
|
||||
local node = minetest.env:get_node(above)
|
||||
|
||||
if node.name ~= "air" then return end
|
||||
|
||||
if above.x == under.x and above.z == under.z and pitch > 0 then
|
||||
minetest.env:add_node(above, {name = 'homedecor:glowlight_small_cube_white_ceiling'})
|
||||
else
|
||||
minetest.env:add_node(above, {name = 'homedecor:glowlight_small_cube_white'})
|
||||
end
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
return minetest.item_place_node(itemstack, placer, pointed_thing)
|
||||
else
|
||||
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer)
|
||||
end
|
||||
end,
|
||||
drop = "homedecor:glowlight_small_cube_white",
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue
Block a user