mirror of
https://github.com/jvmguy/JvmguyScenario.git
synced 2024-11-21 17:16:46 +02:00
Tweak resources.
Generate custom tiles around the spawn.
This commit is contained in:
parent
5cd6da434a
commit
1966e6548f
16
config.lua
16
config.lua
@ -326,7 +326,7 @@ scenario.config.noResources = {
|
||||
}, },
|
||||
}
|
||||
|
||||
RESOURCE_MULT = 2
|
||||
RESOURCE_MULT = 3
|
||||
scenario.config.vanillaResources = {
|
||||
-- { shape="rect", name="steel-chest", x=42, y=-24, height=2, width=2, contents = { {name = "landfill", count=4800 } }, },
|
||||
{ shape="rect", name="steel-chest", x=42, y=-18, height=2, width=2, contents = { {name = "iron-plate", count=1000 } }, },
|
||||
@ -390,14 +390,14 @@ scenario.config.vanillaGeoResources = {
|
||||
-- {name = "assembling-machine-1", count=10},
|
||||
}, },
|
||||
|
||||
{ shape="rect", type="coal", x=-15, y=-15, height=15, width=15, amount=RESOURCE_MULT*3000, },
|
||||
{ shape="rect", type="stone", x=0, y=-15, height=15, width=15, amount=RESOURCE_MULT*1000, },
|
||||
{ shape="rect", type="copper-ore", x=-15, y=0, height=15, width=15, amount=RESOURCE_MULT*2000, },
|
||||
{ shape="rect", type="iron-ore", x=0, y =0, height=15, width=15, amount=RESOURCE_MULT*2000, },
|
||||
{ shape="rect", type="coal", x=-17, y=-17, height=15, width=15, amount=RESOURCE_MULT*3000, },
|
||||
{ shape="rect", type="stone", x=1, y=-17, height=15, width=15, amount=RESOURCE_MULT*1000, },
|
||||
{ shape="rect", type="copper-ore", x=-17, y=1, height=15, width=15, amount=RESOURCE_MULT*2000, },
|
||||
{ shape="rect", type="iron-ore", x=1, y=1, height=15, width=15, amount=RESOURCE_MULT*2000, },
|
||||
|
||||
{ shape="rect", type="crude-oil", x=14, y=-6, height=1, amount=RESOURCE_MULT*2000000, },
|
||||
{ shape="rect", type="crude-oil", x=14, y= 0, height=1, amount=RESOURCE_MULT*2000000, },
|
||||
{ shape="rect", type="crude-oil", x=14, y= 6, height=1, amount=RESOURCE_MULT*2000000, },
|
||||
{ shape="rect", type="crude-oil", x=-1, y=-7, height=1, amount=RESOURCE_MULT*2000000, },
|
||||
{ shape="rect", type="crude-oil", x=-1, y= -1, height=1, amount=RESOURCE_MULT*2000000, },
|
||||
{ shape="rect", type="crude-oil", x=-1, y= 5, height=1, amount=RESOURCE_MULT*2000000, },
|
||||
}
|
||||
|
||||
scenario.config.voidResources = {
|
||||
|
@ -12,9 +12,13 @@ local function SpawnPoint(n)
|
||||
local spacing = scenario.config.riverworld.spacing
|
||||
local pos = PolarToCartesian({ r=spacing * n / 2, theta= (n * math.pi ) })
|
||||
-- for terrain generator
|
||||
local lx = pos.x
|
||||
local ly = pos.y
|
||||
-- OctoTile2 terrain generator requires spawn adjustment
|
||||
-- Move this into terrain generator?
|
||||
if terrainGenerator ~= nil then
|
||||
local lx = math.floor(pos.x/96)*96+48
|
||||
local ly = math.floor(pos.y/96)*96+48
|
||||
lx = math.floor(pos.x/96)*96+48
|
||||
ly = math.floor(pos.y/96)*96+48
|
||||
if (ly < 0) then
|
||||
ly = ly - 32
|
||||
end
|
||||
@ -401,6 +405,16 @@ function CallbackAddSpawnTag(args)
|
||||
AddSpawnTag(args.surface, args.area, args.spawnPos);
|
||||
end
|
||||
|
||||
function M.IsSpawnChunk(chunkArea)
|
||||
local midPoint = {x = (chunkArea.left_top.x + chunkArea.right_bottom.x)/2,
|
||||
y = (chunkArea.left_top.y + chunkArea.right_bottom.y)/2 }
|
||||
local spawnPos = NearestSpawn( global.allSpawns, midPoint)
|
||||
if DistanceFromPoint( midPoint, spawnPos ) <= 32 then
|
||||
return true
|
||||
end
|
||||
return false;
|
||||
end
|
||||
|
||||
-- This is the main function that creates the spawn area
|
||||
-- Provides resources, land and a safe zone
|
||||
function M.ChunkGenerated(event)
|
||||
@ -434,6 +448,12 @@ function M.ChunkGenerated(event)
|
||||
if config.seablock then
|
||||
Scheduler.schedule(game.tick+42, ReplaceLandWithWater, { surface= surface, area = chunkArea, spawnPos=spawnPos } )
|
||||
end
|
||||
|
||||
if terrainGenerator ~= nil and not global.customChunk then
|
||||
if (M.IsSpawnChunk(chunkArea)) then
|
||||
terrainGenerator.FillTiles( terrainGenerator.spawnDesign, surface, chunkArea )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user