Skip to content
This repository was archived by the owner on Sep 12, 2021. It is now read-only.

Ports New Procedural Generation of Lavaland #633

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _maps/RandomRuins/SpaceRuins/asteroid2.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/turf/open/floor/plating/asteroid/airless,
/area/ruin/unpowered/no_grav)
"c" = (
/turf/closed/mineral/random/no_caves,
/turf/closed/mineral/random,
/area/ruin/unpowered/no_grav)
"d" = (
/turf/closed/mineral/random/high_chance,
Expand Down
2 changes: 1 addition & 1 deletion _maps/RandomRuins/SpaceRuins/asteroid3.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/turf/open/floor/plating/asteroid/airless,
/area/ruin/unpowered/no_grav)
"c" = (
/turf/closed/mineral/random/no_caves,
/turf/closed/mineral/random,
/area/ruin/unpowered/no_grav)
"d" = (
/turf/closed/mineral/random/high_chance,
Expand Down
4 changes: 2 additions & 2 deletions _maps/RandomRuins/SpaceRuins/asteroid4.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
/turf/template_noop,
/area/template_noop)
"b" = (
/turf/closed/mineral/random/no_caves,
/turf/closed/mineral/random,
/area/ruin/unpowered/no_grav)
"c" = (
/turf/closed/mineral/random/high_chance,
/area/ruin/unpowered/no_grav)
"d" = (
/turf/closed/mineral/random/no_caves,
/turf/closed/mineral/random,
/area/ruin/unpowered)
"e" = (
/turf/open/floor/plating/asteroid/airless,
Expand Down
2 changes: 1 addition & 1 deletion _maps/RandomRuins/SpaceRuins/asteroid5.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/turf/template_noop,
/area/template_noop)
"b" = (
/turf/closed/mineral/random/no_caves,
/turf/closed/mineral/random,
/area/ruin/unpowered)
"c" = (
/turf/closed/mineral/random/high_chance,
Expand Down
2 changes: 1 addition & 1 deletion _maps/RandomRuins/SpaceRuins/clericden.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/turf/template_noop,
/area/template_noop)
"b" = (
/turf/closed/mineral/random/no_caves,
/turf/closed/mineral/random,
/area/ruin/unpowered/no_grav)
"c" = (
/turf/open/floor/plating/asteroid/airless,
Expand Down
2 changes: 1 addition & 1 deletion _maps/RandomRuins/SpaceRuins/derelict4.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/turf/template_noop,
/area/template_noop)
"b" = (
/turf/closed/mineral/random/no_caves,
/turf/closed/mineral/random,
/area/ruin/unpowered)
"c" = (
/turf/open/floor/plating/asteroid/airless,
Expand Down
4 changes: 2 additions & 2 deletions _maps/RandomRuins/SpaceRuins/derelict5.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
/turf/template_noop,
/area/template_noop)
"b" = (
/turf/closed/mineral/random/no_caves,
/turf/closed/mineral/random,
/area/ruin/unpowered/no_grav)
"c" = (
/turf/open/floor/plating/asteroid/airless,
/area/ruin/unpowered/no_grav)
"d" = (
/turf/closed/mineral/random/no_caves,
/turf/closed/mineral/random,
/area/ruin/unpowered)
"e" = (
/turf/closed/wall,
Expand Down
2 changes: 1 addition & 1 deletion _maps/RandomRuins/SpaceRuins/gondolaasteroid.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/turf/template_noop,
/area/template_noop)
"b" = (
/turf/closed/mineral/random/no_caves,
/turf/closed/mineral/random,
/area/ruin/space/has_grav)
"c" = (
/turf/open/floor/plating/asteroid/airless,
Expand Down
2 changes: 1 addition & 1 deletion _maps/RandomRuins/SpaceRuins/hilbertshoteltestingsite.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
/turf/open/floor/plasteel/grimy,
/area/ruin/space/has_grav/hilbertresearchfacility)
"J" = (
/turf/closed/mineral/random/no_caves,
/turf/closed/mineral/random,
/area/ruin/unpowered/no_grav)
"K" = (
/turf/open/floor/plasteel/stairs/right{
Expand Down
2 changes: 1 addition & 1 deletion _maps/RandomRuins/SpaceRuins/mrow_thats_right.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/turf/template_noop,
/area/template_noop)
"ab" = (
/turf/closed/mineral/random/no_caves,
/turf/closed/mineral/random,
/area/ruin/unpowered/no_grav)
"ac" = (
/turf/open/floor/plating/asteroid/airless,
Expand Down
2 changes: 1 addition & 1 deletion _maps/RandomZLevels/moonoutpost19.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@
},
/area/awaymission/moonoutpost19/main)
"dA" = (
/turf/closed/mineral/random/no_caves,
/turf/closed/mineral/random,
/area/awaymission/moonoutpost19/main)
"dB" = (
/obj/structure/sign/warning/vacuum{
Expand Down
25 changes: 25 additions & 0 deletions code/__DEFINES/flags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#define ALL (~0) //For convenience.
#define NONE 0


GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768))

/* Directions */
Expand Down Expand Up @@ -60,6 +61,30 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
/// Blocks ruins spawning on the turf
#define NO_RUINS_1 (1<<10)

////////////////Area flags\\\\\\\\\\\\\\
/// If it's a valid territory for cult summoning or the CRAB-17 phone to spawn
#define VALID_TERRITORY (1<<0)
/// If blobs can spawn there and if it counts towards their score.
#define BLOBS_ALLOWED (1<<1)
/// If mining tunnel generation is allowed in this area
#define CAVES_ALLOWED (1<<2)
/// If flora are allowed to spawn in this area randomly through tunnel generation
#define FLORA_ALLOWED (1<<3)
/// If mobs can be spawned by natural random generation
#define MOB_SPAWN_ALLOWED (1<<4)
/// If megafauna can be spawned by natural random generation
#define MEGAFAUNA_SPAWN_ALLOWED (1<<5)
/// Are you forbidden from teleporting to the area? (centcom, mobs, wizard, hand teleporter)
#define NOTELEPORT (1<<6)
/// Hides area from player Teleport function.
#define HIDDEN_AREA (1<<7)
/// If false, loading multiple maps with this area type will create multiple instances.
#define UNIQUE_AREA (1<<8)
/// If people are allowed to suicide in it. Mostly for OOC stuff like minigames
#define BLOCK_SUICIDE (1<<9)
/// Can the Xenobio management console transverse this area by default?
#define XENOBIOLOGY_COMPATIBLE (1<<10)

/*
These defines are used specifically with the atom/pass_flags bitmask
the atom/checkpass() proc uses them (tables will call movable atom checkpass(PASSTABLE) for example)
Expand Down
6 changes: 6 additions & 0 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -378,3 +378,9 @@
#define STANDING_UP 0
/// Mob is lying down, usually associated with lying_angle values of 90 or 270.
#define LYING_DOWN 1

///How much a mob's sprite should be moved when they're lying down
#define PIXEL_Y_OFFSET_LYING -6

///Define for spawning megafauna instead of a mob for cave gen
#define SPAWN_MEGAFAUNA "bluh bluh huge boss"
44 changes: 37 additions & 7 deletions code/__DEFINES/rust_g.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,39 @@
#define RUST_G (__rust_g || __detect_rust_g())
#endif

#define RUSTG_JOB_NO_RESULTS_YET "NO RESULTS YET"
#define RUSTG_JOB_NO_SUCH_JOB "NO SUCH JOB"
#define RUSTG_JOB_ERROR "JOB PANICKED"
/**
* This proc generates a cellular automata noise grid which can be used in procedural generation methods.
*
* Returns a single string that goes row by row, with values of 1 representing an alive cell, and a value of 0 representing a dead cell.
*
* Arguments:
* * percentage: The chance of a turf starting closed
* * smoothing_iterations: The amount of iterations the cellular automata simulates before returning the results
* * birth_limit: If the number of neighboring cells is higher than this amount, a cell is born
* * death_limit: If the number of neighboring cells is lower than this amount, a cell dies
* * width: The width of the grid.
* * height: The height of the grid.
*/
#define rustg_cnoise_generate(percentage, smoothing_iterations, birth_limit, death_limit, width, height) \
call(RUST_G, "cnoise_generate")(percentage, smoothing_iterations, birth_limit, death_limit, width, height)

#define rustg_dmi_strip_metadata(fname) call(RUST_G, "dmi_strip_metadata")(fname)
#define rustg_dmi_create_png(path, width, height, data) call(RUST_G, "dmi_create_png")(path, width, height, data)
#define rustg_dmi_resize_png(path, width, height, resizetype) call(RUST_G, "dmi_resize_png")(path, width, height, resizetype)

#define rustg_noise_get_at_coordinates(seed, x, y) call(RUST_G, "noise_get_at_coordinates")(seed, x, y)
#define rustg_file_read(fname) call(RUST_G, "file_read")(fname)
#define rustg_file_exists(fname) call(RUST_G, "file_exists")(fname)
#define rustg_file_write(text, fname) call(RUST_G, "file_write")(text, fname)
#define rustg_file_append(text, fname) call(RUST_G, "file_append")(text, fname)

#ifdef RUSTG_OVERRIDE_BUILTINS
#define file2text(fname) rustg_file_read("[fname]")
#define text2file(text, fname) rustg_file_append(text, "[fname]")
#endif

#define rustg_git_revparse(rev) call(RUST_G, "rg_git_revparse")(rev)
#define rustg_git_commit_date(rev) call(RUST_G, "rg_git_commit_date")(rev)

#define rustg_log_write(fname, text, format) call(RUST_G, "log_write")(fname, text, format)
/proc/rustg_log_close_all() return call(RUST_G, "log_close_all")()

#define RUSTG_HTTP_METHOD_GET "get"
#define RUSTG_HTTP_METHOD_PUT "put"
#define RUSTG_HTTP_METHOD_DELETE "delete"
Expand All @@ -63,9 +81,21 @@
#define rustg_http_request_async(method, url, body, headers) call(RUST_G, "http_request_async")(method, url, body, headers)
#define rustg_http_check_request(req_id) call(RUST_G, "http_check_request")(req_id)

#define RUSTG_JOB_NO_RESULTS_YET "NO RESULTS YET"
#define RUSTG_JOB_NO_SUCH_JOB "NO SUCH JOB"
#define RUSTG_JOB_ERROR "JOB PANICKED"

#define rustg_json_is_valid(text) (call(RUST_G, "json_is_valid")(text) == "true")

#define rustg_log_write(fname, text, format) call(RUST_G, "log_write")(fname, text, format)
/proc/rustg_log_close_all() return call(RUST_G, "log_close_all")()

#define rustg_noise_get_at_coordinates(seed, x, y) call(RUST_G, "noise_get_at_coordinates")(seed, x, y)

#define rustg_sql_connect_pool(options) call(RUST_G, "sql_connect_pool")(options)
#define rustg_sql_query_async(handle, query, params) call(RUST_G, "sql_query_async")(handle, query, params)
#define rustg_sql_query_blocking(handle, query, params) call(RUST_G, "sql_query_blocking")(handle, query, params)
#define rustg_sql_connected(handle) call(RUST_G, "sql_connected")(handle)
#define rustg_sql_disconnect_pool(handle) call(RUST_G, "sql_disconnect_pool")(handle)
#define rustg_sql_check_query(job_id) call(RUST_G, "sql_check_query")("[job_id]")

2 changes: 1 addition & 1 deletion code/__HELPERS/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(/area/engine/eng
var/area/place = get_area(turfs[i])
if(blacklisted_areas[place.type])
continue
if(!place.requires_power || place.noteleport || place.hidden)
if(!place.requires_power || (place.area_flags & NOTELEPORT) || (place.area_flags & HIDDEN_AREA))
continue // No expanding powerless rooms etc
areas[place.name] = place
var/area_choice = input(creator, "Choose an area to expand or make a new area.", "Area Expansion") as null|anything in areas
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ B --><-- A
var/I = rand(1, L.len)
var/turf/T = L[I]
var/area/X = get_area(T)
if(!T.density && X.valid_territory)
if(!T.density && (X.area_flags & VALID_TERRITORY))
var/clear = TRUE
for(var/obj/O in T)
if(O.density)
Expand Down
13 changes: 13 additions & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ GLOBAL_LIST_INIT(bitfields, list(
"USES_TGUI" = USES_TGUI,
"FROZEN" = FROZEN,
),
"area_flags" = list(
"VALID_TERRITORY" = VALID_TERRITORY,
"BLOBS_ALLOWED" = BLOBS_ALLOWED,
"CAVES_ALLOWED" = CAVES_ALLOWED,
"FLORA_ALLOWED" = FLORA_ALLOWED,
"MOB_SPAWN_ALLOWED" = MOB_SPAWN_ALLOWED,
"MEGAFAUNA_SPAWN_ALLOWED" = MEGAFAUNA_SPAWN_ALLOWED,
"NOTELEPORT" = NOTELEPORT,
"HIDDEN_AREA" = HIDDEN_AREA,
"UNIQUE_AREA" = UNIQUE_AREA,
"BLOCK_SUICIDE" = BLOCK_SUICIDE,
"XENOBIOLOGY_COMPATIBLE" = XENOBIOLOGY_COMPATIBLE,
),
"datum_flags" = list(
"DF_USE_TAG" = DF_USE_TAG,
"DF_VAR_EDITED" = DF_VAR_EDITED,
Expand Down
3 changes: 3 additions & 0 deletions code/_globalvars/lists/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ GLOBAL_LIST_EMPTY(sortedAreas)
GLOBAL_LIST_EMPTY_TYPED(areas_by_type, /area)

GLOBAL_LIST_EMPTY(all_abstract_markers)

/// Global list of megafauna spawns on cave gen
GLOBAL_LIST_INIT(megafauna_spawn_list, list(/mob/living/simple_animal/hostile/megafauna/dragon = 4, /mob/living/simple_animal/hostile/megafauna/colossus = 2, /mob/living/simple_animal/hostile/megafauna/bubblegum = 6))
8 changes: 7 additions & 1 deletion code/controllers/subsystem/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ SUBSYSTEM_DEF(mapping)
repopulate_sorted_areas()
process_teleport_locs() //Sets up the wizard teleport locations
preloadTemplates()
run_map_generation()

#ifndef LOWMEMORYMODE
// Create space ruin levels
while (space_levels_so_far < config.space_ruin_levels)
Expand Down Expand Up @@ -281,7 +283,7 @@ GLOBAL_LIST_EMPTY(the_station_areas)
for(var/area/A in world)
if (is_type_in_typecache(A, station_areas_blacklist))
continue
if (!A.contents.len || !A.unique)
if (!A.contents.len || !(A.area_flags & UNIQUE_AREA))
continue
var/turf/picked = A.contents[1]
if (is_station_level(picked.z))
Expand All @@ -290,6 +292,10 @@ GLOBAL_LIST_EMPTY(the_station_areas)
if(!GLOB.the_station_areas.len)
log_world("ERROR: Station areas list failed to generate!")

/datum/controller/subsystem/mapping/proc/run_map_generation()
for(var/area/A in world)
A.RunGeneration()

/datum/controller/subsystem/mapping/proc/maprotate()
if(map_voted || SSmapping.next_map_config) //If voted or set by other means.
return
Expand Down
2 changes: 1 addition & 1 deletion code/datums/action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
/datum/action/item_action/vortex_recall/IsAvailable()
var/turf/current_location = get_turf(target)
var/area/current_area = current_location.loc
if(current_area.noteleport)
if(current_area.area_flags & NOTELEPORT)
to_chat(target, "[src] fizzles uselessly.")
return
if(istype(target, /obj/item/hierophant_club))
Expand Down
4 changes: 2 additions & 2 deletions code/datums/helper_datums/teleport.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

var/area/A = get_area(curturf)
var/area/B = get_area(destturf)
if(!forced && (HAS_TRAIT(teleatom, TRAIT_NO_TELEPORT) || A.noteleport || B.noteleport))
if(!forced && (HAS_TRAIT(teleatom, TRAIT_NO_TELEPORT) || (A.area_flags & NOTELEPORT) || (B.area_flags & NOTELEPORT)))
return FALSE

if(SEND_SIGNAL(destturf, COMSIG_ATOM_INTERCEPT_TELEPORT, channel, curturf, destturf))
Expand Down Expand Up @@ -157,7 +157,7 @@
if(T.is_transition_turf())
continue // Avoid picking these.
var/area/A = T.loc
if(!A.noteleport)
if(!(A.area_flags & NOTELEPORT))
posturfs.Add(T)
return posturfs

Expand Down
Loading