2024-08-10 08:11:39 +02:00

56 lines
1.4 KiB
Lua

local HTHICK = 1/16 -- half pane thickness
lzr_panes = {}
function lzr_panes.register_pane(basename, def)
local groups
if def.groups then
groups = table.copy(def.groups)
else
groups = {}
end
groups.pane = 1
groups.laser_block = 1
groups.rotatable = 3
lzr_laser.register_element(basename .. "_flat", {
description = def.description,
drawtype = "mesh",
paramtype = "light",
is_ground_content = false,
sunlight_propagates = true,
inventory_image = def.inventory_image,
wield_image = def.wield_image,
paramtype2 = "facedir",
mesh_off = "lzr_panes_pane_on.obj",
mesh_on = "lzr_panes_pane_on.obj",
tiles_off = {
{ name = def.textures[3], backface_culling = true },
{ name = def.textures[2], backface_culling = true },
{ name = def.textures[1], backface_culling = true },
"blank.png", -- no laser
},
tiles_on = {
{ name = def.textures[3], backface_culling = true }, -- top+bottom sides
{ name = def.textures[2], backface_culling = true }, -- left+right sides
{ name = def.textures[1], backface_culling = true }, -- front+back
lzr_laser.LASER_TILE,
},
light_source_on = lzr_globals.LASER_GLOW,
groups = groups,
sounds = def.sounds,
use_texture_alpha = "blend",
selection_box = {
type = "fixed",
fixed = {{-1/2, -1/2, -HTHICK, 1/2, 1/2, HTHICK}},
},
collision_box = {
type = "fixed",
fixed = {{-1/2, -1/2, -HTHICK, 1/2, 1/2, HTHICK}},
},
}, { group = def.element_group } )
end