Bugfix Bonanza + Z-code and stuff. (#1819)

* Bugfix Bonfire #1

* Bugfix Bonanza #2

* BigBomba

* Banner.dmi

* Fixing Cyborg spawn

* Re-enabling asteroid gen
This commit is contained in:
LordFowl
2017-02-22 14:42:49 -05:00
committed by GitHub
parent 2945dc9f0d
commit 76a891930e
38 changed files with 22296 additions and 21585 deletions
+54 -27
View File
@@ -1,3 +1,14 @@
#define CELL_ALIVE(VAL) ((VAL == cell_live_value) && (VAL != cell_dead_value))
#define GET_MAP_CELL(X,Y) ((((Y) - 1) * limit_x) + (X))
#define PREPARE_CELL(X,Y) \
tmp_cell = GET_MAP_CELL(X,Y);\
if (tmp_cell < 1 || tmp_cell > map.len) {\
tmp_cell = null;\
}
#define KILL_CELL(CELL, NEXT_MAP) NEXT_MAP[CELL] = cell_dead_value;
#define REVIVE_CELL(CELL, NEXT_MAP) NEXT_MAP[CELL] = cell_live_value;
/datum/random_map/automata
descriptor = "generic caves"
initial_wall_cell = 55
@@ -16,44 +27,54 @@
/datum/random_map/automata/proc/iterate(var/iteration)
var/list/next_map[limit_x*limit_y]
var/tmp_cell
var/current_cell
var/count
if (!islist(map))
set_map_size()
for(var/x = 1, x <= limit_x, x++)
for(var/y = 1, y <= limit_y, y++)
var/current_cell = get_map_cell(x,y)
current_cell = get_map_cell(x,y)
next_map[current_cell] = map[current_cell]
var/count = 0
count = 0
// Every attempt to place this in a proc or a list has resulted in
// the generator being totally bricked and useless. Fuck it. We're
// hardcoding this shit. Feel free to rewrite and PR a fix. ~ Z
var/tmp_cell = get_map_cell(x,y)
if(tmp_cell && cell_is_alive(map[tmp_cell])) count++
tmp_cell = get_map_cell(x+1,y+1)
if(tmp_cell && cell_is_alive(map[tmp_cell])) count++
tmp_cell = get_map_cell(x-1,y-1)
if(tmp_cell && cell_is_alive(map[tmp_cell])) count++
tmp_cell = get_map_cell(x+1,y-1)
if(tmp_cell && cell_is_alive(map[tmp_cell])) count++
tmp_cell = get_map_cell(x-1,y+1)
if(tmp_cell && cell_is_alive(map[tmp_cell])) count++
tmp_cell = get_map_cell(x-1,y)
if(tmp_cell && cell_is_alive(map[tmp_cell])) count++
tmp_cell = get_map_cell(x,y-1)
if(tmp_cell && cell_is_alive(map[tmp_cell])) count++
tmp_cell = get_map_cell(x+1,y)
if(tmp_cell && cell_is_alive(map[tmp_cell])) count++
tmp_cell = get_map_cell(x,y+1)
if(tmp_cell && cell_is_alive(map[tmp_cell])) count++
PREPARE_CELL(x,y)
if (tmp_cell && CELL_ALIVE(map[tmp_cell]))
count++
PREPARE_CELL(x+1,y+1)
if (tmp_cell && CELL_ALIVE(map[tmp_cell]))
count++
PREPARE_CELL(x-1,y-1)
if (tmp_cell && CELL_ALIVE(map[tmp_cell]))
count++
PREPARE_CELL(x+1,y-1)
if (tmp_cell && CELL_ALIVE(map[tmp_cell]))
count++
PREPARE_CELL(x-1,y+1)
if (tmp_cell && CELL_ALIVE(map[tmp_cell]))
count++
PREPARE_CELL(x-1,y)
if (tmp_cell && CELL_ALIVE(map[tmp_cell]))
count++
PREPARE_CELL(x,y-1)
if (tmp_cell && CELL_ALIVE(map[tmp_cell]))
count++
PREPARE_CELL(x+1,y)
if (tmp_cell && CELL_ALIVE(map[tmp_cell]))
count++
PREPARE_CELL(x,y+1)
if (tmp_cell && CELL_ALIVE(map[tmp_cell]))
count++
if(count >= cell_threshold)
revive_cell(current_cell, next_map, (iteration == iterations))
REVIVE_CELL(current_cell, next_map)
else
kill_cell(current_cell, next_map, (iteration == iterations))
KILL_CELL(current_cell, next_map)
map = next_map
// Check if a given tile counts as alive for the automata generations.
/datum/random_map/automata/proc/cell_is_alive(var/value)
return (value == cell_live_value) && (value != cell_dead_value)
/datum/random_map/automata/proc/revive_cell(var/target_cell, var/list/use_next_map, var/final_iter)
if(!use_next_map)
use_next_map = map
@@ -62,4 +83,10 @@
/datum/random_map/automata/proc/kill_cell(var/target_cell, var/list/use_next_map, var/final_iter)
if(!use_next_map)
use_next_map = map
use_next_map[target_cell] = cell_dead_value
use_next_map[target_cell] = cell_dead_value
#undef CELL_ALIVE
#undef GET_MAP_CELL
#undef PREPARE_CELL
#undef KILL_CELL
#undef REVIVE_CELL
+4 -10
View File
@@ -27,18 +27,12 @@
return "X"
return ..(value)
/datum/random_map/automata/cave_system/revive_cell(var/target_cell, var/list/use_next_map, var/final_iter)
..()
if(final_iter)
ore_turfs |= target_cell
/datum/random_map/automata/cave_system/kill_cell(var/target_cell, var/list/use_next_map, var/final_iter)
..()
if(final_iter)
ore_turfs -= target_cell
// Create ore turfs.
/datum/random_map/automata/cave_system/cleanup()
for (var/cell in map)
if (cell == cell_live_value)
ore_turfs += cell
var/ore_count = round(map.len/20)
while((ore_count>0) && (ore_turfs.len>0))
if(!priority_process) sleep(-1)
+38 -37
View File
@@ -41,44 +41,45 @@
var/tx = ((origin_x-1)+x)*chunk_size
var/ty = ((origin_y-1)+y)*chunk_size
for(var/i=0,i<chunk_size,i++)
for(var/j=0,j<chunk_size,j++)
var/turf/simulated/T = locate(tx+j, ty+i, origin_z)
if(!istype(T) || !T.has_resources)
continue
if(!priority_process) sleep(-1)
T.resources = list()
T.resources["silicates"] = rand(3,5)
T.resources["carbonaceous rock"] = rand(3,5)
for (var/turf/theTurf in block(locate(tx, ty), locate(chunk_size, chunk_size)))
var/turf/simulated/T = theTurf
if(!istype(T) || !T.has_resources)
continue
if(!priority_process)
sleep(-1)
T.resources = list()
T.resources["silicates"] = rand(3,5)
T.resources["carbonaceous rock"] = rand(3,5)
var/current_cell = map[get_map_cell(x,y)]
if(current_cell < rare_val) // Surface metals.
T.resources["iron"] = rand(RESOURCE_HIGH_MIN, RESOURCE_HIGH_MAX)
T.resources["gold"] = rand(RESOURCE_LOW_MIN, RESOURCE_LOW_MAX)
T.resources["silver"] = rand(RESOURCE_LOW_MIN, RESOURCE_LOW_MAX)
T.resources["uranium"] = rand(RESOURCE_LOW_MIN, RESOURCE_LOW_MAX)
T.resources["diamond"] = 0
T.resources["phoron"] = 0
T.resources["osmium"] = 0
T.resources["hydrogen"] = 0
else if(current_cell < deep_val) // Rare metals.
T.resources["gold"] = rand(RESOURCE_MID_MIN, RESOURCE_MID_MAX)
T.resources["silver"] = rand(RESOURCE_MID_MIN, RESOURCE_MID_MAX)
T.resources["uranium"] = rand(RESOURCE_MID_MIN, RESOURCE_MID_MAX)
T.resources["phoron"] = rand(RESOURCE_MID_MIN, RESOURCE_MID_MAX)
T.resources["osmium"] = rand(RESOURCE_MID_MIN, RESOURCE_MID_MAX)
T.resources["hydrogen"] = 0
T.resources["diamond"] = 0
T.resources["iron"] = 0
else // Deep metals.
T.resources["uranium"] = rand(RESOURCE_LOW_MIN, RESOURCE_LOW_MAX)
T.resources["diamond"] = rand(RESOURCE_LOW_MIN, RESOURCE_LOW_MAX)
T.resources["phoron"] = rand(RESOURCE_HIGH_MIN, RESOURCE_HIGH_MAX)
T.resources["osmium"] = rand(RESOURCE_HIGH_MIN, RESOURCE_HIGH_MAX)
T.resources["hydrogen"] = rand(RESOURCE_MID_MIN, RESOURCE_MID_MAX)
T.resources["iron"] = 0
T.resources["gold"] = 0
T.resources["silver"] = 0
var/current_cell = map[get_map_cell(x,y)]
if(current_cell < rare_val) // Surface metals.
T.resources["iron"] = rand(RESOURCE_HIGH_MIN, RESOURCE_HIGH_MAX)
T.resources["gold"] = rand(RESOURCE_LOW_MIN, RESOURCE_LOW_MAX)
T.resources["silver"] = rand(RESOURCE_LOW_MIN, RESOURCE_LOW_MAX)
T.resources["uranium"] = rand(RESOURCE_LOW_MIN, RESOURCE_LOW_MAX)
T.resources["diamond"] = 0
T.resources["phoron"] = 0
T.resources["osmium"] = 0
T.resources["hydrogen"] = 0
else if(current_cell < deep_val) // Rare metals.
T.resources["gold"] = rand(RESOURCE_MID_MIN, RESOURCE_MID_MAX)
T.resources["silver"] = rand(RESOURCE_MID_MIN, RESOURCE_MID_MAX)
T.resources["uranium"] = rand(RESOURCE_MID_MIN, RESOURCE_MID_MAX)
T.resources["phoron"] = rand(RESOURCE_MID_MIN, RESOURCE_MID_MAX)
T.resources["osmium"] = rand(RESOURCE_MID_MIN, RESOURCE_MID_MAX)
T.resources["hydrogen"] = 0
T.resources["diamond"] = 0
T.resources["iron"] = 0
else // Deep metals.
T.resources["uranium"] = rand(RESOURCE_LOW_MIN, RESOURCE_LOW_MAX)
T.resources["diamond"] = rand(RESOURCE_LOW_MIN, RESOURCE_LOW_MAX)
T.resources["phoron"] = rand(RESOURCE_HIGH_MIN, RESOURCE_HIGH_MAX)
T.resources["osmium"] = rand(RESOURCE_HIGH_MIN, RESOURCE_HIGH_MAX)
T.resources["hydrogen"] = rand(RESOURCE_MID_MIN, RESOURCE_MID_MAX)
T.resources["iron"] = 0
T.resources["gold"] = 0
T.resources["silver"] = 0
return
/datum/random_map/noise/ore/get_map_char(var/value)