From 281934758d6a50abf89c91cbb9267811fedbeccc Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Fri, 2 Dec 2022 15:41:05 +0000 Subject: [PATCH 01/21] Update pirates.cfg --- locale/en/pirates.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/en/pirates.cfg b/locale/en/pirates.cfg index e93725d2..729bb78e 100644 --- a/locale/en/pirates.cfg +++ b/locale/en/pirates.cfg @@ -16,7 +16,7 @@ softmod_info_tips_1=Features of the game that are hard to work out alone softmod_info_tips_2=• The captain can steer the boat from the crow's nest by placing 100 rail signals in one of the blue boxes.\n• Resources granted to the ship appear in the captain's cabin.\n• Charging a silo drains power from everything else on its network.\n• The quantity of ore available on an island is independent of the order in which you break rocks.\n• Passive pollution ramps up over time on each island.\n• The strength of attacks is proportional to the number of remaining nests. (The time-based rate of evolution is proportional to nests too, but destroying a nest will immediately jump evolution by most of the amount it 'would have' made had it survived.)\n• Lab productivity increases with each league.\n• item-on-ground entities on the deck are moved to the cabin when the boat moves, for performance reasons.\n• Commands: /ccolor gives you a fun color. /classinfo {classname} gives the description of the named class. To manage your class, use /take {classname} or /giveup. softmod_info_updates_1=Significant recent changes -softmod_info_updates_2=v1.4.2\n• Disabled 'disband crew' button.\n• Increased amount of fish caught by all fishing classes.\n• Enabled concrete tech.\n• Fixed Mysterious caves island always having the same layout.\n• Fixed issue where power could get disconnected between deck and hold.\n• Added /clear_north_tanks and /clear_south_tanks commands to clear fluid from ship's storage tanks.\n\nv1.4.1\n• Cannon upgrade is now more expensive and appears less often.\n• Bugfixes.\n\nv1.4.0\n• New private runs: Protect your run by a password.\n• New island: Mysterious caves.\n• New technologies now available: Car and nuclear energy.\n• New way to unlock extra holds and power upgrades.\n• Various island related balance changes. +softmod_info_updates_2=v1.4.2\n• Disabled 'disband crew' button.\n• Increased amount of fish caught by all fishing classes.\n• Enabled concrete tech.\n• Fixed Mysterious caves island always having the same layout.\n• Fixed issue where power could get disconnected between deck and hold.\n• Added /clear_north_tanks and /clear_south_tanks commands to clear fluid from ship's storage tanks.\n• Difficulty of Hard and Nightmare slightly increased.\n\nv1.4.1\n• Cannon upgrade is now more expensive and appears less often.\n• Bugfixes.\n\nv1.4.0\n• New private runs: Protect your run by a password.\n• New island: Mysterious caves.\n• New technologies now available: Car and nuclear energy.\n• New way to unlock extra holds and power upgrades.\n• Various island related balance changes. softmod_info_credits_1=Credits softmod_info_credits_2=Pirate Ship designed and coded by thesixthroc. Updates from Piratux. Comfy codebase and help from Gerkiz, Hanakocz and Mew @ Comfy Industries (https://getcomfy.eu). Some island structure blueprints contributed by Mattisso.\n\nCome chat with us: https://getcomfy.eu/discord\n\n"Those white gloves. I'll never forget them 'till the day I die." - Dr. John From ef06f126a8d09ca2a2988a465891276054026fbe Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Fri, 2 Dec 2022 18:49:48 +0000 Subject: [PATCH 02/21] increase base evo on harder difficulties --- maps/pirates/balance.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/maps/pirates/balance.lua b/maps/pirates/balance.lua index ca78df01..fbab46cf 100644 --- a/maps/pirates/balance.lua +++ b/maps/pirates/balance.lua @@ -6,6 +6,7 @@ local Math = require 'maps.pirates.math' -- local Raffle = require 'maps.pirates.raffle' -- local Memory = require 'maps.pirates.memory' local Common = require 'maps.pirates.common' +local CoreData = require 'maps.pirates.coredata' -- local Utils = require 'maps.pirates.utils_local' -- local _inspect = require 'utils.inspect'.inspect @@ -259,6 +260,13 @@ function Public.base_evolution_leagues(leagues) else evo = (0.0201 * (overworldx/40)) * Math.sloped(Common.difficulty_scale(), 1/5) + local difficulty_name = CoreData.get_difficulty_option_informal_name_from_value(Common.difficulty_scale()) + if difficulty_name == 'hard' then + evo = evo + 0.02 + elseif difficulty_name == 'nightmare' then + evo = evo + 0.04 + end + if overworldx > 600 and overworldx < 1000 then evo = evo + (0.0025 * (overworldx - 600)/40) elseif overworldx >= 1000 then From a3bff0998c05bade342c59b14b168316bb6ccb70 Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Fri, 2 Dec 2022 19:00:57 +0000 Subject: [PATCH 03/21] slightly higher wave size variance --- maps/pirates/ai.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/maps/pirates/ai.lua b/maps/pirates/ai.lua index 70524e8a..d110e731 100644 --- a/maps/pirates/ai.lua +++ b/maps/pirates/ai.lua @@ -137,16 +137,16 @@ function Public.wave_size_rng() -- random variance in attack sizes wave_size_multiplier = 0 elseif memory.overworldx > 0 then local rng2 = Math.random(1000) - if rng2 <= 900 then + if rng2 <= 880 then wave_size_multiplier = 1 - elseif rng2 <= 975 then + elseif rng2 <= 970 then wave_size_multiplier = 1.5 elseif rng2 <= 985 then wave_size_multiplier = 2 elseif rng2 <= 995 then - wave_size_multiplier = 2.5 + wave_size_multiplier = 2.75 else - wave_size_multiplier = 3 + wave_size_multiplier = 3.5 end end From bc01e0900163bbf9ff83aa3096f353fba85a2cdc Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Fri, 2 Dec 2022 19:04:59 +0000 Subject: [PATCH 04/21] Update ai.lua --- maps/pirates/ai.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maps/pirates/ai.lua b/maps/pirates/ai.lua index d110e731..f2b5f91c 100644 --- a/maps/pirates/ai.lua +++ b/maps/pirates/ai.lua @@ -137,7 +137,7 @@ function Public.wave_size_rng() -- random variance in attack sizes wave_size_multiplier = 0 elseif memory.overworldx > 0 then local rng2 = Math.random(1000) - if rng2 <= 880 then + if rng2 <= 890 then wave_size_multiplier = 1 elseif rng2 <= 970 then wave_size_multiplier = 1.5 From 39d1afa583609950c1a83f58c09b4c537062fb77 Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Fri, 2 Dec 2022 19:21:19 +0000 Subject: [PATCH 05/21] Update ai.lua --- maps/pirates/ai.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maps/pirates/ai.lua b/maps/pirates/ai.lua index f2b5f91c..27f39d46 100644 --- a/maps/pirates/ai.lua +++ b/maps/pirates/ai.lua @@ -144,9 +144,9 @@ function Public.wave_size_rng() -- random variance in attack sizes elseif rng2 <= 985 then wave_size_multiplier = 2 elseif rng2 <= 995 then - wave_size_multiplier = 2.75 + wave_size_multiplier = 3 else - wave_size_multiplier = 3.5 + wave_size_multiplier = 4 end end From 1179f11162b3850db4d1ee6453f138cb10d9a389 Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Fri, 2 Dec 2022 19:23:41 +0000 Subject: [PATCH 06/21] more pollution scaling with difficulty --- maps/pirates/balance.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maps/pirates/balance.lua b/maps/pirates/balance.lua index fbab46cf..0979f779 100644 --- a/maps/pirates/balance.lua +++ b/maps/pirates/balance.lua @@ -212,7 +212,7 @@ end function Public.silo_total_pollution() return ( - 365 * (Common.difficulty_scale()^(1.2)) * Public.crew_scale()^(3/10) * (3.2 + 0.7 * (Common.overworldx()/40)^(1.6)) / Math.sloped(Common.difficulty_scale(), 1/5) --shape of the curve with x is tuned. Final factor of difficulty is to offset a change made to scripted_biters_pollution_cost_multiplier + 365 * (Common.difficulty_scale()^(1.2)) * Public.crew_scale()^(3/10) * (3.2 + 0.7 * (Common.overworldx()/40)^(1.6)) --shape of the curve with x is tuned. ) end @@ -247,7 +247,7 @@ function Public.boat_passive_pollution_per_minute(time) return boost * ( 2.73 * (Common.difficulty_scale()^(1.1)) * (Common.overworldx()/40)^(1.8) * (Public.crew_scale())^(52/100)-- There is no _explicit_ T dependence, but it depends almost the same way on the crew_scale as T does. - ) / Math.sloped(Common.difficulty_scale(), 1/5) --Final factor of difficulty is to offset a change made to scripted_biters_pollution_cost_multiplier + ) end From 51f75e7212f1807f536109702ae1f9892105bd4b Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Fri, 2 Dec 2022 19:43:20 +0000 Subject: [PATCH 07/21] Update balance.lua --- maps/pirates/balance.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maps/pirates/balance.lua b/maps/pirates/balance.lua index 0979f779..9b53971b 100644 --- a/maps/pirates/balance.lua +++ b/maps/pirates/balance.lua @@ -94,7 +94,7 @@ Public.EEI_stages = { --multipliers function Public.scripted_biters_pollution_cost_multiplier() - return 1.45 / Math.sloped(Common.difficulty_scale(), 1/3) * (1 + 1.2 / ((1 + (Common.overworldx()/40))^(1.5+Common.difficulty_scale()))) -- the complicated factor just makes the early-game easier; in particular the first island, but on easier difficulties the next few islands as well + return 1.45 / Math.sloped(Common.difficulty_scale(), 1/2) * (1 + 1.2 / ((1 + (Common.overworldx()/40))^(1.5+Common.difficulty_scale()))) -- the complicated factor just makes the early-game easier; in particular the first island, but on easier difficulties the next few islands as well end function Public.cost_to_leave_multiplier() From 171b5d3f67947527f2207c7011ca0f32e00aca1f Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Fri, 2 Dec 2022 19:44:38 +0000 Subject: [PATCH 08/21] Update balance.lua --- maps/pirates/balance.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maps/pirates/balance.lua b/maps/pirates/balance.lua index 9b53971b..a140e149 100644 --- a/maps/pirates/balance.lua +++ b/maps/pirates/balance.lua @@ -212,7 +212,7 @@ end function Public.silo_total_pollution() return ( - 365 * (Common.difficulty_scale()^(1.2)) * Public.crew_scale()^(3/10) * (3.2 + 0.7 * (Common.overworldx()/40)^(1.6)) --shape of the curve with x is tuned. + 365 * (Common.difficulty_scale()^(1.1)) * Public.crew_scale()^(3/10) * (3.2 + 0.7 * (Common.overworldx()/40)^(1.6)) --shape of the curve with x is tuned. ) end From 2d6b02a6b8ac6c81cd3add607256b3ab3c8eb4bd Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Fri, 2 Dec 2022 22:23:06 +0000 Subject: [PATCH 09/21] nerf the resistive classes --- maps/pirates/balance.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maps/pirates/balance.lua b/maps/pirates/balance.lua index a140e149..071c9621 100644 --- a/maps/pirates/balance.lua +++ b/maps/pirates/balance.lua @@ -37,13 +37,13 @@ Public.class_reward_tick_rate_in_seconds = 7 Public.poison_damage_multiplier = 1.85 Public.every_nth_tree_gives_coins = 6 -Public.samurai_damage_taken_multiplier = 0.26 +Public.samurai_damage_taken_multiplier = 0.40 Public.samurai_damage_dealt_when_not_melee_multiplier = 0.75 Public.samurai_damage_dealt_with_melee = 25 -Public.hatamoto_damage_taken_multiplier = 0.16 +Public.hatamoto_damage_taken_multiplier = 0.25 Public.hatamoto_damage_dealt_when_not_melee_multiplier = 0.75 Public.hatamoto_damage_dealt_with_melee = 45 -Public.iron_leg_damage_taken_multiplier = 0.18 +Public.iron_leg_damage_taken_multiplier = 0.20 Public.iron_leg_iron_ore_required = 3000 Public.deckhand_extra_speed = 1.25 Public.deckhand_ore_grant_multiplier = 5 From 2695cbb52e84d208bed01732e76eb14862766cd2 Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Fri, 2 Dec 2022 22:23:32 +0000 Subject: [PATCH 10/21] Update balance.lua --- maps/pirates/balance.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maps/pirates/balance.lua b/maps/pirates/balance.lua index 071c9621..14a5d1c4 100644 --- a/maps/pirates/balance.lua +++ b/maps/pirates/balance.lua @@ -37,13 +37,13 @@ Public.class_reward_tick_rate_in_seconds = 7 Public.poison_damage_multiplier = 1.85 Public.every_nth_tree_gives_coins = 6 -Public.samurai_damage_taken_multiplier = 0.40 +Public.samurai_damage_taken_multiplier = 0.38 Public.samurai_damage_dealt_when_not_melee_multiplier = 0.75 Public.samurai_damage_dealt_with_melee = 25 -Public.hatamoto_damage_taken_multiplier = 0.25 +Public.hatamoto_damage_taken_multiplier = 0.24 Public.hatamoto_damage_dealt_when_not_melee_multiplier = 0.75 Public.hatamoto_damage_dealt_with_melee = 45 -Public.iron_leg_damage_taken_multiplier = 0.20 +Public.iron_leg_damage_taken_multiplier = 0.21 Public.iron_leg_iron_ore_required = 3000 Public.deckhand_extra_speed = 1.25 Public.deckhand_ore_grant_multiplier = 5 From 00bff61411056e95f27775ab18306122b54d8884 Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Mon, 5 Dec 2022 17:53:16 +0000 Subject: [PATCH 11/21] ore spawns further away --- maps/pirates/surfaces/islands/hunt.lua | 8 ++++---- maps/pirates/surfaces/islands/islands.lua | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/maps/pirates/surfaces/islands/hunt.lua b/maps/pirates/surfaces/islands/hunt.lua index 897edacb..6134619f 100644 --- a/maps/pirates/surfaces/islands/hunt.lua +++ b/maps/pirates/surfaces/islands/hunt.lua @@ -141,9 +141,9 @@ end -function Public.close_position_try_avoiding_entities(args, points_to_avoid, farness_boost_low, farness_boost_high) - farness_boost_low = farness_boost_low or 0 - farness_boost_high = farness_boost_high or 0 +function Public.close_position_try_avoiding_entities(args, points_to_avoid, farness_low, farness_high) + farness_low = farness_low or 0.06 + farness_high = farness_high or 0.19 points_to_avoid = points_to_avoid or {} -- local memory = Memory.get_crew_memory() @@ -168,7 +168,7 @@ function Public.close_position_try_avoiding_entities(args, points_to_avoid, farn if (not Utils.contains(CoreData.tiles_that_conflict_with_resource_layer, tile.name)) and (not Utils.contains(CoreData.edgemost_tile_names, tile.name)) then local p3 = {x = p2.x + args.static_params.terraingen_coordinates_offset.x, y = p2.y + args.static_params.terraingen_coordinates_offset.y} - if IslandsCommon.island_farness_1(args)(p3) > 0.06 + farness_boost_low and IslandsCommon.island_farness_1(args)(p3) < 0.19 + farness_boost_high then + if IslandsCommon.island_farness_1(args)(p3) > farness_low and IslandsCommon.island_farness_1(args)(p3) < farness_high then local allowed = true if tries < 40 and #surface.find_entities({{p2.x - 8, p2.y - 8}, {p2.x + 8, p2.y + 8}}) > 0 then allowed = false diff --git a/maps/pirates/surfaces/islands/islands.lua b/maps/pirates/surfaces/islands/islands.lua index 05ea084b..14cafec0 100644 --- a/maps/pirates/surfaces/islands/islands.lua +++ b/maps/pirates/surfaces/islands/islands.lua @@ -169,15 +169,15 @@ function Public.spawn_ores_on_arrival(destination, points_to_avoid) noise_generator = Utils.noise_generator({}, 0), } - local farness_boost_low, farness_boost_high = 0, 0 + local farness_low, farness_high = 0.08, 0.28 if destination.subtype == enum.MAZE then - farness_boost_low = 0.08 - farness_boost_high = 0.25 + farness_low = 0.14 + farness_high = 0.44 end for _, ore in pairs(ores) do if destination.static_params.abstract_ore_amounts[ore] then - local p = Hunt.close_position_try_avoiding_entities(args, points_to_avoid, farness_boost_low, farness_boost_high) + local p = Hunt.close_position_try_avoiding_entities(args, points_to_avoid, farness_low, farness_high) if p then points_to_avoid[#points_to_avoid + 1] = {x=p.x, y=p.y, r=11} From e90dcfcdc3f229f1e197bccbe7b008037a61268c Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Mon, 5 Dec 2022 17:55:21 +0000 Subject: [PATCH 12/21] 28->29 --- maps/pirates/surfaces/islands/islands.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maps/pirates/surfaces/islands/islands.lua b/maps/pirates/surfaces/islands/islands.lua index 14cafec0..83e82f34 100644 --- a/maps/pirates/surfaces/islands/islands.lua +++ b/maps/pirates/surfaces/islands/islands.lua @@ -169,7 +169,7 @@ function Public.spawn_ores_on_arrival(destination, points_to_avoid) noise_generator = Utils.noise_generator({}, 0), } - local farness_low, farness_high = 0.08, 0.28 + local farness_low, farness_high = 0.08, 0.29 if destination.subtype == enum.MAZE then farness_low = 0.14 farness_high = 0.44 From 8470ffb40778d26317ecb6ca3a353fdbf4d5e66a Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Mon, 5 Dec 2022 17:56:31 +0000 Subject: [PATCH 13/21] Update balance.lua --- maps/pirates/balance.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/maps/pirates/balance.lua b/maps/pirates/balance.lua index 14a5d1c4..76ffd3de 100644 --- a/maps/pirates/balance.lua +++ b/maps/pirates/balance.lua @@ -261,7 +261,9 @@ function Public.base_evolution_leagues(leagues) evo = (0.0201 * (overworldx/40)) * Math.sloped(Common.difficulty_scale(), 1/5) local difficulty_name = CoreData.get_difficulty_option_informal_name_from_value(Common.difficulty_scale()) - if difficulty_name == 'hard' then + if difficulty_name == 'normal' then + evo = evo + 0.01 + elseif difficulty_name == 'hard' then evo = evo + 0.02 elseif difficulty_name == 'nightmare' then evo = evo + 0.04 From cd54bc93f7ecf1ca9371d26fc8cf048dcf349b91 Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Tue, 6 Dec 2022 16:22:29 +0000 Subject: [PATCH 14/21] only boot captain for afk if there are 4 or less players online --- maps/pirates/roles/roles.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/maps/pirates/roles/roles.lua b/maps/pirates/roles/roles.lua index ea3a8df8..d6ed16ab 100644 --- a/maps/pirates/roles/roles.lua +++ b/maps/pirates/roles/roles.lua @@ -315,7 +315,8 @@ function Public.afk_player_tick(player) -- local global_memory = Memory.get_global_memory() local memory = Memory.get_crew_memory() - if Common.is_captain(player) and #Common.crew_get_nonafk_crew_members() > 0 then + if Common.is_captain(player) and #Common.crew_get_nonafk_crew_members() >= 5 then + -- in this case, lose captainhood local force = memory.force if force and force.valid then From 3e133bc8867eaf6e5f4ef0e7dff5b5fdbe3508e8 Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Tue, 6 Dec 2022 16:23:00 +0000 Subject: [PATCH 15/21] Update roles.lua --- maps/pirates/roles/roles.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maps/pirates/roles/roles.lua b/maps/pirates/roles/roles.lua index d6ed16ab..bf8cf6d5 100644 --- a/maps/pirates/roles/roles.lua +++ b/maps/pirates/roles/roles.lua @@ -315,7 +315,7 @@ function Public.afk_player_tick(player) -- local global_memory = Memory.get_global_memory() local memory = Memory.get_crew_memory() - if Common.is_captain(player) and #Common.crew_get_nonafk_crew_members() >= 5 then + if Common.is_captain(player) and #Common.crew_get_nonafk_crew_members() >= 6 then -- in this case, lose captainhood local force = memory.force From 55519489b85d30d0d1e7c59b15a6e2b6ea518435 Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Wed, 7 Dec 2022 19:16:22 +0000 Subject: [PATCH 16/21] partially reverse prior changes; increase machinery pollution --- maps/pirates/balance.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/maps/pirates/balance.lua b/maps/pirates/balance.lua index 76ffd3de..d0b53902 100644 --- a/maps/pirates/balance.lua +++ b/maps/pirates/balance.lua @@ -37,13 +37,13 @@ Public.class_reward_tick_rate_in_seconds = 7 Public.poison_damage_multiplier = 1.85 Public.every_nth_tree_gives_coins = 6 -Public.samurai_damage_taken_multiplier = 0.38 +Public.samurai_damage_taken_multiplier = 0.32 Public.samurai_damage_dealt_when_not_melee_multiplier = 0.75 Public.samurai_damage_dealt_with_melee = 25 -Public.hatamoto_damage_taken_multiplier = 0.24 +Public.hatamoto_damage_taken_multiplier = 0.21 Public.hatamoto_damage_dealt_when_not_melee_multiplier = 0.75 Public.hatamoto_damage_dealt_with_melee = 45 -Public.iron_leg_damage_taken_multiplier = 0.21 +Public.iron_leg_damage_taken_multiplier = 0.24 Public.iron_leg_iron_ore_required = 3000 Public.deckhand_extra_speed = 1.25 Public.deckhand_ore_grant_multiplier = 5 @@ -94,7 +94,7 @@ Public.EEI_stages = { --multipliers function Public.scripted_biters_pollution_cost_multiplier() - return 1.45 / Math.sloped(Common.difficulty_scale(), 1/2) * (1 + 1.2 / ((1 + (Common.overworldx()/40))^(1.5+Common.difficulty_scale()))) -- the complicated factor just makes the early-game easier; in particular the first island, but on easier difficulties the next few islands as well + return 1.25 / Math.sloped(Common.difficulty_scale(), 1/2) * (1 + 1.2 / ((1 + (Common.overworldx()/40))^(1.5+Common.difficulty_scale()))) -- the complicated factor just makes the early-game easier; in particular the first island, but on easier difficulties the next few islands as well end function Public.cost_to_leave_multiplier() @@ -212,7 +212,7 @@ end function Public.silo_total_pollution() return ( - 365 * (Common.difficulty_scale()^(1.1)) * Public.crew_scale()^(3/10) * (3.2 + 0.7 * (Common.overworldx()/40)^(1.6)) --shape of the curve with x is tuned. + 347 * (Common.difficulty_scale()^(1.0)) * Public.crew_scale()^(3/10) * (3.2 + 0.7 * (Common.overworldx()/40)^(1.6)) --shape of the curve with x is tuned. ) end @@ -246,7 +246,7 @@ function Public.boat_passive_pollution_per_minute(time) end return boost * ( - 2.73 * (Common.difficulty_scale()^(1.1)) * (Common.overworldx()/40)^(1.8) * (Public.crew_scale())^(52/100)-- There is no _explicit_ T dependence, but it depends almost the same way on the crew_scale as T does. + 2.60 * (Common.difficulty_scale()^(0.8)) * (Common.overworldx()/40)^(1.8) * (Public.crew_scale())^(52/100)-- There is no _explicit_ T dependence, but it depends almost the same way on the crew_scale as T does. ) end From 03bc1ab811b0ca5f8ba86cafee2ed460dcc708d5 Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Wed, 7 Dec 2022 19:16:43 +0000 Subject: [PATCH 17/21] slight difficulty value adjustments --- maps/pirates/coredata.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maps/pirates/coredata.lua b/maps/pirates/coredata.lua index 83f74836..fb3cbcc1 100644 --- a/maps/pirates/coredata.lua +++ b/maps/pirates/coredata.lua @@ -120,11 +120,11 @@ Public.difficulty_options = { --For the value of Easy difficulty, we are pulled in two directions: We wish to make the game comfy to play for those who haven't played it, but we also wish to represent the game mechanics faithfully so that Normal is not a crazy distance away. {value = 0.5, icon = 'item/firearm-magazine', text = {'pirates.difficulty_easy'}, associated_color = {r = 50, g = 255, b = 50}}, - {value = 0.9, icon = 'item/piercing-rounds-magazine', text = {'pirates.difficulty_normal'}, associated_color = {r = 255, g = 255, b = 50}}, + {value = 0.95, icon = 'item/piercing-rounds-magazine', text = {'pirates.difficulty_normal'}, associated_color = {r = 255, g = 255, b = 50}}, - {value = 1.4, icon = 'item/uranium-rounds-magazine', text = {'pirates.difficutly_hard'}, associated_color = {r = 255, g = 50, b = 50}}, + {value = 1.5, icon = 'item/uranium-rounds-magazine', text = {'pirates.difficutly_hard'}, associated_color = {r = 255, g = 50, b = 50}}, - {value = 2.1, icon = 'item/atomic-bomb', text = {'pirates.difficulty_nightmare'}, associated_color = {r = 170, g = 60, b = 60}}, + {value = 2.2, icon = 'item/atomic-bomb', text = {'pirates.difficulty_nightmare'}, associated_color = {r = 170, g = 60, b = 60}}, } function Public.get_difficulty_option_from_value(difficulty_value) -- given a difficulty value, key in to the closesy entry in the above table. (organising things this way allows us to make changes to the 'value' keys in the above table without disrupting e.g. past highscores data) From ad64904c55d035e339f1408882b21d64e1d64a46 Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Wed, 7 Dec 2022 19:18:17 +0000 Subject: [PATCH 18/21] changelog --- locale/en/pirates.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locale/en/pirates.cfg b/locale/en/pirates.cfg index 729bb78e..349dc966 100644 --- a/locale/en/pirates.cfg +++ b/locale/en/pirates.cfg @@ -16,7 +16,7 @@ softmod_info_tips_1=Features of the game that are hard to work out alone softmod_info_tips_2=• The captain can steer the boat from the crow's nest by placing 100 rail signals in one of the blue boxes.\n• Resources granted to the ship appear in the captain's cabin.\n• Charging a silo drains power from everything else on its network.\n• The quantity of ore available on an island is independent of the order in which you break rocks.\n• Passive pollution ramps up over time on each island.\n• The strength of attacks is proportional to the number of remaining nests. (The time-based rate of evolution is proportional to nests too, but destroying a nest will immediately jump evolution by most of the amount it 'would have' made had it survived.)\n• Lab productivity increases with each league.\n• item-on-ground entities on the deck are moved to the cabin when the boat moves, for performance reasons.\n• Commands: /ccolor gives you a fun color. /classinfo {classname} gives the description of the named class. To manage your class, use /take {classname} or /giveup. softmod_info_updates_1=Significant recent changes -softmod_info_updates_2=v1.4.2\n• Disabled 'disband crew' button.\n• Increased amount of fish caught by all fishing classes.\n• Enabled concrete tech.\n• Fixed Mysterious caves island always having the same layout.\n• Fixed issue where power could get disconnected between deck and hold.\n• Added /clear_north_tanks and /clear_south_tanks commands to clear fluid from ship's storage tanks.\n• Difficulty of Hard and Nightmare slightly increased.\n\nv1.4.1\n• Cannon upgrade is now more expensive and appears less often.\n• Bugfixes.\n\nv1.4.0\n• New private runs: Protect your run by a password.\n• New island: Mysterious caves.\n• New technologies now available: Car and nuclear energy.\n• New way to unlock extra holds and power upgrades.\n• Various island related balance changes. +softmod_info_updates_2=v1.4.2\n• Disabled 'disband crew' button.\n• Increased amount of fish caught by all fishing classes.\n• Enabled concrete tech.\n• Fixed Mysterious caves island always having the same layout.\n• Fixed issue where power could get disconnected between deck and hold.\n• Added /clear_north_tanks and /clear_south_tanks commands to clear fluid from ship's storage tanks.\n• Difficulty of Hard and Nightmare increased. Resistive roles slightly nerfed.\n\nv1.4.0\n• New private runs: Protect your run by a password.\n• New island: Mysterious caves.\n• New technologies now available: Car and nuclear energy.\n• New way to unlock extra holds and power upgrades.\n• Various island related balance changes. softmod_info_credits_1=Credits softmod_info_credits_2=Pirate Ship designed and coded by thesixthroc. Updates from Piratux. Comfy codebase and help from Gerkiz, Hanakocz and Mew @ Comfy Industries (https://getcomfy.eu). Some island structure blueprints contributed by Mattisso.\n\nCome chat with us: https://getcomfy.eu/discord\n\n"Those white gloves. I'll never forget them 'till the day I die." - Dr. John From c7ec4a305a917e98620d18fefca163952e20c214 Mon Sep 17 00:00:00 2001 From: danielmartin0 Date: Wed, 7 Dec 2022 19:19:34 +0000 Subject: [PATCH 19/21] Update islands.lua --- maps/pirates/surfaces/islands/islands.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maps/pirates/surfaces/islands/islands.lua b/maps/pirates/surfaces/islands/islands.lua index 83e82f34..2f78385d 100644 --- a/maps/pirates/surfaces/islands/islands.lua +++ b/maps/pirates/surfaces/islands/islands.lua @@ -169,7 +169,7 @@ function Public.spawn_ores_on_arrival(destination, points_to_avoid) noise_generator = Utils.noise_generator({}, 0), } - local farness_low, farness_high = 0.08, 0.29 + local farness_low, farness_high = 0.06, 0.25 if destination.subtype == enum.MAZE then farness_low = 0.14 farness_high = 0.44 From 1d6e82b4f74e81bc4fdb867cda3845b25fd75557 Mon Sep 17 00:00:00 2001 From: Gerkiz Date: Tue, 20 Dec 2022 13:48:28 +0100 Subject: [PATCH 20/21] Towny - fixes --- functions/soft_reset.lua | 16 ++-- maps/scrap_towny_ffa/building.lua | 20 +++- maps/scrap_towny_ffa/limited_radar.lua | 12 ++- maps/scrap_towny_ffa/main.lua | 14 +-- maps/scrap_towny_ffa/nauvis.lua | 91 ++++++------------- maps/scrap_towny_ffa/player.lua | 6 +- maps/scrap_towny_ffa/reset.lua | 16 ++-- .../scrap_towny_ffa_layout.lua | 13 ++- maps/scrap_towny_ffa/table.lua | 1 + maps/scrap_towny_ffa/team.lua | 48 +++++++--- 10 files changed, 134 insertions(+), 103 deletions(-) diff --git a/functions/soft_reset.lua b/functions/soft_reset.lua index f1f6576d..7c597d58 100644 --- a/functions/soft_reset.lua +++ b/functions/soft_reset.lua @@ -178,15 +178,17 @@ local function teleport_players(surface, small_force_chunk) end local function equip_players(player_starting_items) - for k, player in pairs(game.connected_players) do + for _, player in pairs(game.connected_players) do if player.character then player.character.destroy() end player.character = nil player.set_controller({type = defines.controllers.god}) player.create_character() - for item, amount in pairs(player_starting_items) do - player.insert({name = item, count = amount}) + if player_starting_items then + for item, amount in pairs(player_starting_items) do + player.insert({name = item, count = amount}) + end end Modifiers.update_player_modifiers(player) end @@ -261,10 +263,10 @@ function Public.get_reset_counter() end --- Customizes the message with the mapkeeper param. ----@param boolean -function Public.enable_mapkeeper(boolean) - if boolean and type(boolean) == 'boolean' then - this.enable_mapkeeper = boolean or false +---@param state boolean +function Public.enable_mapkeeper(state) + if state and type(state) == 'boolean' then + this.enable_mapkeeper = state or false end end diff --git a/maps/scrap_towny_ffa/building.lua b/maps/scrap_towny_ffa/building.lua index a1b1cf55..7a3c3cfb 100644 --- a/maps/scrap_towny_ffa/building.lua +++ b/maps/scrap_towny_ffa/building.lua @@ -160,7 +160,13 @@ function Public.near_another_town(force_name, position, surface, radius) end function Public.in_restricted_zone(surface, position) - if surface.name ~= 'nauvis' then + local this = ScenarioTable.get_table() + local map_surface = game.get_surface(this.active_surface_index) + if not map_surface or not map_surface.valid then + return + end + + if surface.name ~= map_surface.name then return false end local chunk_position = {} @@ -205,7 +211,11 @@ local function prevent_landfill_in_restricted_zone(event) if tile == nil or not tile.valid then return end - local surface = game.surfaces[event.surface_index] + local this = ScenarioTable.get_table() + local surface = game.get_surface(this.active_surface_index) + if not surface or not surface.valid then + return + end local fail = false local position for _, t in pairs(event.tiles) do @@ -275,7 +285,11 @@ local function prevent_tiles_near_towns(event) if tile == nil or not tile.valid then return end - local surface = game.surfaces[event.surface_index] + local this = ScenarioTable.get_table() + local surface = game.get_surface(this.active_surface_index) + if not surface or not surface.valid then + return + end local force_name if player_index ~= nil then local player = game.get_player(player_index) diff --git a/maps/scrap_towny_ffa/limited_radar.lua b/maps/scrap_towny_ffa/limited_radar.lua index f2ae739f..9947006d 100644 --- a/maps/scrap_towny_ffa/limited_radar.lua +++ b/maps/scrap_towny_ffa/limited_radar.lua @@ -8,10 +8,14 @@ function Public.reset() if this.testing_mode then return end + local map_surface = game.get_surface(this.active_surface_index) + if not map_surface or not map_surface.valid then + return + end for index = 1, table.size(game.forces), 1 do local force = game.forces[index] if force ~= nil then - force.clear_chart('nauvis') + force.clear_chart(map_surface.name) end end end @@ -39,7 +43,11 @@ local function update_forces(id) end local function on_chunk_charted(event) - local surface = game.surfaces[event.surface_index] + local this = ScenarioTable.get_table() + local surface = game.get_surface(this.active_surface_index) + if not surface or not surface.valid then + return + end local force = event.force local area = event.area local markets = surface.find_entities_filtered({area = area, name = 'market'}) diff --git a/maps/scrap_towny_ffa/main.lua b/maps/scrap_towny_ffa/main.lua index 7e9416c0..5b948cdb 100644 --- a/maps/scrap_towny_ffa/main.lua +++ b/maps/scrap_towny_ffa/main.lua @@ -97,22 +97,22 @@ local function update_score() }, field2 = { text1 = 'Town researched:', - text2 = winner.name .. ' with a score of ' .. winner.research_counter .. ' techs!', + text2 = winner.research_counter .. ' techs!', inline = 'false' }, field3 = { text1 = 'Town upgrades:', - text2 = winner.name .. ' upgraded their town with:\nCrafting speed:' .. winner.upgrades.crafting_speed .. '\nMining speed:' .. winner.upgrades.mining_speed, + text2 = 'Crafting speed:' .. winner.upgrades.crafting_speed .. '\nMining speed:' .. winner.upgrades.mining_speed, inline = 'false' }, field4 = { text1 = 'Town health:', - text2 = winner.name .. ' had a health of ' .. winner.health .. ' left!', + text2 = winner.health .. 'hp left!', inline = 'false' }, field5 = { text1 = 'Town coins:', - text2 = winner.name .. ' had ' .. winner.coin_balance .. ' coins stashed!', + text2 = winner.coin_balance .. ' coins stashed!', inline = 'false' } } @@ -135,7 +135,9 @@ local function update_score() subheader.style.horizontally_stretchable = true subheader.style.vertical_align = 'center' - subheader.add {type = 'label', style = 'subheader_label', caption = {'', 'Survive 2 days (48h) to win!'}} + local days = this.required_time_to_win / 24 + + subheader.add {type = 'label', style = 'subheader_label', caption = {'', 'Survive for ' .. days .. ' days (' .. this.required_time_to_win .. 'h) to win!'}} if not next(subheader.children) then subheader.destroy() @@ -246,8 +248,6 @@ local function on_nth_tick(event) if not tick_actions[seconds] then return end - --game.surfaces['nauvis'].play_sound({path = 'utility/alert_destroyed', volume_modifier = 1}) - --log('seconds = ' .. seconds) tick_actions[seconds]() end diff --git a/maps/scrap_towny_ffa/nauvis.lua b/maps/scrap_towny_ffa/nauvis.lua index 0e7e146a..9bb01ff1 100644 --- a/maps/scrap_towny_ffa/nauvis.lua +++ b/maps/scrap_towny_ffa/nauvis.lua @@ -1,5 +1,6 @@ local Event = require 'utils.event' local ScenarioTable = require 'maps.scrap_towny_ffa.table' +local SoftReset = require 'functions.soft_reset' local math_random = math.random local table_shuffle = table.shuffle_table @@ -11,8 +12,12 @@ local map_width = 2560 local map_height = 2560 function Public.nuke(position) - local surface = game.surfaces['nauvis'] - surface.create_entity({name = 'atomic-rocket', position = position, target = position, speed = 0.5}) + local this = ScenarioTable.get_table() + local map_surface = game.get_surface(this.active_surface_index) + if not map_surface or not map_surface.valid then + return + end + map_surface.create_entity({name = 'atomic-rocket', position = position, target = position, speed = 0.5}) end function Public.armageddon() @@ -63,14 +68,10 @@ function Public.armageddon() end function Public.initialize() - if game.surfaces['nauvis'] then - -- clear the surface - game.surfaces['nauvis'].clear(false) - end - local surface = game.surfaces['nauvis'] - + local this = ScenarioTable.get_table() + local surface_seed = game.surfaces['nauvis'] -- this overrides what is in the map_gen_settings.json file - local mgs = surface.map_gen_settings + local mgs = surface_seed.map_gen_settings mgs.default_enable_all_autoplace_controls = true -- don't mess with this! mgs.autoplace_controls = { coal = {frequency = 2, size = 0.1, richness = 0.2}, @@ -106,10 +107,6 @@ function Public.initialize() cliff_elevation_interval = 10, richness = 0.4 } - -- water = 0 means no water allowed - -- water = 1 means elevation is not reduced when calculating water tiles (elevation < 0) - -- water = 2 means elevation is reduced by 10 when calculating water tiles (elevation < 0) - -- or rather, the water table is 10 above the normal elevation mgs.water = 0.5 mgs.peaceful_mode = false mgs.starting_area = 'none' @@ -120,56 +117,10 @@ function Public.initialize() --mgs.starting_points = { -- {x = 0, y = 0} --} - -- here we put the named noise expressions for the specific noise-layer if we want to override them mgs.property_expression_names = { - -- here we are overriding the moisture noise-layer with a fixed value of 0 to keep moisture consistently dry across the map - -- it allows to free up the moisture noise expression - -- low moisture - --moisture = 0, - - -- here we are overriding the aux noise-layer with a fixed value to keep aux consistent across the map - -- it allows to free up the aux noise expression - -- aux should be not sand, nor red sand - --aux = 0.5, - - -- here we are overriding the temperature noise-layer with a fixed value to keep temperature consistent across the map - -- it allows to free up the temperature noise expression - -- temperature should be 20C or 68F - --temperature = 20, - - -- here we are overriding the cliffiness noise-layer with a fixed value of 0 to disable cliffs - -- it allows to free up the cliffiness noise expression (which may or may not be useful) - -- disable cliffs - --cliffiness = 0, - - -- we can disable starting lakes two ways, one by setting starting-lake-noise-amplitude = 0 - -- or by making the elevation a very large number - -- make sure starting lake amplitude is 0 to disable starting lakes ['starting-lake-noise-amplitude'] = 0, -- allow enemies to get up close on spawn ['starting-area'] = 0, - -- this accepts a string representing a named noise expression - -- or number to determine the elevation based on x, y and distance from starting points - -- we can not add a named noise expression at this point, we can only reference existing ones - -- if we have any custom noise expressions defined from a mod, we will be able to use them here - -- setting it to a fixed number would mean a flat map - -- elevation < 0 means there is water unless the water table has been changed - --elevation = -1, - --elevation = 0, - --elevation-persistence = 0, - - -- testing - --["control-setting:moisture:bias"] = 0.5, - --["control-setting:moisture:frequency:multiplier"] = 0, - --["control-setting:aux:bias"] = 0.5, - --["control-setting:aux:frequency:multiplier"] = 1, - --["control-setting:temperature:bias"] = 0.01, - --["control-setting:temperature:frequency:multiplier"] = 100, - - --["tile:water:probability"] = -1000, - --["tile:deep-water:probability"] = -1000, - - -- a constant intensity means base distribution will be consistent with regard to distance ['enemy-base-intensity'] = 1, -- adjust this value to set how many nests spawn per tile ['enemy-base-frequency'] = 0.4, @@ -177,6 +128,23 @@ function Public.initialize() ['enemy-base-radius'] = 12 } mgs.seed = math_random(10000, 999999) + + if not this.active_surface_index then + this.active_surface_index = game.create_surface('towny', mgs).index + else + this.active_surface_index = SoftReset.soft_reset_map(game.surfaces[this.active_surface_index], mgs, nil).index + end + + local surface = game.get_surface(this.active_surface_index) + if not surface or not surface.valid then + return + end + + if math.random(1, 32) == 1 then + this.required_time_to_win = 168 + this.required_time_to_win_in_ticks = 36288000 + end + surface.map_gen_settings = mgs surface.peaceful_mode = false surface.always_day = false @@ -184,11 +152,6 @@ function Public.initialize() surface.clear(true) surface.regenerate_entity({'rock-huge', 'rock-big', 'sand-rock-big'}) surface.regenerate_decorative() - -- this will force generate the entire map - --Server.to_discord_embed('ScrapTownyFFA Map Regeneration in Progress') - --surface.request_to_generate_chunks({x=0,y=0},64) - --surface.force_generate_chunk_requests() - --Server.to_discord_embed('Regeneration Complete') end local function on_tick() diff --git a/maps/scrap_towny_ffa/player.lua b/maps/scrap_towny_ffa/player.lua index bf7e2764..5cfe7d34 100644 --- a/maps/scrap_towny_ffa/player.lua +++ b/maps/scrap_towny_ffa/player.lua @@ -44,7 +44,11 @@ end function Public.spawn(player) -- first time spawn point - local surface = game.surfaces['nauvis'] + local this = ScenarioTable.get_table() + local surface = game.get_surface(this.active_surface_index) + if not surface or not surface.valid then + return + end local spawn_point = Spawn.get_new_spawn_point(player, surface) local this = ScenarioTable.get() this.strikes[player.name] = 0 diff --git a/maps/scrap_towny_ffa/reset.lua b/maps/scrap_towny_ffa/reset.lua index 6d256b33..3657edab 100644 --- a/maps/scrap_towny_ffa/reset.lua +++ b/maps/scrap_towny_ffa/reset.lua @@ -11,7 +11,6 @@ local table_insert = table.insert -- game duration in ticks -- 7d * 24h * 60m * 60s * 60t -- local game_duration = 36288000 -local game_duration = 36288000 local armageddon_duration = 3600 local warning_duration = 600 local mapkeeper = '[color=blue]Mapkeeper:[/color]' @@ -58,7 +57,10 @@ local function do_soft_reset() this.game_reset_tick = nil this.game_won = false ScenarioTable.reset_table() - local surface = game.surfaces['nauvis'] + local surface = game.get_surface(this.active_surface_index) + if not surface or not surface.valid then + return + end if get_victorious_force() then surface.play_sound({path = 'utility/game_won', volume_modifier = 1}) else @@ -152,17 +154,19 @@ local function on_tick() end end - if (tick + armageddon_duration + warning_duration) % game_duration == 0 then + local required_time_to_win_in_ticks = ScenarioTable.get('required_time_to_win_in_ticks') + + if (tick + armageddon_duration + warning_duration) % required_time_to_win_in_ticks == 0 then warning() end - if (tick + armageddon_duration) % game_duration == 0 then + if (tick + armageddon_duration) % required_time_to_win_in_ticks == 0 then armageddon() end - if (tick + 1) % game_duration == 0 then + if (tick + 1) % required_time_to_win_in_ticks == 0 then Nauvis.clear_nuke_schedule() Team.reset_all_forces() end - if tick % game_duration == 0 then + if tick % required_time_to_win_in_ticks == 0 then has_the_game_ended() end end diff --git a/maps/scrap_towny_ffa/scrap_towny_ffa_layout.lua b/maps/scrap_towny_ffa/scrap_towny_ffa_layout.lua index f8364cb4..6aacd7c7 100644 --- a/maps/scrap_towny_ffa/scrap_towny_ffa_layout.lua +++ b/maps/scrap_towny_ffa/scrap_towny_ffa_layout.lua @@ -266,7 +266,12 @@ end local function on_chunk_generated(event) --log("scrap_towny_ffa::on_chunk_generated") local surface = event.surface - if (surface.name ~= 'nauvis') then + local this = ScenarioTable.get_table() + local map_surface = game.get_surface(this.active_surface_index) + if not map_surface or not map_surface.valid then + return + end + if (surface.name ~= map_surface.name) then return end local seed = surface.map_gen_settings.seed @@ -329,7 +334,11 @@ end local function on_chunk_charted(event) local force = event.force - local surface = game.surfaces[event.surface_index] + local this = ScenarioTable.get_table() + local surface = game.get_surface(this.active_surface_index) + if not surface or not surface.valid then + return + end if force.valid then if force == game.forces['player'] or force == game.forces['rogue'] then force.clear_chart(surface) diff --git a/maps/scrap_towny_ffa/table.lua b/maps/scrap_towny_ffa/table.lua index e6a46143..6c2919c2 100644 --- a/maps/scrap_towny_ffa/table.lua +++ b/maps/scrap_towny_ffa/table.lua @@ -38,6 +38,7 @@ function Public.reset_table() this.spaceships = {} this.suicides = {} this.required_time_to_win = 48 + this.required_time_to_win_in_ticks = 10368000 this.announced_message = nil this.soft_reset = true this.winner = nil diff --git a/maps/scrap_towny_ffa/team.lua b/maps/scrap_towny_ffa/team.lua index 353c7afa..7e4f6f20 100644 --- a/maps/scrap_towny_ffa/team.lua +++ b/maps/scrap_towny_ffa/team.lua @@ -532,11 +532,15 @@ function Public.update_town_chart_tags() end end end + local surface = game.get_surface(this.active_surface_index) + if not surface or not surface.valid then + return + end if game.forces['player'] ~= nil then - game.forces['player'].clear_chart(game.surfaces['nauvis']) + game.forces['player'].clear_chart(surface) end if game.forces['rogue'] ~= nil then - game.forces['rogue'].clear_chart(game.surfaces['nauvis']) + game.forces['rogue'].clear_chart(surface) end end @@ -680,16 +684,16 @@ local function disable_cluster_grenades(force) force.recipes['cluster-grenade'].enabled = false end -local function enable_radar(force) +local function enable_radar(surface, force) force.recipes['radar'].enabled = true force.share_chart = true - force.clear_chart('nauvis') + force.clear_chart(surface.name) end -local function disable_radar(force) +local function disable_radar(surface, force) force.recipes['radar'].enabled = false force.share_chart = false - force.clear_chart('nauvis') + force.clear_chart(surface.name) end local function disable_achievements(permission_group) @@ -705,6 +709,10 @@ function Public.add_new_force(force_name) local this = ScenarioTable.get_table() -- disable permissions local force = game.create_force(force_name) + local surface = game.get_surface(this.active_surface_index) + if not surface or not surface.valid then + return + end local permission_group = game.permissions.create_group(force_name) reset_permissions(permission_group) enable_blueprints(permission_group) @@ -714,7 +722,7 @@ function Public.add_new_force(force_name) disable_rockets(force) disable_nukes(force) disable_cluster_grenades(force) - enable_radar(force) + enable_radar(surface, force) disable_achievements(permission_group) disable_tips_and_tricks(permission_group) -- friendly fire @@ -858,8 +866,13 @@ local function kill_force(force_name, cause) end local function on_forces_merged() + local this = ScenarioTable.get_table() + local map_surface = game.get_surface(this.active_surface_index) + if not map_surface or not map_surface.valid then + return + end -- Remove any ghosts that have been moved into neutral after a town is destroyed. This caused desyncs before. - for _, e in pairs(game.surfaces.nauvis.find_entities_filtered({force = 'neutral', type = 'entity-ghost'})) do + for _, e in pairs(map_surface.find_entities_filtered({force = 'neutral', type = 'entity-ghost'})) do if e.valid then e.destroy() end @@ -888,6 +901,10 @@ local function setup_player_force() local force = game.forces.player local permission_group = game.permissions.create_group('outlander') -- disable permissions + local surface = game.get_surface(this.active_surface_index) + if not surface or not surface.valid then + return + end reset_permissions(permission_group) disable_blueprints(permission_group) disable_deconstruct(permission_group) @@ -896,7 +913,7 @@ local function setup_player_force() disable_rockets(force) disable_nukes(force) disable_cluster_grenades(force) - disable_radar(force) + disable_radar(surface, force) disable_achievements(permission_group) disable_tips_and_tricks(permission_group) -- disable research @@ -926,6 +943,10 @@ local function setup_rogue_force() end local permission_group = game.permissions.create_group('rogue') -- disable permissions + local surface = game.get_surface(this.active_surface_index) + if not surface or not surface.valid then + return + end reset_permissions(permission_group) disable_blueprints(permission_group) disable_deconstruct(permission_group) @@ -934,7 +955,7 @@ local function setup_rogue_force() disable_rockets(force) disable_nukes(force) disable_cluster_grenades(force) - disable_radar(force) + disable_radar(surface, force) disable_achievements(permission_group) disable_tips_and_tricks(permission_group) -- disable research @@ -1090,7 +1111,12 @@ local function on_post_entity_died(event) if prototype ~= 'character' then return end - local entities = game.surfaces[event.surface_index].find_entities_filtered({position = event.position, radius = 1}) + local this = ScenarioTable.get_table() + local surface = game.get_surface(this.active_surface_index) + if not surface or not surface.valid then + return + end + local entities = surface.find_entities_filtered({position = event.position, radius = 1}) for _, e in pairs(entities) do if e.type == 'character-corpse' then Public.remove_key(e.character_corpse_player_index) From 4506ebb289a2177a57948effab4860f5e946b2d6 Mon Sep 17 00:00:00 2001 From: Gerkiz Date: Tue, 20 Dec 2022 13:49:27 +0100 Subject: [PATCH 21/21] Remove unused vars --- maps/scrap_towny_ffa/limited_radar.lua | 1 - maps/scrap_towny_ffa/player.lua | 1 - 2 files changed, 2 deletions(-) diff --git a/maps/scrap_towny_ffa/limited_radar.lua b/maps/scrap_towny_ffa/limited_radar.lua index 9947006d..e80c477f 100644 --- a/maps/scrap_towny_ffa/limited_radar.lua +++ b/maps/scrap_towny_ffa/limited_radar.lua @@ -53,7 +53,6 @@ local function on_chunk_charted(event) local markets = surface.find_entities_filtered({area = area, name = 'market'}) for _, market in pairs(markets) do local force_name = market.force.name - local this = ScenarioTable.get_table() local town_center = this.town_centers[force_name] if not town_center then return diff --git a/maps/scrap_towny_ffa/player.lua b/maps/scrap_towny_ffa/player.lua index 5cfe7d34..d817478e 100644 --- a/maps/scrap_towny_ffa/player.lua +++ b/maps/scrap_towny_ffa/player.lua @@ -50,7 +50,6 @@ function Public.spawn(player) return end local spawn_point = Spawn.get_new_spawn_point(player, surface) - local this = ScenarioTable.get() this.strikes[player.name] = 0 Spawn.clear_spawn_point(spawn_point, surface) -- reset cooldown