Open ghost opened 7 years ago
With what code did you try to make a spiral? I mean what did you attempt to change? Spiral worked last time we used it, and we haven't really changed the code since.
You changed control.lua line 19 from 'require "locale/mapsettings/resources"' to 'require "locale/mapsettings/spiral"'?
local tau=2*math.pi
local atan2=math.atan2
local sqrt = math.sqrt
local landWidth
local gap
local function TileIsInSpiral(x,y)
return (sqrt(x*x+y*y)+atan2(y,x)*gap/tau)%gap<landWidth
end
Event.register(defines.events.on_chunk_generated, function(event)
landWidth = landWidth or global.scenario.config.mapsettings.spiral_land_width
gap = landWidth + global.scenario.config.mapsettings.spiral_water_width
local tiles = {}
for x = event.area.left_top.x, event.area.right_bottom.x - 1 do
for y = event.area.left_top.y, event.area.right_bottom.y - 1 do
if not (math.abs(x) < 4 and math.abs(y) < 4) then
if not TileIsInSpiral(x, y) then
table.insert(tiles, {name="water", position = {x,y}})
elseif event.surface.get_tile(x,y).name:find("water") then
table.insert(tiles, {name="grass", position = {x,y}})
end
end
end
end
event.surface.set_tiles(tiles)
end)
Yes. Here is my control includes: https://i.imgur.com/2IpBfVB.png
In the latest commit; please check lines 4,5 of spiral.lua. 4 uses a variable that doesn't exist I believe, and appears both are kicking off before scenario is created.
Those two variables are set in config.lua
Actually.. one of them is messed up. Line 4 has config and mapsettings swapped. 'global.scenario.mapsettings.config.spiral_land_width' should be 'global.scenario.config.mapsettings.spiral_land_width'
Spiral config doesn't work out of the box, plus grid is present in some areas when making a spiral map. https://i.imgur.com/Zarof0S.png