1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-28 03:57:22 +02:00

Cave and desert island tweaks

CHANGES:
- Prevented situation where biter wave could spawn immediately upon revealing it in Mysterious Caves island.
- Fixed "All biter bases destroyed — escape cost removed." message appearing when arriving at Mysterious Caves island.
- Fixed GUI showing resource cost to leave Mysterious Caves island. It won't need any resources to undock in late game.
- Fixed Mysterious Caves island letting you stay infinitely in late game.
- Sandworm Caldera island now has auto undock timer.
- Sandworm Caldera island now doesn't have launch rocket as resource requirement.
- Reduced maximum amount of time you can stay in Sandworm Caldera island by 20%.
- Reduced maximum amount of time you can stay in Mysterious Caves island by 20%.
- Revealing a spawner in Mysterious Caves island, reveals nearby area and spawners around it.
This commit is contained in:
Piratux 2023-01-12 18:58:53 +02:00
parent 72178fafa9
commit 153a2016ed
15 changed files with 132 additions and 74 deletions

View File

@ -551,7 +551,7 @@ gui_etaframe_arriving_in=Arriving in
gui_etaframe_atsea_waiting=Captain — Click here to Sail
gui_etaframe_undock=Undock:
gui_etaframe_anytime=Anytime
gui_etaframe_nest_escape_cost=Next escape cost:
gui_etaframe_next_escape_cost=Next escape cost:
gui_etaframe_to_escape_store=To escape, store
gui_etaframe_or_store=Or store
gui_etaframe_rocket_requirement_tooltip=Launch a rocket

View File

@ -418,7 +418,7 @@ gui_etaframe_arriving_in=Прибываем через
gui_etaframe_atsea_waiting=Капитан - Нажмите здесь для отплытия
gui_etaframe_undock=Отчалить:
gui_etaframe_anytime=В любое время
gui_etaframe_nest_escape_cost=Цена следующего побега:
gui_etaframe_next_escape_cost=Цена следующего побега:
gui_etaframe_to_escape_store=Чтобы убежать, соберите
gui_etaframe_or_store=Или храните
gui_etaframe_rocket_requirement_tooltip=Запустите ракету

View File

@ -528,7 +528,7 @@ gui_etaframe_arriving_in=正在抵达
gui_etaframe_atsea_waiting=船长—点击这里继续冒险
gui_etaframe_undock=出坞:
gui_etaframe_anytime=随时
gui_etaframe_nest_escape_cost=下一个逃生成本:
gui_etaframe_next_escape_cost=下一个逃生成本:
gui_etaframe_to_escape_store=想要撤离,需要存储
gui_etaframe_or_store=或存储
gui_etaframe_rocket_requirement_tooltip=发射火箭

View File

@ -18,6 +18,7 @@ local IslandEnum = require 'maps.pirates.surfaces.islands.island_enum'
-- local Sea = require 'maps.pirates.surfaces.sea.sea'
-- local Crew = require 'maps.pirates.crew'
-- local Quest = require 'maps.pirates.quest'
local SurfacesCommon = require 'maps.pirates.surfaces.common'
local Public = {}
@ -61,7 +62,7 @@ function Public.Tick_actions(tickinterval)
end
-- if destination.subtype and destination.subtype == IslandEnum.enum.RED_DESERT then return end -- This was a hack to stop biter boats causing attacks, but, it has the even worse effect of stopping all floating_pollution gathering.
-- if destination.subtype == IslandEnum.enum.RED_DESERT then return end -- This was a hack to stop biter boats causing attacks, but, it has the even worse effect of stopping all floating_pollution gathering.
local minute_cycle = {-- warning: use even seconds only
@ -114,7 +115,7 @@ function Public.eat_up_fraction_of_all_pollution(surface, fraction_of_global_pol
surface.pollute(p, - pollution_to_eat)
-- Radioactive world doesn't absorb map pollution:
if not (Common.current_destination().subtype and Common.current_destination().subtype == IslandEnum.enum.RADIOACTIVE) then
if not (Common.current_destination().subtype == IslandEnum.enum.RADIOACTIVE) then
pollution_available = pollution_available + pollution_to_eat
end
end
@ -128,6 +129,14 @@ end
function Public.wave_size_rng() -- random variance in attack sizes
local memory = Memory.get_crew_memory()
local destination = Common.current_destination()
-- prevent situation where when player reveals spawner, he immediately gets surrounded by massive amount of biters (especially late game)
if destination and destination.type == SurfacesCommon.enum.ISLAND then
if destination.dynamic_data and destination.dynamic_data.disabled_wave_timer and destination.dynamic_data.disabled_wave_timer > 0 then
return 0
end
end
local wave_percentage_chance = Math.clamp(0, 50, 11 + 8 * memory.floating_pollution/1500)
@ -439,11 +448,11 @@ function Public.try_spawner_spend_fraction_of_available_pollution_on_biters(spaw
map_pollution_cost_multiplier = map_pollution_cost_multiplier * base_scripted_biters_pollution_cost_multiplier
if destination.subtype and destination.subtype == IslandEnum.enum.SWAMP then
if destination.subtype == IslandEnum.enum.SWAMP then
map_pollution_cost_multiplier = map_pollution_cost_multiplier * 0.95 --biters 5% more aggressive
end
-- if destination.subtype and destination.subtype == IslandEnum.enum.MAZE then
-- if destination.subtype == IslandEnum.enum.MAZE then
-- base_pollution_cost_multiplier = base_pollution_cost_multiplier * 1.2 --biters 20% less aggressive
-- end

View File

@ -59,10 +59,12 @@ function Public.silo_die()
if CoreData.rocket_silo_death_causes_loss then
-- Crew.lose_life()
Crew.try_lose({'pirates.loss_silo_destroyed'})
elseif (not destination.dynamic_data.rocketlaunched) and destination.static_params and destination.static_params.base_cost_to_undock and destination.static_params.base_cost_to_undock['launch_rocket'] and destination.static_params.base_cost_to_undock['launch_rocket'] == true and (not (destination.dynamic_data.time_remaining and destination.dynamic_data.time_remaining > 0)) then
Crew.try_lose({'pirates.loss_silo_destroyed_before_necessary_launch'})
elseif (not destination.dynamic_data.rocketlaunched) then
Common.notify_force(force, {'pirates.silo_destroyed'})
if destination.static_params and destination.static_params.base_cost_to_undock and destination.static_params.base_cost_to_undock['launch_rocket'] == true and Boats.need_resources_to_undock() then
Crew.try_lose({'pirates.loss_silo_destroyed_before_necessary_launch'})
else
Common.notify_force(force, {'pirates.silo_destroyed'})
end
end
end
@ -109,7 +111,7 @@ local function biters_chew_stuff_faster(event)
if (event.entity.force.index == 3 or event.entity.force.name == 'environment') then
event.entity.health = event.entity.health - event.final_damage_amount * 5
if destination and destination.type and destination.subtype and destination.type == Surfaces.enum.ISLAND and destination.subtype == IslandEnum.enum.MAZE then
if destination and destination.type == Surfaces.enum.ISLAND and destination.subtype == IslandEnum.enum.MAZE then
event.entity.health = event.entity.health - event.final_damage_amount * 10
end
elseif event.entity.name == 'pipe' then
@ -528,7 +530,7 @@ local function swamp_resist_poison(event)
if not (event.damage_type.name and event.damage_type.name == 'poison') then return end
local destination = Common.current_destination()
if not (destination and destination.subtype and destination.subtype == IslandEnum.enum.SWAMP) then return end
if not (destination and destination.subtype == IslandEnum.enum.SWAMP) then return end
if not (destination.surface_name == entity.surface.name) then return end
@ -546,7 +548,7 @@ local function maze_walls_resistance(event)
if not entity.valid then return end
local destination = Common.current_destination()
if not (destination and destination.subtype and destination.subtype == IslandEnum.enum.MAZE) then return end
if not (destination and destination.subtype == IslandEnum.enum.MAZE) then return end
if not (destination.surface_name == entity.surface.name) then return end

View File

@ -134,7 +134,7 @@ function Public.check_all_spawners_dead(tickinterval)
local destination = Common.current_destination()
local boat = memory.boat
if destination.static_params and destination.static_params.base_cost_to_undock and (not (destination.subtype and destination.subtype == IslandEnum.enum.RED_DESERT)) then
if destination.static_params and destination.static_params.base_cost_to_undock and (not (destination.subtype == IslandEnum.enum.RED_DESERT or destination.subtype == IslandEnum.enum.CAVE)) then
if boat and boat.surface_name and boat.surface_name == destination.surface_name then
local surface = game.surfaces[destination.surface_name]
if not (surface and surface.valid) then return end
@ -310,7 +310,7 @@ function Public.periodic_free_resources(tickinterval)
Common.give_items_to_crew(Balance.periodic_free_resources_per_destination_5_seconds())
if game.tick % (300*30) == 0 and (destination and destination.subtype and destination.subtype == IslandEnum.enum.RADIOACTIVE) then -- every 150 seconds
if game.tick % (300*30) == 0 and (destination and destination.subtype == IslandEnum.enum.RADIOACTIVE) then -- every 150 seconds
local count = 2
Common.give_items_to_crew{{name = 'sulfuric-acid-barrel', count = count}}
local force = memory.force
@ -1160,7 +1160,7 @@ function Public.slower_boat_tick(tickinterval)
end
local p = memory.boat.position
if p and (not (destination.subtype and destination.subtype == IslandEnum.enum.RADIOACTIVE)) and destination.surface_name and game.surfaces[destination.surface_name] and game.surfaces[destination.surface_name].valid then --no locomotive pollute on radioactive islands
if p and destination.subtype ~= IslandEnum.enum.RADIOACTIVE and destination.surface_name and game.surfaces[destination.surface_name] and game.surfaces[destination.surface_name].valid then --no locomotive pollute on radioactive islands
local pollution = Balance.boat_passive_pollution_per_minute(destination.dynamic_data.timer) / 3600 * tickinterval
game.surfaces[destination.surface_name].pollute(p, pollution)

View File

@ -80,6 +80,8 @@ Public.veteran_on_hit_slow_chance = 0.1
Public.maximum_fish_allowed_to_catch_at_sea = 30
Public.prevent_waves_from_spawning_in_cave_timer_length = 10 -- in seconds
function Public.starting_boatEEIpower_production_MW()
-- return 3 * Math.sloped(Common.capacity_scale(), 1/2) / 2 --/2 as we have 2

View File

@ -609,15 +609,15 @@ function Public.process_etaframe_update(player, flow1, bools)
-- local caption
if bools.atsea_loading_bool then
-- @TODO: Fix magic numbers here
if memory.overworldx >= Balance.rockets_needed_x and (not (memory.overworldx == 21 * 40)) then --bools.eta_bool is not helpful yet
flow2.etaframe_label_3.caption = {'pirates.gui_etaframe_nest_escape_cost'}
if Boats.need_resources_to_undock() then --bools.eta_bool is not helpful yet
flow2.etaframe_label_3.caption = {'pirates.gui_etaframe_next_escape_cost'}
if bools.cost_includes_rocket_launch_bool then
tooltip = {'pirates.resources_needed_tooltip_0_rocketvariant'}
else
tooltip = {'pirates.resources_needed_tooltip_0'}
end
else
flow2.etaframe_label_3.caption = {'pirates.gui_etaframe_nest_escape_cost'}
flow2.etaframe_label_3.caption = {'pirates.gui_etaframe_next_escape_cost'}
if bools.cost_includes_rocket_launch_bool then
tooltip = {'pirates.resources_needed_tooltip_1_rocketvariant'}
else

View File

@ -69,6 +69,8 @@ local Token = require 'utils.token'
local Task = require 'utils.task'
local Server = require 'utils.server'
local Math = require 'maps.pirates.math'
require 'utils.profiler'
local Public = {}
@ -225,6 +227,10 @@ local function crew_tick()
end
end
if destination.dynamic_data.disabled_wave_timer then
destination.dynamic_data.disabled_wave_timer = Math.max(0, destination.dynamic_data.disabled_wave_timer - 1)
end
if tick % 120 == 0 then
Ai.Tick_actions(120)

View File

@ -227,12 +227,19 @@ function Public.generate_destination_base_cost_to_undock(p, subtype)
base_cost_to_undock['launch_rocket'] = true
end
end
-- override:
if subtype == IslandEnum.enum.RADIOACTIVE then
base_cost_to_undock = {
['uranium-235'] = Math.ceil(Math.ceil(80 + (macro_p.x - 1))),
-- ['uranium-235'] = Math.ceil(Math.ceil(80 + (macro_p.x)/2)), --tried adding beacons instead of this
}
elseif subtype == IslandEnum.enum.CAVE then
base_cost_to_undock = nil -- make it a more chill island
elseif subtype == IslandEnum.enum.RED_DESERT then
if base_cost_to_undock and base_cost_to_undock['launch_rocket'] == true then
base_cost_to_undock['launch_rocket'] = false -- some extra variety
end
end
-- -- debug override:

View File

@ -1080,13 +1080,18 @@ local function teleport_handle_wake_tiles(boat, dummyboat, newsurface_name, olds
oldsurface.set_tiles(newtiles, true, false, true)
-- but since players don't die instantly, they can get stuck in water, this prevents this (even though it let's you walk in front of ship while ship is departing)
for _, player in pairs(Common.crew_get_crew_members()) do
if player.character and player.character.valid then
local tile = oldsurface.get_tile(player.character.position.x, player.character.position.y)
if Utils.contains(CoreData.water_tile_names, tile.name) then
local new_pos = oldsurface.find_non_colliding_position('character', player.character.position, 20, 0.1, true)
if new_pos then
player.character.teleport(new_pos)
-- NOTE: this will need to be changed, when ship doesn't necessarily arrive from the left
if vector.x < 0 then
for _, player in pairs(Common.crew_get_crew_members()) do
if player.character and player.character.valid then
local tile = oldsurface.get_tile(player.character.position.x, player.character.position.y)
if tile.valid then
if Utils.contains(CoreData.water_tile_names, tile.name) then
local new_pos = oldsurface.find_non_colliding_position('character', player.character.position, 20, 0.1, true)
if new_pos then
player.character.teleport(new_pos)
end
end
end
end
end
@ -1468,4 +1473,13 @@ function Public.clear_fluid_from_ship_tanks(idx)
end
end
function Public.need_resources_to_undock()
local destination = Common.current_destination()
if destination and destination.dynamic_data and destination.dynamic_data.time_remaining == -1 then
return true
else
return false
end
end
return Public

View File

@ -9,6 +9,7 @@ local SurfacesCommon = require 'maps.pirates.surfaces.common'
local BoatData = require 'maps.pirates.structures.boats.sloop.data'
local Event = require 'utils.event'
local IslandEnum = require 'maps.pirates.surfaces.islands.island_enum'
local Balance = require 'maps.pirates.balance'
local Public = {}
Public.Data = require 'maps.pirates.surfaces.islands.cave.data'
@ -63,32 +64,44 @@ function Public.reveal(cave_miner, surface, source_surface, position, brushsize)
source_surface.set_tiles(copied_tiles, false, false, false, false)
for _, entity in pairs(source_surface.find_entities_filtered({area = {{position.x - brushsize, position.y - brushsize}, {position.x + brushsize, position.y + brushsize}}})) do
local entity_position = entity.position
if (position.x - entity_position.x) ^ 2 + (position.y - entity_position.y) ^ 2 < brushsize_square then
local e = entity.clone({position = entity_position, surface = surface})
if e.name == 'market' then
rendering.draw_light(
{
sprite = 'utility/light_medium',
scale = 7,
intensity = 0.8,
minimum_darkness = 0,
oriented = true,
color = {255, 255, 255},
target = e,
surface = surface,
visible = true,
only_in_alt_mode = false
}
)
end
if entity.valid then
local entity_position = entity.position
if (position.x - entity_position.x) ^ 2 + (position.y - entity_position.y) ^ 2 < brushsize_square then
local e = entity.clone({position = entity_position, surface = surface})
if e.name == 'market' then
rendering.draw_light(
{
sprite = 'utility/light_medium',
scale = 7,
intensity = 0.8,
minimum_darkness = 0,
oriented = true,
color = {255, 255, 255},
target = e,
surface = surface,
visible = true,
only_in_alt_mode = false
}
)
end
if entity.force.index == 2 then
e.active = true
table.insert(cave_miner.reveal_queue, {entity.type, entity.position.x, entity.position.y})
end
if entity.force.index == 2 then
e.active = true
table.insert(cave_miner.reveal_queue, {entity.type, entity.position.x, entity.position.y})
end
entity.destroy()
entity.destroy()
-- make revealing a spawner recursively reveal nearby ones too
if e.name == 'biter-spawner' or e.name == 'spitter-spawner' then
-- prevent spawners immediately spawning tons of biters for a while to give player a chance to clear them or run away
if destination.dynamic_data and destination.dynamic_data.disabled_wave_timer then
destination.dynamic_data.disabled_wave_timer = Balance.prevent_waves_from_spawning_in_cave_timer_length
end
Public.reveal(cave_miner, surface, source_surface, entity_position, 15)
end
end
end
end

View File

@ -14,6 +14,7 @@ local Classes = require 'maps.pirates.roles.classes'
local Public = {}
Public.Data = require 'maps.pirates.surfaces.islands.cave.data'
local math_random = Math.random
-- Code imported from cave_miner_v2 scenario for cave generation
@ -60,8 +61,8 @@ local function spawn_market(args, is_main)
end
local function place_rock(args)
local a = (-49 + Math.random(0, 98)) * 0.01
local b = (-49 + Math.random(0, 98)) * 0.01
local a = (-49 + math_random(0, 98)) * 0.01
local b = (-49 + math_random(0, 98)) * 0.01
args.entities[#args.entities + 1] = IslandsCommon.random_rock_1({x = args.p.x + a, y = args.p.y + b})
end
@ -70,7 +71,7 @@ local function place_spawner(args)
local memory = Memory.get_crew_memory()
local name
if Math.random(1, 2) == 1 then
if math_random(1, 2) == 1 then
name = 'biter-spawner'
else
name = 'spitter-spawner'
@ -98,11 +99,11 @@ function biomes.oasis(args, noise)
local noise_decoratives = GetNoise('decoratives', position, seed + 50000)
args.tiles[#args.tiles + 1] = {name = 'grass-1', position = args.p}
if Math.random(1, 16) == 1 and Math.abs(noise_decoratives) > 0.17 then
if math_random(1, 16) == 1 and Math.abs(noise_decoratives) > 0.17 then
args.entities[#args.entities + 1] = {name = 'tree-04', position = args.p}
end
if Math.random(1, 100) == 1 then
if math_random(1, 100) == 1 then
args.entities[#args.entities + 1] = {name = 'crude-oil', position = args.p, amount = Balance.pick_default_oil_amount() * 4}
end
@ -128,13 +129,13 @@ function biomes.pond_cave(args, noise)
args.tiles[#args.tiles + 1] = {name = 'dirt-7', position = args.p}
if Math.random(1, 512) == 1 then
if math_random(1, 512) == 1 then
args.specials[#args.specials + 1] = {name = 'chest', position = args.p}
return
end
if Math.abs(noise_2) > 0.25 then
if Math.random(1, 64) == 1 then
if math_random(1, 64) == 1 then
place_spawner(args)
else
place_rock(args)
@ -143,7 +144,7 @@ function biomes.pond_cave(args, noise)
return
end
if Math.random(1, 32) == 1 then
if math_random(1, 32) == 1 then
place_spawner(args)
return
end
@ -152,7 +153,7 @@ function biomes.pond_cave(args, noise)
place_rock(args)
return
else
if Math.random(1, 1024) == 1 then
if math_random(1, 1024) == 1 then
spawn_market(args)
return
end
@ -214,21 +215,21 @@ function biomes.worm_desert(args, noise)
return
end
if Math.random(1, 64) == 1 then
if math_random(1, 64) == 1 then
place_worm(args)
return
end
if Math.random(1, 32) == 1 then
if math_random(1, 32) == 1 then
local n = GetNoise('decoratives', position, seed + 10000)
if n > 0.2 then
local trees = {'dead-grey-trunk', 'dead-grey-trunk', 'dry-tree'}
args.entities[#args.entities + 1] = {name = trees[Math.random(1, 3)], position = args.p}
args.entities[#args.entities + 1] = {name = trees[math_random(1, 3)], position = args.p}
return
end
end
if Math.random(1, 512) == 1 then
if math_random(1, 512) == 1 then
args.specials[#args.specials + 1] = {name = 'chest', position = args.p}
end
end
@ -250,7 +251,7 @@ function biomes.cave(args, square_distance)
local no_rocks_2 = GetNoise('no_rocks_2', position, seed)
if no_rocks_2 > 0.7 then
if no_rocks_2 > 0.73 then
if Math.random(1, 256) == 1 then
if math_random(1, 256) == 1 then
spawn_market(args)
end
end
@ -280,8 +281,8 @@ function biomes.cave(args, square_distance)
-- add nest obstacles in these rings on "main" wide cave roads
if (square_distance > ring1_start and square_distance < ring1_end) or
(square_distance > ring2_start and square_distance < ring2_end) then
if Math.random(1, 32) == 1 then
if Math.random(1, 3) == 1 then
if math_random(1, 32) == 1 then
if math_random(1, 3) == 1 then
place_worm(args)
else
place_spawner(args)
@ -289,18 +290,18 @@ function biomes.cave(args, square_distance)
return
end
if Math.random(1, 512) == 1 then
if math_random(1, 512) == 1 then
args.specials[#args.specials + 1] = {name = 'chest', position = args.p}
return
end
if Math.random(1, 16) == 1 then
if math_random(1, 16) == 1 then
place_rock(args)
return
end
end
if Math.random(1, 1024) == 1 then
if math_random(1, 1024) == 1 then
args.specials[#args.specials + 1] = {name = 'chest', position = args.p}
return
end
@ -313,13 +314,13 @@ function biomes.cave(args, square_distance)
return
end
if Math.random(1, 8192) == 1 then
if math_random(1, 8192) == 1 then
spawn_market(args)
return
end
if Math.random(1, 16) == 1 then
if Math.random(1, 3) == 1 then
if math_random(1, 16) == 1 then
if math_random(1, 3) == 1 then
place_worm(args)
return
else

View File

@ -161,7 +161,7 @@ function Public.spawn_ores_on_arrival(destination, points_to_avoid)
local surface = game.surfaces[destination.surface_name]
if not surface and surface.valid then return end
if (destination.subtype and (destination.subtype == enum.STANDARD or destination.subtype == enum.STANDARD_VARIANT or destination.subtype == enum.MAZE)) then
if destination.subtype == enum.STANDARD or destination.subtype == enum.STANDARD_VARIANT or destination.subtype == enum.MAZE then
local ores = {'iron-ore', 'copper-ore', 'stone', 'coal', 'crude-oil'}
local args = {

View File

@ -277,6 +277,10 @@ function Public.destination_on_arrival(destination)
destination.dynamic_data.time_remaining = -1
elseif destination.subtype == IslandEnum.enum.MAZE then --more time
destination.dynamic_data.time_remaining = Math.ceil(1.05 * Balance.max_time_on_island())
elseif destination.subtype == IslandEnum.enum.CAVE then -- supposed to be chill island
destination.dynamic_data.time_remaining = Math.ceil(0.8 * Balance.max_time_on_island_formula())
elseif destination.subtype == IslandEnum.enum.RED_DESERT then --this island has big amount of resources so rather high risk (need time to mine resources) and high reward (lots of iron/copper/stone), also try prevent infinite stay (on late game this island becomes too easy)
destination.dynamic_data.time_remaining = Math.ceil(0.8 * Balance.max_time_on_island_formula())
else
destination.dynamic_data.time_remaining = Math.ceil(Balance.max_time_on_island())
end
@ -421,7 +425,7 @@ function Public.destination_on_departure(destination)
Common.parrot_speak(memory.force, {'pirates.parrot_kraken_warning'})
end
if destination.subtype and destination.subtype == IslandEnum.enum.MAZE then
if destination.subtype == IslandEnum.enum.MAZE then
local force = memory.force
force.manual_mining_speed_modifier = 3 --put back to normal
end