diff --git a/maps/pirates/ores.lua b/maps/pirates/ores.lua index f9343214..8bff2254 100644 --- a/maps/pirates/ores.lua +++ b/maps/pirates/ores.lua @@ -115,6 +115,8 @@ function Public.try_ore_spawn(surface, realp, source_name, density_bonus) ret = true end else + if not choice then return false end + local real_amount = Math.max(Common.minimum_ore_placed_per_tile, Common.ore_abstract_to_real(choices[choice])) local density = (density_bonus + 17 + 4 * Math.random()) -- not too big, and not too much variation; it makes players have to stay longer diff --git a/maps/pirates/overworld.lua b/maps/pirates/overworld.lua index 2d2f8a5d..c36a29af 100644 --- a/maps/pirates/overworld.lua +++ b/maps/pirates/overworld.lua @@ -45,9 +45,9 @@ local HORSESHOE = Surfaces.Island.enum.HORSESHOE local STANDARD_VARIANT = Surfaces.Island.enum.STANDARD_VARIANT local CAVE = Surfaces.Island.enum.CAVE -local A = {STANDARD_VARIANT, RED_DESERT, HORSESHOE, WALKWAYS, CAVE} +local A = {STANDARD_VARIANT, RED_DESERT, HORSESHOE, WALKWAYS} local B = {NIL, NIL, NIL, STANDARD, STANDARD_VARIANT, RED_DESERT, HORSESHOE, WALKWAYS, CAVE} -local C = {STANDARD, STANDARD_VARIANT, RED_DESERT, HORSESHOE, WALKWAYS, CAVE} +local C = {STANDARD, STANDARD_VARIANT, RED_DESERT, HORSESHOE, WALKWAYS} local D = {NIL, NIL, NIL, STANDARD, STANDARD_VARIANT, RED_DESERT, HORSESHOE, WALKWAYS, SWAMP, CAVE} local destinationScheme = { @@ -124,8 +124,7 @@ function Public.generate_destination_type_and_subtype(overworld_position) type2 = Surfaces.enum.ISLAND end - return {type = Surfaces.enum.ISLAND, subtype = Surfaces.Island.enum.CAVE} - --return {type = type2, subtype = subtype} + return {type = type2, subtype = subtype} end diff --git a/maps/pirates/quest.lua b/maps/pirates/quest.lua index ec846f88..1c90285c 100644 --- a/maps/pirates/quest.lua +++ b/maps/pirates/quest.lua @@ -147,26 +147,27 @@ function Public.initialise_nodamage_quest() end -function Public.initialise_resourceflow_quest() - local destination = Common.current_destination() +-- @UNUSED +-- function Public.initialise_resourceflow_quest() +-- local destination = Common.current_destination() - if not destination and destination.dynamic_data and destination.dynamic_data.rocketsilomaxhp then return false end +-- if not destination and destination.dynamic_data and destination.dynamic_data.rocketsilomaxhp then return false end - destination.dynamic_data.quest_type = enum.RESOURCEFLOW - destination.dynamic_data.quest_reward = Public.quest_reward() - destination.dynamic_data.quest_progress = 0 +-- destination.dynamic_data.quest_type = enum.RESOURCEFLOW +-- destination.dynamic_data.quest_reward = Public.quest_reward() +-- destination.dynamic_data.quest_progress = 0 - local generated_flow_quest = Public.generate_flow_quest() - if not generated_flow_quest then return false end +-- local generated_flow_quest = Public.generate_flow_quest() +-- if not generated_flow_quest then return false end - destination.dynamic_data.quest_params = {item = generated_flow_quest.item} +-- destination.dynamic_data.quest_params = {item = generated_flow_quest.item} - local progressneeded_before_rounding = generated_flow_quest.base_rate * Balance.resource_quest_multiplier() +-- local progressneeded_before_rounding = generated_flow_quest.base_rate * Balance.resource_quest_multiplier() - destination.dynamic_data.quest_progressneeded = Math.ceil(progressneeded_before_rounding/10) * 10 +-- destination.dynamic_data.quest_progressneeded = Math.ceil(progressneeded_before_rounding/10) * 10 - return true -end +-- return true +-- end function Public.initialise_resourcecount_quest() diff --git a/maps/pirates/raffle.lua b/maps/pirates/raffle.lua index 64b52262..2f820714 100644 --- a/maps/pirates/raffle.lua +++ b/maps/pirates/raffle.lua @@ -4,6 +4,7 @@ local Math = require 'maps.pirates.math' local Public = {} +-- @NOTE: Beware this function may return nil when there is at least 1 negative weight and guaranteed to return nil with all negative weights function Public.raffle(values, weights) --arguments of the form {[a] = A, [b] = B, ...} and {[a] = a_weight, [b] = b_weight, ...} or just {a,b,c,...} and {1,2,3...} local total_weight = 0 @@ -27,6 +28,7 @@ function Public.raffle(values, weights) --arguments of the form {[a] = A, [b] = end end +-- @NOTE: Beware this function may return nil when there is at least 1 negative weight and guaranteed to return nil with all negative weights function Public.raffle2(table) --arguments of the form {v1 = w1, v2 = w2, ...} local total_weight = 0 diff --git a/maps/pirates/structures/quest_structures/furnace1/furnace1.lua b/maps/pirates/structures/quest_structures/furnace1/furnace1.lua index d605c8da..28fdaa8c 100644 --- a/maps/pirates/structures/quest_structures/furnace1/furnace1.lua +++ b/maps/pirates/structures/quest_structures/furnace1/furnace1.lua @@ -277,6 +277,10 @@ function Public.entry_price() local item = Raffle.LambdaRaffle(Public.entry_price_data_raw, lambda) + if not item then + item = table.get_random_dictionary_entry(Public.entry_price_data_raw, true) + end + local batchSize = Public.entry_price_data_raw[item].itemBatchSize return { diff --git a/maps/pirates/structures/quest_structures/market1/market1.lua b/maps/pirates/structures/quest_structures/market1/market1.lua index cb5a26c1..7e1881f3 100644 --- a/maps/pirates/structures/quest_structures/market1/market1.lua +++ b/maps/pirates/structures/quest_structures/market1/market1.lua @@ -276,6 +276,10 @@ function Public.entry_price() local item = Raffle.LambdaRaffle(Public.entry_price_data_raw, lambda) + if not item then + item = table.get_random_dictionary_entry(Public.entry_price_data_raw, true) + end + local raw_materials = Public.entry_price_data_raw[item].raw_materials return {