Remove: converter code
This commit is contained in:
parent
7bd84b4728
commit
a4a43aef2d
45
convert.lua
45
convert.lua
|
@ -1,45 +0,0 @@
|
|||
function ip_convert()
|
||||
local path = minetest.get_worldpath() .. "/factions_iplist.txt"
|
||||
local file, error = io.open(path, "r")
|
||||
|
||||
if file ~= nil then
|
||||
local raw_data = file:read("*a")
|
||||
local ips = minetest.deserialize(raw_data)
|
||||
file:close()
|
||||
|
||||
for i, k in pairs(ips) do
|
||||
factions.player_ips.set(i, k)
|
||||
end
|
||||
|
||||
os.rename(path, minetest.get_worldpath() .. "/factions_iplist_old.txt")
|
||||
end
|
||||
end
|
||||
|
||||
function faction_convert()
|
||||
local path = minetest.get_worldpath() .. "/factions.conf"
|
||||
local file, error = io.open(path, "r")
|
||||
|
||||
if file ~= nil then
|
||||
local raw_data = file:read("*a")
|
||||
local tabledata = minetest.deserialize(raw_data)
|
||||
file:close()
|
||||
|
||||
if tabledata then
|
||||
for facname, faction in pairs(tabledata) do
|
||||
factions.factions.set(facname, faction)
|
||||
|
||||
for player, rank in pairs(faction.players) do
|
||||
factions.players.set(player, facname)
|
||||
end
|
||||
|
||||
for parcelpos, val in pairs(faction.land) do
|
||||
factions.parcels.set(parcelpos, facname)
|
||||
end
|
||||
end
|
||||
os.rename(path, minetest.get_worldpath() .. "/factions_old.conf")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ip_convert()
|
||||
faction_convert()
|
1
init.lua
1
init.lua
|
@ -15,7 +15,6 @@ dofile (factions_modpath .. "/claim_events.lua")
|
|||
dofile (factions_modpath .. "/factions.lua")
|
||||
dofile (factions_modpath .. "/chatcommands.lua")
|
||||
dofile (factions_modpath .. "/nodes.lua")
|
||||
dofile (factions_modpath .. "/convert.lua")
|
||||
|
||||
minetest.after(1, hudUpdateClaimInfo)
|
||||
minetest.after(factions_config.tick_time, factionUpdate)
|
||||
|
|
17
nodes.lua
17
nodes.lua
|
@ -14,23 +14,6 @@ end
|
|||
|
||||
-- Make default chest the faction chest.
|
||||
if minetest.registered_nodes["default:chest"] then
|
||||
minetest.register_lbm({
|
||||
label = "Replace faction chest with default one.",
|
||||
name = "factions:replace_factions_chest",
|
||||
nodenames = {"factions:chest"},
|
||||
action = function(pos, node)
|
||||
minetest.swap_node(pos, {name = "default:chest"})
|
||||
local parcel_faction = factions.get_faction_at(pos)
|
||||
if parcel_faction then
|
||||
local meta = minetest.get_meta(pos)
|
||||
local name = parcel_faction.name
|
||||
meta:set_string("faction", name)
|
||||
meta:set_string("infotext", "Faction Chest (owned by faction " ..
|
||||
name .. ")")
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
local dc = minetest.registered_nodes["default:chest"]
|
||||
local def_on_rightclick = dc.on_rightclick
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user