1
0
mirror of https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git synced 2025-01-05 22:53:48 +02:00

Merge pull request #207 from Oarcinae/206-spawn-controls-get-disabled-on-mod-update-on-gui-rebuild

206 spawn controls get disabled on mod update on gui rebuild
This commit is contained in:
Oarcinae 2024-10-23 09:22:00 -04:00 committed by GitHub
commit 1fc8312ea2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 4 deletions

View File

@ -1,4 +1,11 @@
---------------------------------------------------------------------------------------------------
Version: 2.1.2
Date: 2024-10-23
Bugfixes:
- Fix spawn controls tab in custom GUI not being re-enabled when GUI is recreated (on mod update for example).
Info:
- Add a warning note explanation when the custom respawn feature is not available.
---------------------------------------------------------------------------------------------------
Version: 2.1.1
Date: 2024-10-23
Bugfixes:

View File

@ -1,6 +1,6 @@
{
"name": "oarc-mod",
"version": "2.1.1",
"version": "2.1.2",
"factorio_version": "2.0",
"title": "Oarc Multiplayer Spawn",
"author": "Oarcinae",

View File

@ -128,7 +128,7 @@ function CreateSetRespawnLocationButton(player, container)
local respawn_info = storage.player_respawns[player.name][player.surface.name]
if (respawn_info == nil) then
log("ERROR: No respawn info for player: " .. player.name)
AddLabel(container, nil, { "oarc-no-respawn-this-surface" }, my_warning_style)
return
end
@ -325,6 +325,9 @@ function SpawnCtrlTabGuiClick(event)
elseif (tags.setting == "teleport_home") then
local surface_name = tags.surface --[[@as string]]
local position = tags.position --[[@as MapPosition]]
--TODO Verify player is still on the same surface, if they leave the GUI open, they can teleport back from any surface.
SafeTeleport(player, game.surfaces[surface_name], position)
-- Accept or reject pending player join requests to a shared base

View File

@ -71,8 +71,11 @@ function InitOarcGuiTabs(player)
AddOarcGuiTab(player, OARC_SERVER_INFO_TAB_NAME)
SetOarcGuiTabEnabled(player, OARC_SERVER_INFO_TAB_NAME, true)
-- Spawn control tab, disabled by default
-- Spawn control tab, enable if player is already spawned
AddOarcGuiTab(player, OARC_SPAWN_CTRL_TAB_NAME)
local player_respawns = storage.player_respawns[player.name]
local spawn_enabled = (player_respawns ~= nil) and (next(player_respawns) ~= nil) -- TODO: Maybe make a specific state flag or something more explicit?
SetOarcGuiTabEnabled(player, OARC_SPAWN_CTRL_TAB_NAME, spawn_enabled)
-- Regrowth control tab
AddOarcGuiTab(player, OARC_MOD_INFO_CTRL_TAB_NAME)
@ -419,7 +422,7 @@ function AddRemoveOarcGuiTabForAllPlayers(tab_name, add, enable)
AddOarcGuiTab(player, tab_name)
SetOarcGuiTabEnabled(player, tab_name, true)
elseif (not add and DoesOarcGuiTabExist(player, tab_name)) then
-- RemoveOarcGuiTab(player, tab_name) -- SEE https://forums.factorio.com/viewtopic.php?f=7&t=115901
-- RemoveOarcGuiTab(player, tab_name) -- TODO: SEE https://forums.factorio.com/viewtopic.php?f=7&t=115901
RecreateOarcGui(player) -- Assumes a ocfg setting change, so just recreate the whole thing.
end
end

View File

@ -113,6 +113,7 @@ oarc-shared-spawn-allow-joiners=Allow others to join your base.
oarc-shared-spawn-full=Your base is full! No more players can join.
oarc-set-respawn-loc-header=Respawn Location
oarc-no-respawn-this-surface=You cannot set a custom respawn location on this surface.
oarc-set-respawn-loc-info-surface-label=Current Surface Respawn: __1__ (x=__2__, y=__3__)
oarc-set-respawn-loc=Set Respawn Location
oarc-set-respawn-loc-tooltip=This will set your respawn point to your current location. There is a cooldown before you can change it again. You can only set this on supported surfaces.