mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Merge Game, FlyingText, Common and table
This commit is contained in:
@@ -2,12 +2,10 @@
|
||||
-- also displays a ping above users who are named in the message
|
||||
-- @addon Chat-Popups
|
||||
|
||||
local FloatingText = require("modules/exp_util/floating_text")
|
||||
local FlyingText = require("modules/exp_util/flying_text")
|
||||
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
|
||||
local config = require("modules.exp_legacy.config.popup_messages") --- @dep config.popup_messages
|
||||
|
||||
local send_text = FloatingText.print_as_player -- (player, text)
|
||||
|
||||
Event.add(defines.events.on_console_chat, function(event)
|
||||
if not event.player_index or event.player_index < 1 then return end
|
||||
local player = game.players[event.player_index]
|
||||
@@ -18,7 +16,10 @@ Event.add(defines.events.on_console_chat, function(event)
|
||||
|
||||
-- Sends the message as text above them
|
||||
if config.show_player_messages then
|
||||
send_text(player, { "chat-popup.message", player.name, event.message })
|
||||
FlyingText.create_as_player{
|
||||
target_player = player,
|
||||
text = { "chat-popup.message", player.name, event.message },
|
||||
}
|
||||
end
|
||||
|
||||
if not config.show_player_mentions then return end
|
||||
@@ -30,7 +31,10 @@ Event.add(defines.events.on_console_chat, function(event)
|
||||
for _, mentioned_player in pairs(game.connected_players) do
|
||||
if mentioned_player.index ~= player.index then
|
||||
if search_string:find(mentioned_player.name:lower(), 1, true) then
|
||||
send_text(mentioned_player, { "chat-popup.ping", player.name })
|
||||
FlyingText.create_as_player{
|
||||
target_player = mentioned_player,
|
||||
text = { "chat-popup.ping", player.name },
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user