Fixed add_player() and on_create

This commit is contained in:
shamoanjac 2016-08-10 02:46:54 +02:00
parent 3ec12936d6
commit be791384bd

View File

@ -96,9 +96,9 @@ function factions.Faction.decrease_power(self, power)
end end
function factions.Faction.add_player(self, player, rank) function factions.Faction.add_player(self, player, rank)
self:on_player_join(player)
self.players[player] = rank or self.default_rank self.players[player] = rank or self.default_rank
factions.players[player] = self.name factions.players[player] = self.name
self:on_player_join(player)
self.invited_players[player] = nil self.invited_players[player] = nil
factions.save() factions.save()
end end
@ -268,7 +268,7 @@ end
-------------------------- --------------------------
-- callbacks for events -- -- callbacks for events --
function factions.Faction.on_create(self) --! @brief called when the faction is added to the global faction list function factions.Faction.on_create(self) --! @brief called when the faction is added to the global faction list
minetest.chat_send_all("Faction "..self.name" has been created.") minetest.chat_send_all("Faction "..self.name.." has been created.")
end end
function factions.Faction.on_player_leave(self, player) function factions.Faction.on_player_leave(self, player)
self:broadcast(player.." has left this faction.") self:broadcast(player.." has left this faction.")
@ -283,7 +283,7 @@ function factions.Faction.on_unclaim_chunk(self, pos)
self:broadcast("Chunk ("..pos..") has been unclaimed.") self:broadcast("Chunk ("..pos..") has been unclaimed.")
end end
function factions.Faction.on_disband(self, pos) function factions.Faction.on_disband(self, pos)
minetest.chat_send_all("Faction "..self.name.."has been disbanded.") minetest.chat_send_all("Faction "..self.name.." has been disbanded.")
end end
function factions.Faction.on_new_leader(self) function factions.Faction.on_new_leader(self)
self:broadcast(self.leader.." is now the leader of this faction.") self:broadcast(self.leader.." is now the leader of this faction.")