1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2024-12-14 10:13:13 +02:00
RedMew/map_gen/maps/quadrants/all_chat.lua
2019-03-02 16:11:16 +01:00

20 lines
679 B
Lua

local Event = require 'utils.event'
local Game = require 'utils.game'
local function console_chat(event)
if not event.player_index or event.player_index == nil then
return
end
local player = Game.get_player_by_index(event.player_index)
local player_force = player.force
for _, force in pairs(game.forces) do
if (string.find(force.name, 'quadrant')) ~= nil or force.name == 'player' then
if force.name ~= player_force.name then
force.print(player.name .. ' ' .. player.tag .. ': ' .. event.message, player.chat_color)
end
end
end
end
Event.add(defines.events.on_console_chat, console_chat)