1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-14 02:34:09 +02:00

Fix message colors

This commit is contained in:
danielmartin0 2024-09-27 18:22:40 +01:00 committed by Gerkiz
parent 3e5eb9aa57
commit 1936f81028
3 changed files with 29 additions and 34 deletions

View File

@ -729,15 +729,13 @@ local function handle_maze_walls_damage_resistance(event)
elseif event.damage_type.name and event.damage_type.name == "fire" then
-- put out forest fires:
for _, e2 in
pairs(
entity.surface.find_entities_filtered({
area = {
{ entity.position.x - 4, entity.position.y - 4 },
{ entity.position.x + 4, entity.position.y + 4 },
},
name = "fire-flame-on-tree",
})
)
pairs(entity.surface.find_entities_filtered({
area = {
{ entity.position.x - 4, entity.position.y - 4 },
{ entity.position.x + 4, entity.position.y + 4 },
},
name = "fire-flame-on-tree",
}))
do
if e2.valid then
e2.destroy()
@ -1669,17 +1667,14 @@ local function event_on_research_finished(event)
-- using a localised string means we have to write this out (recall that "" signals concatenation)
memory.force.print(
{ "", ">> ", { "pirates.research_notification", research.localised_name } },
CoreData.colors.notify_force_light
{ color = CoreData.colors.notify_force_light }
)
Server.to_discord_embed_raw(
{
"",
"[" .. memory.name .. "] ",
{ "pirates.research_notification", prototypes.technology[research.name].localised_name },
},
true
)
Server.to_discord_embed_raw({
"",
"[" .. memory.name .. "] ",
{ "pirates.research_notification", prototypes.technology[research.name].localised_name },
}, true)
end
for _, e in ipairs(research.effects) do
@ -1725,7 +1720,7 @@ local function event_on_player_joined_game(event)
--figure out if we should drop them back into a crew:
if not Server.get_current_time() then -- don't run this on servers because I'd need to negotiate that with the rest of Comfy
player.print({ "pirates.thesixthroc_support_toast" }, { r = 1, g = 0.4, b = 0.9 })
player.print({ "pirates.thesixthroc_support_toast" }, { color = { r = 1, g = 0.4, b = 0.9 } })
end
if _DEBUG then
@ -2453,13 +2448,13 @@ local function event_on_console_chat(event)
if player.force.name == Common.lobby_force_name then
for _, index in pairs(global_memory.crew_active_ids) do
local recipient_force_name = global_memory.crew_memories[index].force_name
game.forces[recipient_force_name].print(message_prefix .. " [LOBBY]: " .. event.message, color)
game.forces[recipient_force_name].print(message_prefix .. " [LOBBY]: " .. event.message, { color = color })
end
else
if memory.name then
full_message = message_prefix .. " [" .. memory.name .. "]: " .. event.message
end
game.forces.player.print(full_message, color)
game.forces.player.print(full_message, { color = color })
end
end

View File

@ -56,7 +56,7 @@ local function check_admin(cmd)
return true
end
if not player.admin then
p({ "pirates.cmd_error_not_admin" }, Color.fail)
p({ "pirates.cmd_error_not_admin" }, { color = Color.fail })
return false
end
else
@ -76,7 +76,7 @@ local function check_captain(cmd)
return
end
if not (Permissions.player_privilege_level(player) >= Permissions.privilege_levels.CAPTAIN) then
p({ "pirates.cmd_error_not_captain" }, Color.fail)
p({ "pirates.cmd_error_not_captain" }, { color = Color.fail })
return false
end
else
@ -98,7 +98,7 @@ local function check_captain_or_admin(cmd)
if
not (player.admin or Permissions.player_privilege_level(player) >= Permissions.privilege_levels.CAPTAIN)
then
p({ "pirates.cmd_error_not_captain" }, Color.fail)
p({ "pirates.cmd_error_not_captain" }, { color = Color.fail })
return false
end
else
@ -142,7 +142,7 @@ end
-- if player ~= nil then
-- p = player.print
-- if not (trusted[player.name] or player.admin) then
-- p('[ERROR] Only admins and trusted weebs are allowed to run this command!', Color.fail)
-- p('[ERROR] Only admins and trusted weebs are allowed to run this command!', {color=Color.fail})
-- return false
-- end
-- else

View File

@ -164,48 +164,48 @@ end
function Public.notify_game(message, color_override)
color_override = color_override or CoreData.colors.notify_game
game.print({ "", ">> ", message }, color_override)
game.print({ "", ">> ", message }, { color = color_override })
end
function Public.notify_lobby(message, color_override)
color_override = color_override or CoreData.colors.notify_lobby
game.forces[Public.lobby_force_name].print({ "", ">> ", message }, color_override)
game.forces[Public.lobby_force_name].print({ "", ">> ", message }, { color = color_override })
end
function Public.notify_force(force, message, color_override)
color_override = color_override or CoreData.colors.notify_force
force.print({ "", ">> ", message }, color_override)
force.print({ "", ">> ", message }, { color = color_override })
end
function Public.notify_force_light(force, message, color_override)
color_override = color_override or CoreData.colors.notify_force_light
force.print({ "", ">> ", message }, color_override)
force.print({ "", ">> ", message }, { color = color_override })
end
function Public.notify_force_error(force, message, color_override)
color_override = color_override or CoreData.colors.notify_error
force.print({ "", ">> ", message }, color_override)
force.print({ "", ">> ", message }, { color = color_override })
force.play_sound({ path = "utility/cannot_build" })
end
function Public.notify_player_error(player, message, color_override)
color_override = color_override or CoreData.colors.notify_error
player.print({ "", "## ", { "pirates.notify_whisper" }, " ", message }, color_override)
player.print({ "", "## ", { "pirates.notify_whisper" }, " ", message }, { color = color_override })
player.play_sound({ path = "utility/cannot_build" })
end
function Public.notify_player_expected(player, message, color_override)
color_override = color_override or CoreData.colors.notify_player_expected
player.print({ "", "## ", { "pirates.notify_whisper" }, " ", message }, color_override)
player.print({ "", "## ", { "pirates.notify_whisper" }, " ", message }, { color = color_override })
end
function Public.notify_player_announce(player, message, color_override)
color_override = color_override or CoreData.colors.notify_player_announce
player.print({ "", "## ", { "pirates.notify_whisper" }, " ", message }, color_override)
player.print({ "", "## ", { "pirates.notify_whisper" }, " ", message }, { color = color_override })
end
function Public.parrot_speak(force, message)
force.print({ "", { "pirates.notify_parrot" }, " ", message }, CoreData.colors.parrot)
force.print({ "", { "pirates.notify_parrot" }, " ", message }, { color = CoreData.colors.parrot })
local memory = Memory.get_crew_memory()
Server.to_discord_embed_raw({ "", "[" .. memory.name .. "] ", { "pirates.notify_parrot" }, " ", message }, true)