mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
ports the latest commit
This commit is contained in:
@@ -49,30 +49,28 @@
|
|||||||
if(!checkRegion(Start, End))
|
if(!checkRegion(Start, End))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
var/centerX = abs(max(End.x-Start.x,1))
|
var/centerX = max(abs((End.x+Start.x)/2),1)
|
||||||
var/centerY = abs(max(End.y-Start.y,1))
|
var/centerY = max(abs((End.y+Start.y)/2),1)
|
||||||
|
|
||||||
|
|
||||||
var/lilZ = min(Start.z,End.z)
|
var/lilZ = min(Start.z,End.z)
|
||||||
var/bigZ = max(Start.z,End.z)
|
var/bigZ = max(Start.z,End.z)
|
||||||
|
|
||||||
var/centerZ = max(abs(bigZ-(lilZ/2)),1) //Spherical maps! woo!
|
var/sphereMagic = max(abs(bigZ-(lilZ/2)),1) //Spherical maps! woo!
|
||||||
|
|
||||||
var/radius = abs(max(centerX,centerY)) //take the biggest displacement as the radius
|
var/radius = abs(max(centerX,centerY)) //take the biggest displacement as the radius
|
||||||
|
|
||||||
if(replace)
|
if(replace)
|
||||||
undefineRegion()
|
undefineRegion()
|
||||||
|
|
||||||
//Sphere mode engage
|
//Even sphere correction engage
|
||||||
var/evenCheckZ = 0
|
var/offByOneOffset = 1
|
||||||
if(max(bigZ,lilZ) % 2 == 0)
|
if(bigZ % 2 == 0)
|
||||||
evenCheckZ = centerZ+1
|
offByOneOffset = 0
|
||||||
|
|
||||||
for(var/i = lilZ, i <= bigZ, i++)
|
for(var/i = lilZ, i <= bigZ+offByOneOffset, i++)
|
||||||
var/theRadius = radius
|
var/theRadius = radius
|
||||||
if(i != centerZ)
|
if(i != sphereMagic)
|
||||||
if(i != evenCheckZ)
|
theRadius = max(radius/max((2*abs(sphereMagic-i)),1),1)
|
||||||
theRadius = max(radius/max((2*abs(centerZ-i)),1),1)
|
|
||||||
|
|
||||||
|
|
||||||
map |= circlerange(locate(centerX,centerY,i),theRadius)
|
map |= circlerange(locate(centerX,centerY,i),theRadius)
|
||||||
@@ -201,4 +199,3 @@
|
|||||||
src << "Generating Region"
|
src << "Generating Region"
|
||||||
N.generate()
|
N.generate()
|
||||||
src << "Generated Region"
|
src << "Generated Region"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user