Fix transmissive mirror becoming fixed on update

master
Wuzzy 2022-03-15 23:02:32 +01:00
parent e222d6d732
commit 2bc668e241
1 changed files with 18 additions and 8 deletions

View File

@ -238,7 +238,12 @@ local register_element = function(subname, def, options)
local def_core_on
if options.activate ~= false then
if options.inactive then
def_core._lzr_inactive = options.inactive
if not options.keep_state_on_take then
def_core.drop = options.inactive
end
elseif options.activate ~= false then
def_core_on = table.copy(def_core)
if options.not_walkable_if_off then
def_core_on.walkable = true
@ -269,7 +274,12 @@ local register_element = function(subname, def, options)
def_takable.description = def.description
minetest.register_node("lzr_laser:"..subname.."_takable", def_takable)
if options.activate ~= false then
if options.inactive then
def_takable._lzr_inactive = options.inactive.."_takable"
if not options.keep_state_on_take then
def_takable.drop = options.inactive.."_takable"
end
elseif options.activate ~= false then
def_takable._lzr_active = "lzr_laser:"..subname.."_takable_on"
local def_takable_on = table.copy(def_core_on)
def_takable_on._lzr_untakable = "lzr_laser:"..subname.."_on"
@ -371,7 +381,6 @@ tm_def_off.mesh_off = "lzr_laser_mirror.obj"
-- Transmissive Mirror
-- FIXME: Takable Transmissive Mirror becomes fixed after full laser update
local tm_def_on_01 = table.copy(tm_def)
tm_def_on_01._lzr_transmissive_mirror_state = "01"
tm_def_on_01._lzr_inactive = "lzr_laser:transmissive_mirror_00"
@ -400,11 +409,12 @@ tm_def_on_11._lzr_transmissive_mirror_state = "11"
tm_def_on_11.description = S("Transmissive Mirror (active, 11)")
tm_def_on_11.mesh_off = "lzr_laser_mirror_on_thru3.obj"
local tm_options = { allow_take = true, activate = false, group = "transmissive_mirror" }
register_element("transmissive_mirror_00", tm_def_off, tm_options)
register_element("transmissive_mirror_01", tm_def_on_01, tm_options)
register_element("transmissive_mirror_10", tm_def_on_10, tm_options)
register_element("transmissive_mirror_11", tm_def_on_11, tm_options)
local tm_options_off = { allow_take = true, activate = false, group = "transmissive_mirror" }
local tm_options_on = { allow_take = true, activate = false, group = "transmissive_mirror", inactive = "lzr_laser:transmissive_mirror_00" }
register_element("transmissive_mirror_00", tm_def_off, tm_options_off)
register_element("transmissive_mirror_01", tm_def_on_01, tm_options_on)
register_element("transmissive_mirror_10", tm_def_on_10, tm_options_on)
register_element("transmissive_mirror_11", tm_def_on_11, tm_options_on)
register_element("crystal", {
description = S("Crystal"),