Fix: factions crashes on tick

This commit is contained in:
Coder12a 2019-02-05 14:46:55 -06:00
parent dd88c61009
commit 464d68e6d9

View File

@ -500,7 +500,7 @@ function factions.disband(name, reason)
if not faction.is_admin then if not faction.is_admin then
for i, v in pairs(factions.get_faction_list()) do for i, v in pairs(factions.get_faction_list()) do
local fac = factions.factions.get(v) local fac = factions.factions.get(v)
if fac.name ~= name then if fac ~= nil and fac.name ~= name then
if fac.enemies[name] then if fac.enemies[name] then
factions.end_enemy(fac.name, name) factions.end_enemy(fac.name, name)
end end
@ -1125,6 +1125,8 @@ function factions.faction_tick()
local now = os.time() local now = os.time()
for i, facname in pairs(factions.get_faction_list()) do for i, facname in pairs(factions.get_faction_list()) do
local faction = factions.factions.get(facname) local faction = factions.factions.get(facname)
if faction ~= nil then
if factions.is_online(facname) then if factions.is_online(facname) then
if factions_config.enable_power_per_player then if factions_config.enable_power_per_player then
local count = 0 local count = 0
@ -1144,6 +1146,7 @@ function factions.faction_tick()
factions.disband(facname, r) factions.disband(facname, r)
end end
end end
end
end end
minetest.register_on_joinplayer( minetest.register_on_joinplayer(