2024-08-12 16:07:59 +02:00

345 lines
10 KiB
Lua

local S = minetest.get_translator("lzr_core")
minetest.register_node("lzr_core:stone", {
description = S("Stone"),
tiles = {"default_stone.png"},
groups = { breakable = 1 },
sounds = lzr_sounds.node_sound_stone_defaults(),
})
minetest.register_node("lzr_core:seabed", {
description = S("Seabed"),
tiles = {"lzr_core_seabed.png"},
groups = { breakable = 1 },
sounds = lzr_sounds.node_sound_sand_defaults(),
})
minetest.register_node("lzr_core:sand", {
description = S("Sand"),
tiles = {"default_sand.png"},
groups = { breakable = 1 },
sounds = lzr_sounds.node_sound_sand_defaults(),
})
minetest.register_node("lzr_core:dirt", {
description = S("Dirt"),
tiles = {"default_dirt.png"},
groups = { breakable = 1 },
sounds = lzr_sounds.node_sound_dirt_defaults(),
})
minetest.register_node("lzr_core:dirt_with_grass", {
description = S("Dirt with Grass"),
tiles = {"default_grass.png", "default_dirt.png",
{name = "default_dirt.png^default_grass_side.png", tileable_vertical = false}},
groups = { breakable = 1 },
sounds = lzr_sounds.node_sound_dirt_defaults({
footstep = { name = "lzr_sounds_footstep_grass", gain = 0.4 },
}),
})
minetest.register_node("lzr_core:dirt_with_jungle_litter", {
description = S("Dirt with Jungle Litter"),
tiles = {"default_rainforest_litter.png", "default_dirt.png",
{name = "default_dirt.png^default_rainforest_litter_side.png", tileable_vertical = false}},
groups = { breakable = 1 },
sounds = lzr_sounds.node_sound_dirt_defaults({
footstep = { name = "lzr_sounds_footstep_jungle_litter", gain = 0.4 },
}),
})
minetest.register_node("lzr_core:shrub_leaves", {
description = S("Shrub Leaves"),
paramtype = "light",
drawtype = "allfaces",
tiles = {"lzr_core_shrub_leaves.png"},
use_texture_alpha = "clip",
groups = { breakable = 1 },
sounds = lzr_sounds.node_sound_leaves_defaults(),
is_ground_content = false,
})
local palm_leaves = {
{ "bright_palm_leaves", S("Bright Palm Leaves"), "lzr_core_palm_leaves_top.png", "lzr_core_palm_leaves.png" },
{ "dark_palm_leaves", S("Dark Palm Leaves"), "lzr_core_palm_leaves_dark_top.png", "lzr_core_palm_leaves_dark.png" },
}
for p=1, #palm_leaves do
local id = palm_leaves[p][1]
local desc = palm_leaves[p][2]
local tex1 = palm_leaves[p][3]
local tex2 = palm_leaves[p][4]
lzr_laser.register_element("lzr_core:"..id, {
description = desc,
paramtype = "light",
drawtype = "mesh",
mesh_off = "lzr_core_palm_leaves_laser.obj",
mesh_on = "lzr_core_palm_leaves_laser.obj",
collision_box = {
type = "fixed",
fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
},
tiles_off = {
{name = tex1, backface_culling = false},
"blank.png",
{name = tex2, backface_culling = false},
},
tiles_on = {
{name = tex1, backface_culling = false},
lzr_laser.LASER_TILE,
{name = tex2, backface_culling = false},
},
light_source_on = lzr_globals.LASER_GLOW,
use_texture_alpha = "blend",
groups = { laser_block = 1, breakable = 1, },
sounds = lzr_sounds.node_sound_leaves_defaults(),
is_ground_content = false,
}, { group = "palm_leaves" } )
end
minetest.register_node("lzr_core:tree", {
description = S("Tree Trunk"),
tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = { breakable = 1, rotatable = 3 },
sounds = lzr_sounds.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
minetest.register_node("lzr_core:palm_tree", {
description = S("Palm Tree Trunk"),
tiles = {"lzr_core_palm_tree_top.png", "lzr_core_palm_tree_top.png", "lzr_core_palm_tree.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = { breakable = 1, rotatable = 3 },
sounds = lzr_sounds.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
minetest.register_node("lzr_core:coconut_tree", {
description = S("Coconut Tree Trunk"),
tiles = {"coconut_tree_top.png", "coconut_tree_top.png", "coconut_tree.png"},
paramtype2 = "facedir",
is_ground_content = false,
groups = { breakable = 1, rotatable = 3 },
sounds = lzr_sounds.node_sound_wood_defaults(),
on_place = minetest.rotate_node
})
minetest.register_node("lzr_core:coconut", {
description = S("Coconut"),
paramtype2 = "facedir",
tiles = {"coconut_top.png","coconut.png"},
groups = { breakable = 1, rotatable = 3 },
sounds = lzr_sounds.node_sound_wood_defaults(),
})
minetest.register_node("lzr_core:wood", {
description = S("Wood Planks"),
tiles = {"default_wood.png"},
is_ground_content = false,
groups = { breakable = 1 },
sounds = lzr_sounds.node_sound_wood_defaults(),
})
minetest.register_node("lzr_core:wood_mossy", {
description = S("Mossy Wood Planks"),
tiles = {"lzr_core_wood_mossy.png"},
is_ground_content = false,
groups = { breakable = 1 },
sounds = lzr_sounds.node_sound_wood_defaults(),
})
minetest.register_node("lzr_core:palm_wood", {
description = S("Palm Wood Planks"),
tiles = {"lzr_core_palm_wood.png"},
is_ground_content = false,
groups = { breakable = 1 },
sounds = lzr_sounds.node_sound_wood_defaults(),
})
minetest.register_node("lzr_core:coconut_wood", {
description = S("Coconut Wood Planks"),
tiles = {"lzr_core_coconut_wood.png"},
is_ground_content = false,
groups = { breakable = 1 },
sounds = lzr_sounds.node_sound_wood_defaults(),
})
-- A full non-waving block of water.
-- The laser will just be blocked when it hits water,
-- this is intentional. We don't support "lasers through
-- liquids".
-- Unlike in other games, water is completely static.
-- Water does NOT flow, there is NO flowing water node.
-- Laser-compatible, so it can be used in levels.
minetest.register_node("lzr_core:water_source", {
description = S("Water Source"),
drawtype = "liquid",
-- Intentionally not waving to be laser-compatible
waving = 0,
tiles = {
{
name = "default_water_source_animated.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
{
name = "default_water_source_animated.png",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
use_texture_alpha = "blend",
pointable = false,
paramtype = "light",
walkable = false,
buildable_to = false,
is_ground_content = false,
liquidtype = "source",
liquid_range = 0,
liquid_renewable = false,
liquid_alternative_flowing = "lzr_core:water_source",
liquid_alternative_source = "lzr_core:water_source",
liquid_viscosity = 1,
move_resistance = 1,
liquid_range = 0,
liquid_renewable = false,
liquids_pointable = true,
post_effect_color = {a = 128, r = 17, g = 69, b = 135},
groups = {water = 3, liquid = 3},
sounds = lzr_sounds.node_sound_water_defaults(),
})
-- Mostly the same as lzr_core:water_source except it waves.
-- Intended to be used by the mapgen.
-- This makes it laser-incompatible tho and should
-- not be used in levels.
minetest.register_node("lzr_core:ocean_water_source", {
description = S("Ocean Water Source"),
drawtype = "liquid",
waving = 3,
tiles = {
{
name = "default_water_source_animated.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
{
name = "default_water_source_animated.png",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
use_texture_alpha = "blend",
pointable = false,
paramtype = "light",
walkable = false,
buildable_to = false,
is_ground_content = false,
liquidtype = "source",
liquid_range = 0,
liquid_renewable = false,
liquid_alternative_flowing = "lzr_core:ocean_water_source",
liquid_alternative_source = "lzr_core:ocean_water_source",
liquid_viscosity = 1,
liquid_renewable = false,
liquids_pointable = true,
-- More opaque than the normal water
post_effect_color = {a = 192, r = 17, g = 69, b = 135},
groups = {water = 3, liquid = 3, laser_incompatible = 1, not_in_creative_inventory = 1},
sounds = lzr_sounds.node_sound_water_defaults(),
drop = "",
})
-- For invisible level borders
minetest.register_node("lzr_core:barrier", {
description = S("Barrier"),
drawtype = "airlike",
paramtype = "light",
sunlight_propagates = true,
walkable = true,
wield_image = "lzr_core_barrier.png",
inventory_image = "lzr_core_barrier.png",
groups = { breakable = 1, not_in_creative_inventory = 1 },
is_ground_content = false,
-- Prevent building things on the barrier
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
return itemstack
end,
})
-- Rain membrane corner position
local RMC = 0.25
-- Rain membrane offset (a tiny value);
-- determines the X/Z size of the columns
local RMO = 0.01
-- HACK: A node that lets rain through (mostly)
-- but not the player. This node can be used as a
-- level ceiling for rainy levels.
minetest.register_node("lzr_core:rain_membrane", {
description = S("Rain Membrane"),
drawtype = "airlike",
paramtype = "light",
sunlight_propagates = true,
walkable = true,
wield_image = "lzr_core_rain_membrane.png",
inventory_image = "lzr_core_rain_membrane.png",
groups = { breakable = 1, not_in_creative_inventory = 1 },
-- The collision box is made of 4 very thin columns,
-- equally spaced apart. This is enough to prevent the player
-- from moving through it vertically, assuming the player collisionbox is
-- larger than the space between the columns (which is roughly
-- RMO times 2).
-- Because the columns are so thin, they leave enough space
-- for most rain particles to go through, except for the few unlucky ones
-- that directly hit the columns (but this is rare).
collision_box = {
type = "fixed",
fixed = {
{ -RMC-RMO, -0.5, -RMC-RMO, -RMC+RMO, 0.5, -RMC+RMO }, -- (-1,-1)
{ -RMC-RMO, -0.5, RMC-RMO, -RMC+RMO, 0.5, RMC+RMO }, -- (-1, 1)
{ RMC-RMO, -0.5, -RMC-RMO, RMC+RMO, 0.5, -RMC+RMO }, -- ( 1,-1)
{ RMC-RMO, -0.5, RMC-RMO, RMC+RMO, 0.5, RMC+RMO }, -- ( 1, 1)
},
},
selection_box = {
type = "regular",
},
is_ground_content = false,
-- Prevent building things on the rain membrane
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
return itemstack
end,
})