fix v1 transition bugs
This commit is contained in:
parent
7541677c28
commit
da15e05496
@ -357,7 +357,7 @@ local function on_receive_fields(pos, formname, fields, player)
|
||||
end
|
||||
local meta = M(pos)
|
||||
local crd = CRD(pos)
|
||||
local filter = minetest.deserialize(meta:get_string("filter"))
|
||||
local filter = minetest.deserialize(meta:get_string("filter")) or {false,false,false,false}
|
||||
if fields.filter1 ~= nil then
|
||||
filter[1] = fields.filter1 == "true"
|
||||
elseif fields.filter2 ~= nil then
|
||||
@ -385,7 +385,7 @@ end
|
||||
local function change_filter_settings(pos, slot, val)
|
||||
local slots = {["red"] = 1, ["green"] = 2, ["blue"] = 3, ["yellow"] = 4}
|
||||
local meta = M(pos)
|
||||
local filter = minetest.deserialize(meta:get_string("filter"))
|
||||
local filter = minetest.deserialize(meta:get_string("filter")) or {false,false,false,false}
|
||||
local num = slots[slot] or 1
|
||||
if num >= 1 and num <= 4 then
|
||||
filter[num] = val == "on"
|
||||
@ -402,7 +402,7 @@ end
|
||||
-- techage command to read filter channel status (on/off)
|
||||
local function read_filter_settings(pos, slot)
|
||||
local slots = {["red"] = 1, ["green"] = 2, ["blue"] = 3, ["yellow"] = 4}
|
||||
local filter = minetest.deserialize(M(pos):get_string("filter"))
|
||||
local filter = minetest.deserialize(M(pos):get_string("filter")) or {false,false,false,false}
|
||||
return filter[slots[slot]] and "on" or "off"
|
||||
end
|
||||
|
||||
|
25
basis/legacy.lua
Normal file
25
basis/legacy.lua
Normal file
@ -0,0 +1,25 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019-2021 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
For the transition from v0.26 to v1.0
|
||||
|
||||
]]--
|
||||
|
||||
function techage.register_node_for_v1_transition(nodenames, on_node_load)
|
||||
minetest.register_lbm({
|
||||
label = "[TechAge] V1 transition",
|
||||
name = nodenames[1].."transition",
|
||||
nodenames = nodenames,
|
||||
run_at_every_load = false,
|
||||
action = function(pos, node)
|
||||
on_node_load(pos, node)
|
||||
end
|
||||
})
|
||||
end
|
3
init.lua
3
init.lua
@ -89,6 +89,7 @@ dofile(MP.."/basis/recipe_lib.lua")
|
||||
dofile(MP.."/basis/formspec_update.lua")
|
||||
dofile(MP.."/basis/windturbine_lib.lua")
|
||||
dofile(MP.."/basis/laser_lib.lua")
|
||||
dofile(MP.."/basis/legacy.lua")
|
||||
|
||||
-- Main doc
|
||||
dofile(MP.."/doc/manual_DE.lua")
|
||||
@ -154,7 +155,7 @@ dofile(MP.."/liquids/pipe_wall_entry.lua")
|
||||
dofile(MP.."/basic_machines/consumer.lua") -- consumer base model
|
||||
dofile(MP.."/basic_machines/source.lua")
|
||||
dofile(MP.."/basic_machines/pusher.lua")
|
||||
dofile(MP.."/basic_machines/legacy_nodes.lua")
|
||||
dofile(MP.."/basic_machines/foreign_nodes.lua")
|
||||
dofile(MP.."/basic_machines/mods_support.lua")
|
||||
dofile(MP.."/basic_machines/grinder.lua")
|
||||
dofile(MP.."/basic_machines/distributor.lua")
|
||||
|
@ -177,5 +177,8 @@ function techage.register_lamp(basename, ndef_off, ndef_on)
|
||||
minetest.register_node(basename.."_on", ndef_on)
|
||||
|
||||
power.register_nodes({basename.."_off", basename.."_on"}, Cable, "con")
|
||||
techage.register_node_for_v1_transition({basename.."_off", basename.."_on"}, function(pos, node)
|
||||
power.update_network(pos, nil, Cable)
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -248,3 +248,7 @@ minetest.register_craft({
|
||||
{'default:steel_ingot', "techage:baborium_ingot", 'default:steel_ingot'},
|
||||
},
|
||||
})
|
||||
|
||||
techage.register_node_for_v1_transition({"techage:ta4_solar_inverter"}, function(pos, node)
|
||||
power.update_network(pos, nil, Solar)
|
||||
end)
|
||||
|
Loading…
Reference in New Issue
Block a user