1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2024-12-30 23:17:53 +02:00

Mtn v3 - Wave defense

Fixes that biters tried to path north
This commit is contained in:
Gerkiz 2024-03-27 11:08:26 +01:00
parent 6a88825f40
commit 0ab3c52401
4 changed files with 44 additions and 9 deletions

View File

@ -278,12 +278,14 @@ function Public.reset_map()
surface.force_generate_chunk_requests()
end
game.forces.player.set_spawn_position({x = -27, y = -25}, surface)
WD.set_spawn_position({x = -16, y = -80})
else
if not surface.is_chunk_generated({x = -20, y = 22}) then
surface.request_to_generate_chunks({x = -20, y = 22}, 0.1)
surface.force_generate_chunk_requests()
end
game.forces.player.set_spawn_position({x = -27, y = 25}, surface)
WD.set_spawn_position({x = -16, y = 80})
end
game.speed = 1

View File

@ -2808,6 +2808,16 @@ local function border_chunk(p, data)
local pos = p
if data.reversed then
if p.y < -74 then
return
end
else
if p.y > 74 then
return
end
end
if random(1, ceil(abs(pos.y) + abs(pos.y)) + 64) == 1 then
entities[#entities + 1] = {name = trees[random(1, #trees)], position = pos}
end
@ -2900,20 +2910,22 @@ function Public.heavy_functions(data)
if string.sub(surface.name, 0, #map_name) ~= map_name then
return
end
local adjusted_zones = Public.get('adjusted_zones')
data.reversed = adjusted_zones.reversed
local p = data.position
local adjusted_zones = Public.get('adjusted_zones')
if adjusted_zones.disable_terrain then
return
end
init_terrain(adjusted_zones)
if not data.seed then
data.seed = Public.get('random_seed')
end
if adjusted_zones.reversed then
if data.reversed then
if top_y % zone_settings.zone_depth == 0 and top_y > 0 then
Public.set('left_top', data.left_top)
return wall(p, data)

View File

@ -32,9 +32,16 @@ end
local function normalize_spawn_position()
local collapse_spawn_position = Collapse.get_position()
local new_pos = {x = 0, y = collapse_spawn_position.y - 40}
Public.set_spawn_position(new_pos)
return new_pos
local inverted = Public.get('inverted')
if inverted then
local new_pos = {x = 0, y = collapse_spawn_position.y + 40}
Public.set_spawn_position(new_pos)
return new_pos
else
local new_pos = {x = 0, y = collapse_spawn_position.y - 40}
Public.set_spawn_position(new_pos)
return new_pos
end
end
local function find_initial_spot(surface, position)
@ -180,10 +187,19 @@ local function get_spawn_pos()
local target = Public.get('target')
if initial_position.y - target.position.y > 10 then
if random(1, 2) == 1 then
initial_position = {x = initial_position.x, y = initial_position.y - 30}
local inverted = Public.get('inverted')
if inverted then
if random(1, 2) == 1 then
initial_position = {x = initial_position.x, y = initial_position.y + 30}
else
initial_position = {x = initial_position.x, y = initial_position.y + 20}
end
else
initial_position = {x = initial_position.x, y = initial_position.y - 20}
if random(1, 2) == 1 then
initial_position = {x = initial_position.x, y = initial_position.y - 30}
else
initial_position = {x = initial_position.x, y = initial_position.y - 20}
end
end
end

View File

@ -63,6 +63,7 @@ function Public.reset_wave_defense()
this.average_unit_group_size = 24
this.biter_raffle = {}
this.debug = false
this.inverted = false
this.debug_health = false
this.disable_spawn_near_target = true
this.log_wave_to_discord = true
@ -479,8 +480,12 @@ end
-- @param <boolean>
function Public.enable_grace_time(boolean)
this.enable_grace_time.enabled = boolean or false
end
return this.debug_health
--- Toggles a reverse search function
-- @param <boolean>
function Public.enable_inverted(boolean)
this.inverted = boolean or false
end
-- Event.on_nth_tick(30, Public.debug_module)