Skip to content

Commit

Permalink
Merge pull request #249 from Oarcinae/dev_2.1.9
Browse files Browse the repository at this point in the history
Dev 2.1.9
  • Loading branch information
Oarcinae authored Nov 6, 2024
2 parents 432db3b + bcb4aa8 commit 0747e72
Show file tree
Hide file tree
Showing 11 changed files with 96 additions and 30 deletions.
7 changes: 7 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
---------------------------------------------------------------------------------------------------
Version: 2.1.9
Date: 2024-11-06
Bugfixes:
- Fix crash when clicking player self reset button again before confirmation dialog is closed.
Info:
- More locale additions (thanks plexpt!). Removed trailing spaces from locale files.
---------------------------------------------------------------------------------------------------
Version: 2.1.8
Date: 2024-11-05
Changes:
Expand Down
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oarc-mod",
"version": "2.1.8",
"version": "2.1.9",
"factorio_version": "2.0",
"title": "Oarc Multiplayer Spawn",
"author": "Oarcinae",
Expand Down
25 changes: 13 additions & 12 deletions lib/config_parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,13 @@ OCFG_KEYS =
["resource_placement.linear_spacing"] = {mod_key = "oarc-mod-resource-placement-linear-spacing" , ocfg_keys = {"resource_placement", "linear_spacing"}, type = "integer"},

-- These are settings that aren't included in the games mod settings but are still nice to have easy access to.
["non_mod_settings_HEADER"] = {mod_key = "" , ocfg_keys = {""}, type = "header", text = "Additional Settings (Not available in the mod settings menu.)"},
["coin_generation_SUBHEADER"] = {mod_key = "" , ocfg_keys = {""}, type = "subheader", text = "Coin Generation"},
["coin_generation.enabled"] = {mod_key = "" , ocfg_keys = {"coin_generation", "enabled"}, type = "boolean", caption = "Coin Generation", tooltip = "Enemies drop coins when killed."},
["coin_generation.auto_decon_coins"] = {mod_key = "" , ocfg_keys = {"coin_generation", "auto_decon_coins"}, type = "boolean", caption = "Auto Decon Coins", tooltip = "Automatically marks coins dropped by enemies for deconstruction so robots will pick them up."},
["gameplay.enable_player_self_reset"] = {mod_key = "" , ocfg_keys = {"gameplay", "enable_player_self_reset"}, type = "boolean", caption = "Player Self Reset", tooltip = "Allow players to reset themselves in the spawn controls."},
["gameplay.scale_spawner_damage"] = {mod_key = "" , ocfg_keys = {"gameplay", "scale_spawner_damage"}, type = "boolean", caption = "Scale Spawner Damage", tooltip = "Scales damage done to spawners with evolution factor and distance to cloest spawn point. This helps compensate for spawner health scaling at a high evolution factor."}
["non_mod_settings_HEADER"] = {mod_key = "" , ocfg_keys = {""}, type = "header", text = {"oarc-non-mod-settings-header"}},
["coin_generation_SUBHEADER"] = {mod_key = "" , ocfg_keys = {""}, type = "subheader", text = {"oarc-coin-generation-subheader"}},
["coin_generation.enabled"] = {mod_key = "" , ocfg_keys = {"coin_generation", "enabled"}, type = "boolean", caption = {"oarc-coin-generation-caption"}, tooltip = {"oarc-coin-generation-tooltip"}},
["coin_generation.auto_decon_coins"] = {mod_key = "" , ocfg_keys = {"coin_generation", "auto_decon_coins"}, type = "boolean", caption = {"oarc-auto-decon-coins-caption"}, tooltip = {"oarc-auto-decon-coins-tooltip"}},
["gameplay.enable_player_self_reset"] = {mod_key = "" , ocfg_keys = {"gameplay", "enable_player_self_reset"}, type = "boolean", caption = {"oarc-player-self-reset-caption"}, tooltip = {"oarc-player-self-reset-tooltip"}},
["gameplay.scale_spawner_damage"] = {mod_key = "" , ocfg_keys = {"gameplay", "scale_spawner_damage"}, type = "boolean", caption = {"oarc-scale-spawner-damage-caption"}, tooltip = {"oarc-scale-spawner-damage-tooltip"}}

}

---Easy reverse lookup for mod settings keys.
Expand Down Expand Up @@ -205,31 +206,31 @@ function ValidateSettings()
log("Both main force and separate teams are disabled! Enabling main force. Please check your mod settings or config!")
storage.ocfg.gameplay.enable_main_team = true
settings.global["oarc-mod-enable-main-team"] = { value = true }
SendBroadcastMsg("Invalid setting! Both main force and separate teams are disabled! Enabling main force.")
SendBroadcastMsg({"oarc-teams-both-disabled-msg"})
end

-- Validate minimum is less than maximums
if (storage.ocfg.gameplay.near_spawn_distance >= storage.ocfg.gameplay.far_spawn_distance) then
log("Near spawn min distance is greater than or equal to near spawn max distance! Please check your mod settings or config!")
storage.ocfg.gameplay.far_spawn_distance = storage.ocfg.gameplay.near_spawn_distance + 1
settings.global["oarc-mod-far-spawn-distance"] = { value = storage.ocfg.gameplay.far_spawn_distance }
SendBroadcastMsg("Invalid setting! Near spawn min distance is greater than or equal to near spawn max distance!")
SendBroadcastMsg({"oarc-spawn-distance-invalid-msg"})
end

-- Validate that regrowth is enabled if world eater is enabled.
if (storage.ocfg.regrowth.enable_world_eater and not storage.ocfg.regrowth.enable_regrowth) then
log("World eater is enabled but regrowth is not! Disabling world eater. Please check your mod settings or config!")
storage.ocfg.regrowth.enable_world_eater = false
settings.global["oarc-mod-enable-world-eater"] = { value = false }
SendBroadcastMsg("Invalid setting! World eater is enabled but regrowth is not! Disabling world eater.")
SendBroadcastMsg({"oarc-world-eater-invalid-msg"})
end

-- Validate that default surface exists.
if (game.surfaces[storage.ocfg.gameplay.default_surface] == nil) then
log("Default surface does not exist! Please check your mod settings or config!")
storage.ocfg.gameplay.default_surface = "nauvis"
settings.global["oarc-mod-default-surface"] = { value = "nauvis" }
SendBroadcastMsg("Invalid setting! Default surface does not exist! Setting to nauvis.")
SendBroadcastMsg({"oarc-default-surface-invalid-msg"})
end

-- Validate that a "nauvis" surface config exists (nauvis is the default config fallback)
Expand Down Expand Up @@ -375,7 +376,7 @@ function GetGlobalOarcConfigUsingKeyTable(key_table)
return storage.ocfg[key_table[1]][key_table[2]]
elseif (number_of_keys == 3) then
if (storage.ocfg[key_table[1]] == nil) or
(storage.ocfg[key_table[1]][key_table[2]] == nil) or
(storage.ocfg[key_table[1]][key_table[2]] == nil) or
(storage.ocfg[key_table[1]][key_table[2]][key_table[3]] == nil) then
error("Invalid key_table 3: " .. serpent.block(key_table))
end
Expand Down Expand Up @@ -412,4 +413,4 @@ function ApplyRuntimeChanges(oarc_setting_index)
ConfigurePlayerForceRelationships(storage.ocfg.gameplay.enable_cease_fire,
storage.ocfg.gameplay.enable_friendly_teams)
end
end
end
7 changes: 6 additions & 1 deletion lib/gui_tabs/spawn_controls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,11 @@ end
---@param player LuaPlayer
---@return nil
function DisplayPlayerResetConfirmationGUI(player)

if (player.gui.screen.self_reset_confirm ~= nil) then
player.gui.screen.self_reset_confirm.destroy()
end

local self_reset_gui = player.gui.screen.add {
name = "self_reset_confirm",
type = "frame",
Expand Down Expand Up @@ -430,7 +435,7 @@ function SpawnCtrlTabGuiClick(event)
local position = tags.position --[[@as MapPosition]]

player.set_controller{type = defines.controllers.remote, position = position, surface = surface_name}
player.print({"", { "oarc-spawn-gps-location" }, GetGPStext(surface_name, position)})
player.print({"", { "oarc-spawn-gps-location" }, " ", GetGPStext(surface_name, position)})

-- Teleports the player to their home base
elseif (tags.setting == "teleport_home") then
Expand Down
10 changes: 5 additions & 5 deletions lib/separate_spawns.lua
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ function SeparateSpawnsPlayerChangedSurface(player, previous_surface_name, new_s
if (platform ~= nil) then
SendBroadcastMsg({ "oarc-player-on-platform", player.name, surface.platform.name })
else
SendBroadcastMsg({ "oarc-player-changed-surface", player.name, surface.name })
SendBroadcastMsg({ "oarc-player-changed-surface", player.name, surface.localised_name or { "space-location-name." .. surface.name } or surface.name})
end

-- Check if player has been init'd yet. If not, then ignore it.
Expand Down Expand Up @@ -308,7 +308,7 @@ function SeparateSpawnsUpdatePlayerSurface(player, new_surface_name)
storage.player_surfaces[player.name] = new_surface_name

-- Raise event if previous surface isn't nil (avoids first spawn event)
if (previous_surface_name ~= nil) then
if (previous_surface_name ~= nil) then
script.raise_event("oarc-mod-character-surface-changed", {
player_index=player.index,
old_surface_name=previous_surface_name,
Expand Down Expand Up @@ -639,7 +639,7 @@ function SetupAndClearSpawnAreas(surface, chunkArea)
-- If the chunk is within the main land area, then clear trees/resources and create the land spawn areas
-- (guaranteed land with a circle of trees)
local landArea = GetAreaAroundPos(spawn.position, general_spawn_config.spawn_radius_tiles + CHUNK_SIZE)
if not CheckIfInArea(chunkAreaCenter, landArea) then
if not CheckIfInArea(chunkAreaCenter, landArea) then
goto CONTINUE
end

Expand All @@ -655,7 +655,7 @@ function SetupAndClearSpawnAreas(surface, chunkArea)
if general_spawn_config.force_grass then
fill_tile = "grass-1"
end

if (general_spawn_config.shape == SPAWN_SHAPE_CHOICE_CIRCLE) then
CreateCropCircle(
surface,
Expand Down Expand Up @@ -1395,7 +1395,7 @@ function DelayedSpawnOnTick()
delayedSpawn = storage.delayed_spawns[i] --[[@as OarcDelayedSpawn]]

local surface = game.surfaces[delayedSpawn.surface]

if ((delayedSpawn.delayedTick < game.tick) or surface.is_chunk_generated(delayedSpawn.final_chunk_generated) ) then
if (game.players[delayedSpawn.playerName] ~= nil) then
SendPlayerToNewSpawnAndCreateIt(delayedSpawn)
Expand Down
9 changes: 6 additions & 3 deletions lib/separate_spawns_guis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ function DisplayWelcomeTextGui(player)
end

--Delete existing guis
if (player.gui.screen["welcome_msg"] ~= nil) then
if (player.gui.screen.welcome_msg ~= nil) then
player.gui.screen.welcome_msg.destroy()
end
if (player.gui.screen["spawn_opts"] ~= nil) then
if (player.gui.screen.spawn_opts ~= nil) then
player.gui.screen.spawn_opts.destroy()
end
if (player.gui.screen.self_reset_confirm ~= nil) then
player.gui.screen.self_reset_confirm.destroy()
end

local welcome_gui = player.gui.screen.add {
name = "welcome_msg",
Expand Down Expand Up @@ -1091,7 +1094,7 @@ function DisplayBuddySpawnRequestMenu(player, requesting_buddy_name)
local distText = { "oarc-buddy-txt-distance", spawn_choices.distance}

---@type LocalisedString
local requestText = { "", requesting_buddy_name, { "oarc-buddy-txt-would-like" }, teamText, { "oarc-buddy-txt-next-to-you" },
local requestText = { "", requesting_buddy_name, { "oarc-buddy-txt-would-like" }, " ", teamText, { "oarc-buddy-txt-next-to-you" },
moatText, surfaceText, distText }

AddLabel(buddy_request_gui_if, nil, requestText, my_label_style)
Expand Down
6 changes: 3 additions & 3 deletions locale/de/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ oarc-spawn-menu-solo-header=Eigenen Spawn erstellen
oarc-spawn-menu-shared-header=Einem anderen Spawn beitreten
oarc-spawn-menu-buddy-header=Einen Buddy-Spawn erstellen

oarc-spawn-distance-slider-label=Abstand vom Kartenzentrum:
oarc-spawn-distance-slider-label=Abstand vom Kartenzentrum:
oarc-spawn-distance-slider-tooltip=Dies ist der Mindestabstand in Chunks vom Zentrum der Karte, in dem du spawnst. Du könntest weiter entfernt spawnen, wenn die Karte bereits erkundet wurde. Ressourcen und Feinde sind weiter vom Zentrum entfernt zahlreicher, aber du erhältst immer noch ein sicheres Startgebiet.

oarc-starting-area-normal=Du spawnst in einem neuen Gebiet mit vorgegebenen Startressourcen.
Expand Down Expand Up @@ -107,7 +107,7 @@ oarc-spawn-info-location-button=Standort auf der Karte anzeigen
oarc-spawn-info-location-button-tooltip=Klicken, um den Standort auf der Karte anzuzeigen.


oarc-spawn-gps-location=Standort:
oarc-spawn-gps-location=Standort:
oarc-shared-spawn-controls=Gemeinsame Spawn-Steuerung
oarc-shared-spawn-allow-joiners=Erlaube anderen Spielern, deiner Basis beizutreten.
oarc-shared-spawn-full=Deine Basis ist voll! Es können keine weiteren Spieler beitreten.
Expand Down Expand Up @@ -168,7 +168,7 @@ oarc-buddy-cancel-request=__1__ hat die Mitspieler-Anfrage abgebrochen!
oarc-buddy-requesting-from-you=__1__ fragt nach einem Mitspieler-Spawn von dir an!

# [MITSPIELERNAME] oarc-buddy-txt-would-like {Teamwahl} oarc-buddy-txt-next-to-you {Grabenwahl} {Oberflächenwahl} {Abstandswahl}
oarc-buddy-txt-would-like= möchte beitreten
oarc-buddy-txt-would-like= möchte beitreten
oarc-buddy-txt-main-team=dem Hauptteam
oarc-buddy-txt-new-teams=auf getrennten Teams
oarc-buddy-txt-buddy-team=ein Mitspieler-Team
Expand Down
9 changes: 9 additions & 0 deletions locale/en/locale-mod-settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,12 @@ oarc-mod-resource-placement-horizontal-offset=This is the horizontal offset (in
oarc-mod-resource-placement-linear-spacing=This is the linear spacing (in tiles) between resources. Only applicable for square shaped spawns.
oarc-mod-resource-placement-size-multiplier=This changes the size of the resource deposits. Default settings should provide close to a vanilla starting experience.
oarc-mod-resource-placement-amount-multiplier=This changes the richness of the resource deposits. Default settings should provide close to a vanilla starting experience.

;"circle" | "octagon" | "square"
[string-mod-setting]
oarc-mod-spawn-general-shape-circle=Circle
oarc-mod-spawn-general-shape-octagon=Octagon
oarc-mod-spawn-general-shape-square=Square

oarc-mod-spawn-general-enable-resources-circle-shape-circle=Circle
oarc-mod-spawn-general-enable-resources-circle-shape-square=Square
21 changes: 18 additions & 3 deletions locale/en/locale.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ oarc-spawn-menu-solo-header=Create Your Own Spawn
oarc-spawn-menu-shared-header=Join Another Spawn
oarc-spawn-menu-buddy-header=Create A Buddy Spawn

oarc-spawn-distance-slider-label=Distance From Map Center:
oarc-spawn-distance-slider-label=Distance From Map Center:
oarc-spawn-distance-slider-tooltip=This is the minimum distance from the center of the map in chunks that you will spawn. You may spawn further away if the map has already been explored. Resources and enemies are both more abundant the further you go from the center, but you will still be guaranteed a safe starting area.

oarc-starting-area-normal=You are spawned in a new area, with pre-set starting resources.
Expand Down Expand Up @@ -117,7 +117,7 @@ oarc-spawn-controls-disabled-delayed=Spawn is still generating! Refresh this tab
oarc-player-reset-are-you-sure=Are you sure you want to reset?
oarc-player-was-reset-notify=__1__ was reset!

oarc-spawn-gps-location=Location:
oarc-spawn-gps-location=Location:
oarc-shared-spawn-controls=Shared Spawn Controls
oarc-shared-spawn-allow-joiners=Allow others to join your base.
oarc-shared-spawn-full=Your base is full! No more players can join.
Expand Down Expand Up @@ -181,7 +181,7 @@ oarc-buddy-cancel-request=__1__ cancelled their buddy request!
oarc-buddy-requesting-from-you=__1__ is requesting a buddy spawn from you!
# [BUDDY NAME] oarc-buddy-txt-would-like {team choice} oarc-buddy-txt-next-to-you {moat choice} {surface choice} {distance choice}
oarc-buddy-txt-would-like= would like to join
oarc-buddy-txt-would-like= would like to join
oarc-buddy-txt-main-team=the main team
oarc-buddy-txt-new-teams=on separate teams
oarc-buddy-txt-buddy-team=a buddy team
Expand Down Expand Up @@ -377,6 +377,21 @@ oarc-cleanup-30sec-warning=Map cleanup in 30 seconds... Unused and old map chunk
oarc-cleanup-force-30sec-warning=Map cleanup (forced) in 30 seconds... Unused and old map chunks will be deleted!
oarc-cleanup-complete=Map cleanup done, sorry for your loss.

oarc-non-mod-settings-header=Additional Settings (Not available in the mod settings menu.)
oarc-coin-generation-subheader=Coin Generation
oarc-coin-generation-caption=Coin Generation
oarc-coin-generation-tooltip=Enemies drop coins when killed.
oarc-auto-decon-coins-caption=Auto Decon Coins
oarc-auto-decon-coins-tooltip=Automatically marks coins dropped by enemies for deconstruction so robots will pick them up.
oarc-player-self-reset-caption=Player Self Reset
oarc-player-self-reset-tooltip=Allow players to reset themselves in the spawn controls.
oarc-scale-spawner-damage-caption=Scale Spawner Damage
oarc-scale-spawner-damage-tooltip=Scales damage done to spawners with evolution factor and distance to cloest spawn point. This helps compensate for spawner health scaling at a high evolution factor.

oarc-teams-both-disabled-msg=Invalid setting! Both main force and separate teams are disabled! Enabling main force.
oarc-spawn-distance-invalid-msg=Invalid setting! Near spawn min distance is greater than or equal to near spawn max distance!
oarc-world-eater-invalid-msg=Invalid setting! World eater is enabled but regrowth is not! Disabling world eater.
oarc-default-surface-invalid-msg=Invalid setting! Default surface does not exist! Setting to nauvis.

[entity-name]
oarc-linked-chest=OARC Linked Chest
Expand Down
10 changes: 10 additions & 0 deletions locale/zh-CN/locale-mod-settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,13 @@ oarc-mod-resource-placement-horizontal-offset=这是资源从基地左上角水
oarc-mod-resource-placement-linear-spacing=这是资源之间的线性间距(以格子为单位)。仅适用于方形的基地。
oarc-mod-resource-placement-size-multiplier=此参数调整资源矿床的大小。默认设置应提供接近原版的起始体验。
oarc-mod-resource-placement-amount-multiplier=此参数调整资源矿床的丰度。默认设置应提供接近原版的起始体验。


;"circle" | "octagon" | "square"
[string-mod-setting]
oarc-mod-spawn-general-shape-circle=圆圈
oarc-mod-spawn-general-shape-octagon=八角形
oarc-mod-spawn-general-shape-square=方形

oarc-mod-spawn-general-enable-resources-circle-shape-circle=圆圈
oarc-mod-spawn-general-enable-resources-circle-shape-square=方形
Loading

0 comments on commit 0747e72

Please sign in to comment.