Added possibility to explain a faction disband
This commit is contained in:
parent
417bbeee60
commit
a4f09c7d8e
12
factions.lua
12
factions.lua
|
@ -234,14 +234,14 @@ function factions.Faction.unclaim_parcel(self, parcelpos)
|
||||||
end
|
end
|
||||||
|
|
||||||
--! @brief disband faction, updates global players and parcels table
|
--! @brief disband faction, updates global players and parcels table
|
||||||
function factions.Faction.disband(self)
|
function factions.Faction.disband(self, reason)
|
||||||
for k, _ in pairs(self.players) do -- remove players affiliation
|
for k, _ in pairs(self.players) do -- remove players affiliation
|
||||||
factions.players[k] = nil
|
factions.players[k] = nil
|
||||||
end
|
end
|
||||||
for k, v in pairs(self.land) do -- remove parcel claims
|
for k, v in pairs(self.land) do -- remove parcel claims
|
||||||
factions.parcels[k] = nil
|
factions.parcels[k] = nil
|
||||||
end
|
end
|
||||||
self:on_disband()
|
self:on_disband(reason)
|
||||||
factions.factions[self.name] = nil
|
factions.factions[self.name] = nil
|
||||||
factions.save()
|
factions.save()
|
||||||
end
|
end
|
||||||
|
@ -451,8 +451,12 @@ function factions.Faction.on_unclaim_parcel(self, pos)
|
||||||
self:broadcast("Parcel ("..pos..") has been unclaimed.")
|
self:broadcast("Parcel ("..pos..") has been unclaimed.")
|
||||||
end
|
end
|
||||||
|
|
||||||
function factions.Faction.on_disband(self, pos)
|
function factions.Faction.on_disband(self, reason)
|
||||||
minetest.chat_send_all("Faction "..self.name.." has been disbanded.")
|
local msg = "Faction "..self.name.." has been disbanded."
|
||||||
|
if reason then
|
||||||
|
msg = msg.." ("..reason..")"
|
||||||
|
end
|
||||||
|
minetest.chat_send_all(msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
function factions.Faction.on_new_leader(self)
|
function factions.Faction.on_new_leader(self)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user