forked from mtcontrib/factions
Fix: crashing
This commit is contained in:
parent
b504eb6794
commit
dbe7f4aabd
@ -330,10 +330,10 @@ factions.register_command("list", {
|
||||
infaction = false,
|
||||
global_privileges = def_global_privileges,
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
local list = factions.factions.iterate()
|
||||
local list = factions.factions.to_array()
|
||||
local tosend = "Existing factions:"
|
||||
|
||||
for i,v in ipairs(list) do
|
||||
for i, v in ipairs(list) do
|
||||
if i ~= #list then
|
||||
tosend = tosend .. " " .. v .. ","
|
||||
else
|
||||
@ -1525,7 +1525,7 @@ factions.register_command("obliterate", {
|
||||
infaction = false,
|
||||
global_privileges = {"faction_admin"},
|
||||
on_success = function(player, faction, pos, parcelpos, args)
|
||||
for i, facname in factions.factions.iterate() do
|
||||
for facname, i in factions.factions.iterate() do
|
||||
factions.disband(facname, "obliterated")
|
||||
end
|
||||
return true
|
||||
|
@ -1,13 +1,13 @@
|
||||
function factions.start_diplomacy(name, faction)
|
||||
for l, i in factions.factions.iterate() do
|
||||
local fac = factions.factions.get(i)
|
||||
if i ~= name and not (faction.neutral[i] or faction.allies[i] or faction.enemies[i]) then
|
||||
local fac = factions.factions.get(l)
|
||||
if l ~= name and not (faction.neutral[l] or faction.allies[l] or faction.enemies[l]) then
|
||||
if factions_config.faction_diplomacy == true then
|
||||
factions.new_neutral(name, i)
|
||||
factions.new_neutral(i, name)
|
||||
factions.new_neutral(name, l)
|
||||
factions.new_neutral(l, name)
|
||||
else
|
||||
factions.new_enemy(name, i)
|
||||
factions.new_enemy(i, name)
|
||||
factions.new_enemy(name, l)
|
||||
factions.new_enemy(l, name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -142,7 +142,7 @@ function factions.set_name(oldname, name)
|
||||
local faction = factions.factions.get(oldname)
|
||||
faction.name = name
|
||||
|
||||
for i, v in factions.factions.iterate() do
|
||||
for v, i in factions.factions.iterate() do
|
||||
if v ~= oldname then
|
||||
local fac = factions.factions.get(v)
|
||||
|
||||
@ -301,7 +301,7 @@ function factions.disband(name, reason)
|
||||
local faction = factions.factions.get(name)
|
||||
|
||||
if not faction.is_admin then
|
||||
for i, v in factions.factions.iterate() do
|
||||
for v, i in factions.factions.iterate() do
|
||||
local fac = factions.factions.get(v)
|
||||
if fac ~= nil and fac.name ~= name then
|
||||
if fac.enemies[name] then
|
||||
@ -496,7 +496,7 @@ end
|
||||
|
||||
function factions.faction_tick()
|
||||
local now = os.time()
|
||||
for i, facname in factions.factions.iterate() do
|
||||
for facname, i in factions.factions.iterate() do
|
||||
local faction = factions.factions.get(facname)
|
||||
|
||||
if faction ~= nil then
|
||||
|
Loading…
Reference in New Issue
Block a user