From 7755ae9d73cdde32c29b8bbc6eb561bdb0cde32b Mon Sep 17 00:00:00 2001 From: Oarcinae Date: Tue, 3 Dec 2024 20:03:39 -0500 Subject: [PATCH] Fix surface name for platforms in player list. Caught some more print statements that weren't wrapped in CompatSend. Add special sound for join request. --- lib/gui_tabs/player_list.lua | 7 +++++-- lib/oarc_gui_utils.lua | 5 +++++ lib/separate_spawns.lua | 4 ++-- lib/separate_spawns_guis.lua | 6 +++--- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/gui_tabs/player_list.lua b/lib/gui_tabs/player_list.lua index 03f60eb..0335a43 100644 --- a/lib/gui_tabs/player_list.lua +++ b/lib/gui_tabs/player_list.lua @@ -124,9 +124,12 @@ function CreatePlayerGPSButton(container, player_name) end if game.planets[surface_name] ~= nil then - AddLabel(flow, nil, {"", "[planet=", surface_name, "] ", {"space-location-name."..surface_name}}, my_label_style) + AddLabel(flow, nil, {"", "[planet=", surface_name, "] ", {"space-location-name."..surface_name}}, my_player_list_surface_max_width_style) + + elseif game.surfaces[surface_name].platform ~= nil then + AddLabel(flow, nil, {"", "[entity=space-platform-hub] ", game.surfaces[surface_name].platform.name}, my_player_list_surface_max_width_style) else - AddLabel(flow, nil, game.surfaces[surface_name].localised_name or game.surfaces[surface_name].name, my_label_style) + AddLabel(flow, nil, game.surfaces[surface_name].localised_name or game.surfaces[surface_name].name, my_player_list_surface_max_width_style) end end diff --git a/lib/oarc_gui_utils.lua b/lib/oarc_gui_utils.lua index fff1801..85d2edd 100644 --- a/lib/oarc_gui_utils.lua +++ b/lib/oarc_gui_utils.lua @@ -163,6 +163,11 @@ my_notepad_fixed_width_style = { top_margin = 5, bottom_margin = 5 } +---@type LuaStyle +---@diagnostic disable-next-line: missing-fields +my_player_list_surface_max_width_style = { + maximal_width = 200 +} -------------------------------------------------------------------------------- -- GUI Functions diff --git a/lib/separate_spawns.lua b/lib/separate_spawns.lua index 92c1bd0..b89ee1a 100644 --- a/lib/separate_spawns.lua +++ b/lib/separate_spawns.lua @@ -1155,7 +1155,7 @@ function TransferOwnershipOfAllSpawns(primary_spawn, new_host_name) end end - game.players[new_host_name].print({ "oarc-new-owner-msg" }) + CompatSend(game.players[new_host_name], { "oarc-new-owner-msg" }) end --[[ @@ -1428,7 +1428,7 @@ function QueuePlayerForSpawn(player_name, delayed_spawn) SetPlayerRespawn(player_name, delayed_spawn.surface_name, delayed_spawn.position, true) - game.players[player_name].print({ "oarc-generating-spawn-please-wait" }) + CompatSend(game.players[player_name], { "oarc-generating-spawn-please-wait" }, { volume_modifier = 0}) local ticks_remaining = delayed_spawn.delayed_tick - game.tick local seconds_remaining = math.ceil(ticks_remaining / TICKS_PER_SECOND) diff --git a/lib/separate_spawns_guis.lua b/lib/separate_spawns_guis.lua index 3b810d6..528955a 100644 --- a/lib/separate_spawns_guis.lua +++ b/lib/separate_spawns_guis.lua @@ -756,8 +756,8 @@ function RequestToJoinSharedSpawn(player) -- Display wait menu with cancel button. DisplaySharedSpawnJoinWaitMenu(player) - -- Tell other player they are requesting a response. - game.players[host_name].print({ "oarc-player-requesting-join-you", player.name }) + -- Tell other player they are requesting a response. Print it with color orange + CompatSend(game.players[host_name], { "oarc-player-requesting-join-you", player.name }, { color = { r = 1, g = 0.5, b = 0 }, sound_path = "utility/scenario_message" }) OarcGuiRefreshContent(game.players[host_name]) else SendErrorMsg(player, { "oarc-invalid-host-shared-spawn" }) @@ -774,7 +774,7 @@ function CancelSharedSpawnRequest(player) local host_name = storage.spawn_choices[player.name].host_name if (host_name ~= nil) and (game.players[host_name] ~= nil) then - game.players[host_name].print({ "oarc-player-cancel-join-request", player.name }) + CompatSend(game.players[host_name], { "oarc-player-cancel-join-request", player.name }) end --- Destroy the waiting menu and display the spawn options again.