var
chunkHandler
chunkHandler = new()
chunkHandler
var
list
chunkMap = new/list()
chunkMapHeight = 11
chunkMapLength = 11
proc
buildLocations()
var/list/unassigned = new/list()
chunkMap.len = chunkMapLength*chunkMapHeight
for(var/n in 1 to chunkMap.len)
unassigned += n
newChunk(/chunk/military,1,1)
unassigned -= locateChunkIndex(1,1)
newChunk(/chunk/military,1,chunkMapHeight)
unassigned -= locateChunkIndex(1,chunkMapHeight)
newChunk(/chunk/military,chunkMapLength,chunkMapHeight)
unassigned -= locateChunkIndex(chunkMapLength,chunkMapHeight)
newChunk(/chunk/military,chunkMapLength,1)
unassigned -= locateChunkIndex(chunkMapLength,1)
newChunk(/chunk/base,(chunkMapLength/2)+0.5,(chunkMapHeight/2)+0.5)
unassigned -= locateChunkIndex((chunkMapLength/2)+0.5,(chunkMapHeight/2)+0.5)
newRandomChunk(/chunk/hospital,unassigned)
var/stores = round(chunkMap.len/10)
while(stores--)
newRandomChunk(pick(typesof(/chunk/store)-/chunk/store),unassigned)
var/hospitals = round(chunkMap.len/20)
while(hospitals--)
newRandomChunk(/chunk/hospital,unassigned)
for(var/n in unassigned)
var/cx = index2x(n)
var/cy = index2y(n)
newChunk(pick(typesof(/chunk/house)-/chunk/house),cx,cy)
newRandomChunk(var/type,var/list/unassigned)
var/index = pick(unassigned)
var/hx = index2x(index)
var/hy = index2y(index)
newChunk(type,hx,hy)
unassigned -= index
newChunk(var/type,var/x,var/y)
var/chunk/chunk = new type
chunk.x = x
chunk.y = y
chunkMap[locateChunkIndex(x,y)] = chunk
locateChunk(var/x, var/y)
return chunkMap[locateChunkIndex(x,y)]
locateChunkIndex(var/x, var/y)
return x+(y-1)*chunkMapLength
index2x(var/index)
return (index-1)%chunkMapLength+1
index2y(var/index)
return -round(-index/chunkMapLength)
atom
proc
initialize()
chunk
var
name = ""
x = 0 //Location in grid
y = 0
xSpawn = 0 //Spawn Location for player
ySpawn = 0
xLocat = 0 //Bottom left tile
yLocat = 0
height = 0
length = 0
proc
initialize()
for(var/atom/A in block(locate(xLocat,yLocat,1),locate(xLocat+length-1,yLocat+height-1,1)))
A.initialize()//5 difficulties
hospital
military
base
house
house1
house2
house3
store
store1
store2
store3
What this does is let me randomly build a list of elements, whilst specifying certain aspects of it. It's a one dimensional list of "chunks", with functionality to check where they are in a two dimensional state. Yay math, or more specifically, yay Kaiochao!
This lets me build a city with something like this:
mob
verb
dothing()
rand_seed(input(src,"seed")as text)
chunkHandler.chunkMapHeight = min(11,max(3,round(input(src,"height")as num,2)+1))
chunkHandler.chunkMapLength = min(11,max(3,round(input(src,"length")as num,2)+1))
chunkHandler.buildLocations()
for(var/v in chunkHandler.chunkMap)
world<<v:type
It's going to be probably not used for a game about post-apocalyptic survival. You're the center tile and must spread out and attack other areas of the city to get resources. You win when you overtake the entire city.
Really easy = 3x3
Easy = 3x5
Hard = 5x5
Very Hard = 5x7
Suicidal = 7x7
Pls no = 7x9
PLS NO = 9x9
Oh god wat r u doin = 9x11
The "I don't know what sunlight is, but I don't need it, I am a level 89 wizard" difficulty = 11x11
"Ripple" seems like one of those words that sound really weird if you keep saying it.