forked from minetest-mods/MoreMesecons
Wireless: remove legacy code.
This commit is contained in:
parent
8c8cdd38ff
commit
899ea4aa29
@ -388,44 +388,3 @@ if moremesecons.setting("wireless", "enable_lbm", false) then
|
|||||||
action = register_wireless
|
action = register_wireless
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Legacy
|
|
||||||
if storage and storage:get_string("wireless_rids") and storage:get_string("wireless_rids") ~= "" then
|
|
||||||
-- Upgrade mod storage!
|
|
||||||
local wireless_rids = minetest.deserialize(storage:get_string("wireless_rids"))
|
|
||||||
local old_wireless = table.copy(wireless)
|
|
||||||
wireless = {}
|
|
||||||
|
|
||||||
minetest.after(0, function(old_wireless)
|
|
||||||
-- After loading all mods, try to guess owners based on the areas mod database.
|
|
||||||
-- That won't work for all wireless. Owners of remaining wireless will be set
|
|
||||||
-- to the first player using their formspec.
|
|
||||||
if not areas then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
for RID, pos in ipairs(old_wireless) do
|
|
||||||
local numerous_owners = false
|
|
||||||
local owner
|
|
||||||
for _, area in pairs(areas:getAreasAtPos(pos)) do
|
|
||||||
if owner and area.owner ~= owner then
|
|
||||||
numerous_owners = true
|
|
||||||
break
|
|
||||||
end
|
|
||||||
owner = area.owner
|
|
||||||
end
|
|
||||||
|
|
||||||
if not numerous_owners and owner then
|
|
||||||
set_owner(pos, owner)
|
|
||||||
set_channel(pos, minetest.get_meta(pos):get_string("channel"))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end, old_wireless)
|
|
||||||
|
|
||||||
-- Remove wireless_rids from storage
|
|
||||||
storage:from_table({
|
|
||||||
jammers = jammers,
|
|
||||||
wireless_meta = wireless_meta,
|
|
||||||
wireless = wireless
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
Loading…
Reference in New Issue
Block a user