mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 19:52:40 +00:00
Added masking turf for asteroid field, fixed issues with distribution map. Replaced asteroid field with mask turf.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#define MIN_SURFACE_COUNT 500
|
||||
#define MIN_RARE_COUNT 500
|
||||
#define MIN_RARE_COUNT 200
|
||||
#define MIN_DEEP_COUNT 100
|
||||
#define RESOURCE_HIGH_MAX 4
|
||||
#define RESOURCE_HIGH_MIN 2
|
||||
@@ -171,10 +171,18 @@ Deep minerals:
|
||||
iterate(iteration, x, y+hsize, hsize)
|
||||
iterate(iteration, x+hsize, y+hsize, hsize)
|
||||
|
||||
/datum/random_map/ore/apply_to_turf(var/x,var/y,var/turf/T)
|
||||
/datum/random_map/ore/apply_to_map()
|
||||
for(var/x = 0, x < real_size, x++)
|
||||
if((origin_x + x) > limit_x) continue
|
||||
for(var/y = 0, y < real_size, y++)
|
||||
if((origin_y + y) > limit_y) continue
|
||||
sleep(-1)
|
||||
apply_to_turf(x,y)
|
||||
|
||||
var/tx = (x-1)*chunk_size
|
||||
var/ty = (y-1)*chunk_size
|
||||
/datum/random_map/ore/apply_to_turf(var/x,var/y)
|
||||
|
||||
var/tx = origin_x+((x-1)*chunk_size)
|
||||
var/ty = origin_y+((y-1)*chunk_size)
|
||||
|
||||
for(var/i=0,i<chunk_size,i++)
|
||||
if(ty+i>limit_y)
|
||||
@@ -183,12 +191,10 @@ Deep minerals:
|
||||
if(tx+j>limit_x)
|
||||
continue
|
||||
|
||||
T = locate(tx+j, ty+i, origin_z)
|
||||
var/turf/T = locate(tx+j, ty+i, origin_z)
|
||||
if(!T || !T.has_resources)
|
||||
continue
|
||||
|
||||
T.color = "#FF0000"
|
||||
|
||||
sleep(-1)
|
||||
|
||||
T.resources = list()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#define ORE_COUNT 800
|
||||
/*
|
||||
This module is used to generate the debris fields/distribution maps/procedural stations.
|
||||
*/
|
||||
@@ -5,8 +6,8 @@
|
||||
var/global/list/random_maps = list()
|
||||
|
||||
/datum/random_map
|
||||
var/descriptor = "debris field" // Display name.
|
||||
var/real_size = 128 // Size of each edge (must be square :().
|
||||
var/descriptor = "asteroid" // Display name.
|
||||
var/real_size = 246 // Size of each edge (must be square :().
|
||||
var/size = 2 // In basic implementation this will only be used for 3x3 blocks.
|
||||
var/cell_range = 2 // Random range for initial cells.
|
||||
var/iterations = 5 // Number of times to apply the automata rule.
|
||||
@@ -78,10 +79,10 @@ var/global/list/random_maps = list()
|
||||
for(var/x = 1, x <= real_size, x++)
|
||||
for(var/y = 1, y <= real_size, y++)
|
||||
var/current_cell = get_map_cell(x,y)
|
||||
if(x == 1 || x == real_size || y == 1 || y == real_size)
|
||||
map[current_cell] = rand(1,2)
|
||||
if(prob(55))
|
||||
map[current_cell] = 2
|
||||
else
|
||||
map[current_cell] = rand(1,cell_range)
|
||||
map[current_cell] = 1
|
||||
|
||||
/datum/random_map/proc/clear_map()
|
||||
for(var/x = 1, x <= real_size, x++)
|
||||
@@ -135,14 +136,28 @@ var/global/list/random_maps = list()
|
||||
if(!within_bounds(current_cell))
|
||||
return
|
||||
var/turf/T = locate(x,y,origin_z)
|
||||
if(!T)
|
||||
if(!T || !istype(T,/turf/unsimulated/mask))
|
||||
return
|
||||
switch(map[current_cell])
|
||||
if(1)
|
||||
T.ChangeTurf(/turf/simulated/floor/plating/airless/asteroid)
|
||||
if(2)
|
||||
T.ChangeTurf(/turf/simulated/mineral)
|
||||
if(3)
|
||||
T.ChangeTurf(/turf/simulated/mineral/random)
|
||||
if(4)
|
||||
T.ChangeTurf(/turf/simulated/mineral/random/high_chance)
|
||||
|
||||
/datum/random_map/proc/cleanup()
|
||||
sleep(-1)
|
||||
var/ore_count = ORE_COUNT
|
||||
while(ore_count)
|
||||
var/check_cell = get_map_cell(rand(1,real_size),rand(1,real_size))
|
||||
if(!(within_bounds(check_cell)) || map[check_cell] != 2)
|
||||
continue
|
||||
if(prob(25))
|
||||
map[check_cell] = 4
|
||||
else
|
||||
map[check_cell] = 3
|
||||
ore_count--
|
||||
return 1
|
||||
Reference in New Issue
Block a user