2020-09-28 00:39:57 +02:00
|
|
|
local S = minetest.get_translator("morelights_extras")
|
|
|
|
|
|
|
|
|
2018-11-23 00:08:40 +01:00
|
|
|
minetest.register_node("morelights_extras:f_block", {
|
2020-09-28 00:39:57 +02:00
|
|
|
description = S("Futuristic Light Block"),
|
2020-09-15 06:36:35 +02:00
|
|
|
tiles = {"morelights_extras_f_block.png"},
|
|
|
|
paramtype = "light",
|
2020-09-28 00:39:57 +02:00
|
|
|
light_source = minetest.LIGHT_MAX,
|
|
|
|
groups = {cracky = 2, oddly_breakable_by_hand = 3, handy = 1},
|
|
|
|
_mcl_hardness = 0.3,
|
|
|
|
sounds = morelights.sounds.glass
|
2018-11-23 00:08:40 +01:00
|
|
|
})
|
|
|
|
|
2020-09-28 00:39:57 +02:00
|
|
|
do
|
|
|
|
local def = {
|
|
|
|
description = S("Grass Light"),
|
|
|
|
tiles = {
|
|
|
|
"default_grass.png^morelights_extras_blocklight.png",
|
|
|
|
"default_dirt.png",
|
|
|
|
"default_dirt.png^default_grass_side.png"
|
|
|
|
},
|
|
|
|
paramtype = "light",
|
|
|
|
light_source = 12,
|
2021-08-06 23:52:57 +02:00
|
|
|
groups = {
|
|
|
|
cracky = 2,
|
|
|
|
oddly_breakable_by_hand = 3,
|
|
|
|
handy = 1,
|
|
|
|
soil = 1,
|
|
|
|
},
|
2020-09-28 00:39:57 +02:00
|
|
|
_mcl_hardness = 0.3,
|
|
|
|
sounds = morelights.sounds.glass
|
|
|
|
}
|
2018-11-23 00:08:40 +01:00
|
|
|
|
2020-09-28 00:39:57 +02:00
|
|
|
if morelights.game == "mineclone2" then
|
|
|
|
-- For MineClone 2, use node coloring to match environment.
|
|
|
|
-- See the mcl_core:dirt_with_grass definition in
|
|
|
|
-- ITEMS/mcl_core/nodes_base.lua.
|
2021-08-19 02:46:17 +02:00
|
|
|
def.tiles = {
|
|
|
|
"mcl_core_grass_block_top.png",
|
|
|
|
{name = "default_dirt.png", color = "#FFFFFF"}
|
|
|
|
}
|
|
|
|
def.overlay_tiles = {
|
|
|
|
{name = "morelights_extras_blocklight.png", color = "#FFFFFF"},
|
|
|
|
"",
|
|
|
|
{
|
|
|
|
name = "mcl_core_grass_block_side_overlay.png",
|
|
|
|
tileable_vertical = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
def.paramtype2 = "color"
|
|
|
|
def.palette = "mcl_core_palette_grass.png"
|
|
|
|
def.palette_index = 0
|
|
|
|
def.color = "#55aa60"
|
|
|
|
def.drop = "morelights_extras:dirt_with_grass"
|
|
|
|
|
|
|
|
def.on_construct = function(pos)
|
|
|
|
local node = minetest.get_node(pos)
|
|
|
|
if node.param2 == 0 then
|
|
|
|
local grass_node = mcl_core.get_grass_block_type(pos)
|
|
|
|
if grass_node.param2 ~= 0 then
|
|
|
|
minetest.set_node(pos, {
|
|
|
|
name = "morelights_extras:dirt_with_grass",
|
|
|
|
param2 = grass_node.param2
|
|
|
|
})
|
2020-09-28 00:39:57 +02:00
|
|
|
end
|
|
|
|
end
|
2021-08-10 10:14:38 +02:00
|
|
|
end
|
|
|
|
elseif morelights.game == "hades_revisited" then
|
2021-08-19 02:46:17 +02:00
|
|
|
-- For Hades Revisited, grass color is seasonal.
|
|
|
|
-- See hades_core/dirt.lua, ABM in hades_core/functions.lua.
|
|
|
|
def.tiles = {
|
|
|
|
"hades_core_grass_cover_colorable.png",
|
|
|
|
{name = "default_dirt.png", color = "#FFFFFF"},
|
|
|
|
}
|
|
|
|
def.overlay_tiles = {
|
|
|
|
{name = "morelights_extras_blocklight.png", color = "#FFFFFF"},
|
|
|
|
"",
|
|
|
|
{
|
|
|
|
name = "hades_core_grass_side_cover_colorable.png",
|
|
|
|
tileable_vertical = false
|
2021-08-10 10:14:38 +02:00
|
|
|
},
|
|
|
|
}
|
2021-08-19 02:46:17 +02:00
|
|
|
def.paramtype2 = "color"
|
|
|
|
def.palette = "hades_core_palette_grass.png"
|
|
|
|
def.palette_index = 0
|
|
|
|
def.color = "#acef6a"
|
|
|
|
-- To enable seasonal grass coloring.
|
|
|
|
def.groups.dirt_with_grass = 1
|
|
|
|
-- To prevent color retention on digging.
|
|
|
|
def.drop = "morelights_extras:dirt_with_grass"
|
|
|
|
|
|
|
|
def.on_place = function(itemstack, placer, pointed_thing)
|
|
|
|
local param2 = hades_core.get_seasonal_grass_color_param2()
|
|
|
|
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
2020-09-28 00:39:57 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_node("morelights_extras:dirt_with_grass", def)
|
|
|
|
end
|
|
|
|
|
|
|
|
do
|
|
|
|
local tile = "default_stone_block.png"
|
|
|
|
if morelights.game == "mineclone2" then
|
|
|
|
tile = "mcl_stairs_stone_slab_top.png"
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_node("morelights_extras:stone_block", {
|
|
|
|
description = S("Stone Block Light"),
|
|
|
|
tiles = {tile .. "^morelights_extras_blocklight.png"},
|
|
|
|
paramtype = "light",
|
|
|
|
light_source = 12,
|
|
|
|
groups = {cracky = 2, oddly_breakable_by_hand = 3, handy = 1},
|
|
|
|
_mcl_hardness = 0.3,
|
|
|
|
sounds = morelights.sounds.glass
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
do
|
|
|
|
local tile = "default_sandstone_block.png"
|
|
|
|
if morelights.game == "mineclone2" then
|
|
|
|
tile = "mcl_core_sandstone_smooth.png"
|
2021-08-10 10:14:38 +02:00
|
|
|
elseif morelights.game == "hades_revisited" then
|
|
|
|
tile = "default_sandstone.png"
|
2020-09-28 00:39:57 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_node("morelights_extras:sandstone_block", {
|
|
|
|
description = S("Sandstone Block Light"),
|
|
|
|
tiles = {tile .. "^morelights_extras_blocklight.png"},
|
|
|
|
paramtype = "light",
|
|
|
|
light_source = 12,
|
|
|
|
groups = {cracky = 2, oddly_breakable_by_hand = 3, handy = 1},
|
|
|
|
_mcl_hardness = 0.3,
|
|
|
|
sounds = morelights.sounds.glass
|
|
|
|
})
|
|
|
|
end
|
2018-11-23 00:08:40 +01:00
|
|
|
|
|
|
|
minetest.register_node("morelights_extras:stairlight", {
|
2020-09-28 00:39:57 +02:00
|
|
|
description = S("Stair Light (place on stairs)"),
|
2020-09-15 06:36:35 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-1/4, -13/16, -1/16, 1/4, -11/16, 0}
|
|
|
|
},
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-1/4, -13/16, -1/16, 1/4, -11/16, 0}
|
|
|
|
},
|
|
|
|
walkable = false,
|
|
|
|
tiles = {"morelights_metal_dark.png"},
|
|
|
|
overlay_tiles = {"", "morelights_extras_stairlight.png",
|
2020-09-19 00:48:22 +02:00
|
|
|
"", "", "morelights_extras_stairlight.png"},
|
2020-09-18 06:24:30 +02:00
|
|
|
inventory_image = "morelights_extras_stairlight_inv.png",
|
|
|
|
wield_image = "morelights_extras_stairlight_inv.png",
|
2020-09-15 06:36:35 +02:00
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
light_source = 10,
|
2020-09-28 00:39:57 +02:00
|
|
|
sunlight_propagates = true,
|
|
|
|
groups = {cracky = 2, oddly_breakable_by_hand = 3, handy = 1,
|
|
|
|
attached_node = 1},
|
|
|
|
_mcl_hardness = 0.15,
|
2020-09-15 06:36:35 +02:00
|
|
|
node_placement_prediction = "",
|
2020-09-28 00:39:57 +02:00
|
|
|
sounds = morelights.sounds.glass,
|
2018-11-23 00:08:40 +01:00
|
|
|
|
2020-09-15 06:36:35 +02:00
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
2020-09-28 00:39:57 +02:00
|
|
|
if pointed_thing.type ~= "node" then
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
|
|
|
|
-- See builtin/game/item.lua.
|
|
|
|
local node = minetest.get_node(pointed_thing.under)
|
2018-11-23 00:08:40 +01:00
|
|
|
|
2020-09-28 00:39:57 +02:00
|
|
|
if placer and not placer:get_player_control().sneak then
|
|
|
|
local def = minetest.registered_nodes[node.name]
|
|
|
|
if def and def.on_rightclick then
|
|
|
|
return def.on_rightclick(pointed_thing.under, node, placer,
|
|
|
|
itemstack, pointed_thing) or itemstack
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if node.param2 < 4
|
|
|
|
and (node.name:match("^stairs:stair_")
|
2022-10-27 20:52:33 +02:00
|
|
|
or node.name:match("^mcl_stairs:stair_")
|
2022-10-27 23:22:30 +02:00
|
|
|
or node.name:match("^hades_stairs:stair_")
|
|
|
|
or (minetest.get_item_group(node.name,"support_stairlight")>0)) then
|
2020-09-28 00:39:57 +02:00
|
|
|
-- Set `above` to the node actually above the stair, since that's
|
|
|
|
-- where the node is placed.
|
2021-08-19 02:46:17 +02:00
|
|
|
pointed_thing.above =
|
|
|
|
vector.add(pointed_thing.under, vector.new(0, 1, 0))
|
2020-09-28 00:39:57 +02:00
|
|
|
return minetest.item_place_node(itemstack, placer, pointed_thing,
|
|
|
|
node.param2)
|
2020-09-15 06:36:35 +02:00
|
|
|
end
|
2018-11-23 00:08:40 +01:00
|
|
|
|
2020-09-15 06:36:35 +02:00
|
|
|
return itemstack
|
|
|
|
end,
|
2018-11-23 00:08:40 +01:00
|
|
|
|
2020-09-28 00:39:57 +02:00
|
|
|
on_rotate = screwdriver.rotate_simple
|
2018-11-23 00:08:40 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Craft recipes
|
|
|
|
--
|
|
|
|
|
2020-09-19 00:16:40 +02:00
|
|
|
local a = morelights.craft_items
|
|
|
|
|
2018-11-23 00:08:40 +01:00
|
|
|
minetest.register_craft({
|
2020-09-15 06:36:35 +02:00
|
|
|
output = "morelights_extras:f_block",
|
|
|
|
recipe = {
|
2020-09-28 00:39:57 +02:00
|
|
|
{a.crystal_fragment, a.steel, a.crystal_fragment},
|
2020-09-19 00:16:40 +02:00
|
|
|
{a.glass_pane, "morelights:bulb", a.glass_pane},
|
2020-09-28 00:39:57 +02:00
|
|
|
{a.crystal_fragment, a.steel, a.crystal_fragment}
|
2020-09-15 06:36:35 +02:00
|
|
|
}
|
2018-11-23 00:08:40 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
2020-09-15 06:36:35 +02:00
|
|
|
output = "morelights_extras:dirt_with_grass",
|
|
|
|
recipe = {
|
2020-09-19 00:16:40 +02:00
|
|
|
{"", a.glass_pane, ""},
|
2020-09-15 06:36:35 +02:00
|
|
|
{"", "morelights:bulb", ""},
|
2020-09-19 00:16:40 +02:00
|
|
|
{a.grass, a.dirt, ""}
|
2020-09-15 06:36:35 +02:00
|
|
|
}
|
2018-11-23 00:08:40 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
2020-09-15 06:36:35 +02:00
|
|
|
output = "morelights_extras:stone_block",
|
|
|
|
recipe = {
|
2020-09-19 00:16:40 +02:00
|
|
|
{"", a.glass_pane, ""},
|
2020-09-15 06:36:35 +02:00
|
|
|
{"", "morelights:bulb", ""},
|
2020-09-19 00:16:40 +02:00
|
|
|
{"", a.stone_block, ""}
|
2020-09-15 06:36:35 +02:00
|
|
|
}
|
2018-11-23 00:08:40 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
2020-09-15 06:36:35 +02:00
|
|
|
output = "morelights_extras:sandstone_block",
|
|
|
|
recipe = {
|
2020-09-19 00:16:40 +02:00
|
|
|
{"", a.glass_pane, ""},
|
2020-09-15 06:36:35 +02:00
|
|
|
{"", "morelights:bulb", ""},
|
2020-09-19 00:16:40 +02:00
|
|
|
{"", a.sandstone_block, ""}
|
2020-09-15 06:36:35 +02:00
|
|
|
}
|
2018-11-23 00:08:40 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
2020-09-15 06:36:35 +02:00
|
|
|
output = "morelights_extras:stairlight",
|
|
|
|
recipe = {
|
2020-09-19 00:16:40 +02:00
|
|
|
{a.steel, "morelights:bulb", a.steel}
|
2020-09-15 06:36:35 +02:00
|
|
|
}
|
2018-11-23 00:08:40 +01:00
|
|
|
})
|