Fixed chunpos bug + faction broadcast name bug

This commit is contained in:
shamoanjac 2016-08-10 01:54:18 +02:00
parent 1326104d28
commit e5baf22d52

View File

@ -45,9 +45,6 @@ factions.Faction = {
} }
util = { util = {
coords2D_string = function(coords)
return coords.x..", "..coords.y
end
coords3D_string = function(coords) coords3D_string = function(coords)
return coords.x..", "..coords.y..", "..coords.z return coords.x..", "..coords.y..", "..coords.z
end end
@ -258,11 +255,11 @@ function factions.Faction.promote(self, member, rank)
self:on_promote(member) self:on_promote(member)
end end
function factions.Faction.broadcast(self, msg, sender) function factions.Faction.broadcast(self, msg, sender)
local message = "self.name> "..msg local message = self.name.."> "..msg
if sender then if sender then
message = sender.."@"..message message = sender.."@"..message
end end
message = "<"..message message = "Faction<"..message
for k, _ in pairs(self.players) do for k, _ in pairs(self.players) do
minetest.chat_send_player(k, message) minetest.chat_send_player(k, message)
end end
@ -280,10 +277,10 @@ function factions.Faction.on_player_join(self, player)
self:broadcast(player.." has joined this faction.") self:broadcast(player.." has joined this faction.")
end end
function factions.Faction.on_claim_chunk(self, pos) function factions.Faction.on_claim_chunk(self, pos)
self:broadcast("Chunk ("..util.coords2D_string(pos)..") has been claimed.") self:broadcast("Chunk ("..pos..") has been claimed.")
end end
function factions.Faction.on_unclaim_chunk(self, pos) function factions.Faction.on_unclaim_chunk(self, pos)
self:broadcast("Chunk ("..util.coords2D_string(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.")
@ -307,7 +304,7 @@ function factions.Faction.on_end_alliance(self, faction)
self:broadcast("This faction is no longer allied with "..faction.."!") self:broadcast("This faction is no longer allied with "..faction.."!")
end end
function factions.Faction.on_set_spawn(self) function factions.Faction.on_set_spawn(self)
self:broadcast("The faction spawn has been set to ("..util.coords2D_string(pos)..").") self:broadcast("The faction spawn has been set to ("..util.coords3D_string(pos)..").")
end end
function factions.Faction.on_add_rank(self, rank) function factions.Faction.on_add_rank(self, rank)
self:broadcast("The rank "..rank.." has been created with privileges: "..table.concat(self.rank[rank])) self:broadcast("The rank "..rank.." has been created with privileges: "..table.concat(self.rank[rank]))