Added masking turf for asteroid field, fixed issues with distribution map. Replaced asteroid field with mask turf.

This commit is contained in:
Zuhayr
2015-01-14 09:46:55 +10:30
parent 786c3bb0f7
commit cd494cdef1
6 changed files with 273 additions and 251 deletions

View File

@@ -34,7 +34,7 @@ datum/controller/game_controller
var/list/shuttle_list // For debugging and VV
var/datum/random_map/ore/asteroid_ore_map // For debugging and VV.
var/datum/random_map/asteroid_map // For debugging and VV.
datum/controller/game_controller/New()
//There can be only one master_controller. Out with the old and in with the new.
@@ -59,6 +59,9 @@ datum/controller/game_controller/New()
datum/controller/game_controller/proc/setup()
world.tick_lag = config.Ticklag
//Create the asteroid Z-level.
asteroid_map = new(null,13,32,5,217,223)
spawn(20)
createRandomZlevel()
@@ -77,9 +80,6 @@ datum/controller/game_controller/proc/setup()
transfer_controller = new
for(var/i=0, i<max_secret_rooms, i++)
make_mining_asteroid_secret()
spawn(0)
if(ticker)
ticker.pregame()
@@ -108,7 +108,7 @@ datum/controller/game_controller/proc/setup_objects()
var/obj/machinery/atmospherics/unary/vent_scrubber/T = U
T.broadcast_status()
//Create the mining ore distribution map.
// Create the mining ore distribution map.
// These values determine the specific area that the map is applied to.
// If you do not use the official Baycode asteroid map, you will need to change them.
asteroid_ore_map = new /datum/random_map/ore(null,13,32,5,217,223)

View File

@@ -2,3 +2,8 @@
name = "floor"
icon = 'icons/turf/floors.dmi'
icon_state = "Floor3"
/turf/unsimulated/mask
name = "mask"
icon = 'icons/turf/walls.dmi'
icon_state = "rockvault"

View File

@@ -29,7 +29,8 @@
/turf/simulated/mineral/New()
MineralSpread()
spawn(0)
MineralSpread()
spawn(2)
var/list/step_overlays = list("s" = NORTH, "n" = SOUTH, "w" = EAST, "e" = WEST)
@@ -86,7 +87,7 @@
if(mineral && mineral.spread)
for(var/trydir in cardinal)
if(prob(mineral.spread_chance))
var/turf/simulated/mineral/random/target_turf = get_step(src, trydir)
var/turf/simulated/mineral/target_turf = get_step(src, trydir)
if(istype(target_turf) && !target_turf.mineral)
target_turf.mineral = mineral
target_turf.UpdateMineral()
@@ -363,7 +364,7 @@
/turf/simulated/mineral/random
name = "Mineral deposit"
var/mineralSpawnChanceList = list("Uranium" = 5, "Platinum" = 5, "Iron" = 35, "Coal" = 35, "Diamond" = 1, "Gold" = 5, "Silver" = 5, "Phoron" = 10)
var/mineralChance = 10 //means 10% chance of this plot changing to a mineral deposit
var/mineralChance = 100 //10 //means 10% chance of this plot changing to a mineral deposit
/turf/simulated/mineral/random/New()
if (prob(mineralChance) && !mineral)
@@ -379,7 +380,7 @@
. = ..()
/turf/simulated/mineral/random/high_chance
mineralChance = 25
mineralChance = 100 //25
mineralSpawnChanceList = list("Uranium" = 10, "Platinum" = 10, "Iron" = 20, "Coal" = 20, "Diamond" = 2, "Gold" = 10, "Silver" = 10, "Phoron" = 20)

View File

@@ -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()

View File

@@ -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