From 3fc4b004d3141f5f860b8f35ae0e45cc53366835 Mon Sep 17 00:00:00 2001 From: Oarcinae Date: Sat, 19 Oct 2019 15:00:23 -0400 Subject: [PATCH] Tweaking spawns to use new landfill tiles. Tweaks to moats. --- lib/frontier_silo.lua | 2 +- lib/oarc_utils.lua | 23 ++++++++++++++--------- lib/separate_spawns.lua | 20 ++++++++++++-------- 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/lib/frontier_silo.lua b/lib/frontier_silo.lua index 0280d0c..05bc09c 100644 --- a/lib/frontier_silo.lua +++ b/lib/frontier_silo.lua @@ -226,7 +226,7 @@ function GenerateRocketSiloChunk(event) RemoveDecorationsArea(surface, chunkArea) -- Create rocket silo - CreateCropOctagon(surface, siloPos, chunkArea, CHUNK_SIZE*2, "grass-1") + CreateCropOctagon(surface, siloPos, chunkArea, CHUNK_SIZE*2, "landfill") end end end diff --git a/lib/oarc_utils.lua b/lib/oarc_utils.lua index bc6557f..e9b9647 100644 --- a/lib/oarc_utils.lua +++ b/lib/oarc_utils.lua @@ -925,8 +925,8 @@ function CreateCropCircle(surface, centerPos, chunkArea, tileRadius, fillTile) end -- Create a circle of trees around the spawn point. - if ((distVar < tileRadSqr-200) and - (distVar > tileRadSqr-400)) then + if ((distVar < tileRadSqr-100) and + (distVar > tileRadSqr-500)) then surface.create_entity({name="tree-02", amount=1, position={i, j}}) end end @@ -976,14 +976,19 @@ function CreateMoat(surface, centerPos, chunkArea, tileRadius, fillTile) for i=chunkArea.left_top.x,chunkArea.right_bottom.x,1 do for j=chunkArea.left_top.y,chunkArea.right_bottom.y,1 do - -- This ( X^2 + Y^2 ) is used to calculate if something - -- is inside a circle area. - local distVar = math.floor((centerPos.x - i)^2 + (centerPos.y - j)^2) + if (j == centerPos.y-1) or (j == centerPos.y) or (j == centerPos.y+1) then - -- Create a circle of water - if ((distVar < tileRadSqr+(1500*global.ocfg.spawn_config.gen_settings.moat_size_modifier)) and - (distVar > tileRadSqr)) then - table.insert(waterTiles, {name = "water", position ={i,j}}) + else + + -- This ( X^2 + Y^2 ) is used to calculate if something + -- is inside a circle area. + local distVar = math.floor((centerPos.x - i)^2 + (centerPos.y - j)^2) + + -- Create a circle of water + if ((distVar < tileRadSqr+(1500*global.ocfg.spawn_config.gen_settings.moat_size_modifier)) and + (distVar > tileRadSqr)) then + table.insert(waterTiles, {name = "water", position ={i,j}}) + end end -- Enforce land inside the edges of the circle to make sure it's diff --git a/lib/separate_spawns.lua b/lib/separate_spawns.lua index b670b53..a61d1a5 100644 --- a/lib/separate_spawns.lua +++ b/lib/separate_spawns.lua @@ -220,7 +220,7 @@ function SetupAndClearSpawnAreas(surface, chunkArea) RemoveInCircle(surface, chunkArea, "cliff", spawn.pos, global.ocfg.spawn_config.gen_settings.land_area_tiles+5) RemoveDecorationsArea(surface, chunkArea) - local fill_tile = "grass-1" + local fill_tile = "landfill" if (game.active_mods["oarc-restricted-build"]) then fill_tile = global.ocfg.locked_build_area_tile end @@ -596,14 +596,18 @@ function SendPlayerToNewSpawnAndCreateIt(delayedSpawn) if (not delayedSpawn.vanilla) then + -- Generate water strip only if we don't have a moat. + if (not delayedSpawn.moat) then + local water_data = global.ocfg.spawn_config.water + CreateWaterStrip(game.surfaces[GAME_SURFACE_NAME], + {x=delayedSpawn.pos.x+water_data.x_offset, y=delayedSpawn.pos.y+water_data.y_offset}, + water_data.length) + CreateWaterStrip(game.surfaces[GAME_SURFACE_NAME], + {x=delayedSpawn.pos.x+water_data.x_offset, y=delayedSpawn.pos.y+water_data.y_offset+1}, + water_data.length) + end + -- Create the spawn resources here - local water_data = global.ocfg.spawn_config.water - CreateWaterStrip(game.surfaces[GAME_SURFACE_NAME], - {x=delayedSpawn.pos.x+water_data.x_offset, y=delayedSpawn.pos.y+water_data.y_offset}, - water_data.length) - CreateWaterStrip(game.surfaces[GAME_SURFACE_NAME], - {x=delayedSpawn.pos.x+water_data.x_offset, y=delayedSpawn.pos.y+water_data.y_offset+1}, - water_data.length) GenerateStartingResources(game.surfaces[GAME_SURFACE_NAME], delayedSpawn.pos) end