1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-08 00:39:30 +02:00
ComfyFactorio/utils/functions/flying_texts.lua
2024-10-22 21:47:11 +02:00

31 lines
836 B
Lua

local Public = {}
---Create Flying text for the player, or for all players on that surface if no player specified
---@param player LuaPlayer|nil
---@param surface LuaSurface
---@param position MapPosition
---@param text string|table
---@param color Color|table
function Public.flying_text(player, surface, position, text, color)
if not player then
for _, player in pairs(game.connected_players) do
if player.surface == surface then
player.create_local_flying_text({
text = text,
position = position,
color = color
})
end
end
else
player.create_local_flying_text({
text = text,
position = position,
color = color
})
end
end
return Public