1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-10 00:43:27 +02:00
ComfyFactorio/maps/biter_battles_v2/chat.lua
2020-01-02 16:09:24 +01:00

33 lines
1.3 KiB
Lua

local Public = {}
----------share chat with player and spectator force-------------------
function Public.share(event)
if not event.message then return end
if not event.player_index then return end
local player = game.players[event.player_index]
local color = player.chat_color
if player.force.name == "north" then
game.forces.spectator.print(player.name .. " (north): ".. event.message, color)
game.forces.player.print(player.name .. " (north): ".. event.message, color)
end
if player.force.name == "south" then
game.forces.spectator.print(player.name .. " (south): ".. event.message, color)
game.forces.player.print(player.name .. " (south): ".. event.message, color)
end
if global.tournament_mode then return end
if player.force.name == "player" then
game.forces.north.print(player.name .. " (spawn): ".. event.message, color)
game.forces.south.print(player.name .. " (spawn): ".. event.message, color)
game.forces.spectator.print(player.name .. " (spawn): ".. event.message, color)
end
if player.force.name == "spectator" then
game.forces.north.print(player.name .. " (spectator): ".. event.message, color)
game.forces.south.print(player.name .. " (spectator): ".. event.message, color)
game.forces.player.print(player.name .. " (spectator): ".. event.message, color)
end
end
return Public