Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
14 changes: 10 additions & 4 deletions code/__DEFINES/_flags/area_flags.dm
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
//! Bitflags for /area/var/area_flags
/// Are you forbidden from teleporting to the area? (centcom, mobs, wizard, hand teleporter)
#define AREA_NO_TELEPORT (1<<0)
/// Hides area from player Teleport function.
#define AREA_HIDDEN (1<<1)
// todo: re-evaluate this
#define AREA_RAD_SHIELDED (1<<0) /// Radiation shielded.
#define AREA_RAD_SHIELDED (1<<5) /// Radiation shielded.
// todo: kill this with fire
#define AREA_FLAG_BLUE_SHIELDED (1<<1) /// Bluespace shielded.
#define AREA_FLAG_BLUE_SHIELDED (1<<6) /// Bluespace shielded.
// todo: better documentation
#define AREA_FLAG_EXTERNAL (1<<2) /// External as in exposed to space, not outside in a nice, green, forest.
#define AREA_FLAG_EXTERNAL (1<<7) /// External as in exposed to space, not outside in a nice, green, forest.
/// considered a volatile-changing area by persistence, which means things like trash and debris won't stay here
#define AREA_FLAG_ERODING (1<<3)
#define AREA_FLAG_ERODING (1<<8)

DEFINE_BITFIELD(area_flags, list(
BITFIELD(AREA_NO_TELEPORT),
BITFIELD(AREA_HIDDEN),
BITFIELD(AREA_RAD_SHIELDED),
BITFIELD(AREA_FLAG_BLUE_SHIELDED),
BITFIELD(AREA_FLAG_EXTERNAL),
Expand Down
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/signals_area.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
*/

//! /area signals
///from base of area/proc/power_change(): ()
#define COMSIG_AREA_POWER_CHANGE "area_power_change"
/// From base of area/Entered(): (atom/movable/arrived, area/old_area)
#define COMSIG_AREA_ENTERED "area_entered"
/// From base of area/Exited(): (atom/movable/gone, direction)
Expand Down
49 changes: 25 additions & 24 deletions code/__HELPERS/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
newA.setup(str)
// newA.default_gravity = oldA.default_gravity
GLOB.custom_areas[newA] = TRUE
// require_area_resort() //new area registered. resort the names
require_area_resort() //new area registered. resort the names
else
newA = area_choice

Expand Down Expand Up @@ -172,19 +172,14 @@

#undef BP_MAX_ROOM_SIZE

//Repopulates sortedAreas list
/proc/repopulate_sorted_areas()
GLOB.sortedAreas = list()
/proc/require_area_resort()
GLOB.sortedAreas = null

for(var/area/A in world)
GLOB.sortedAreas.Add(A)

tim_sort(GLOB.sortedAreas, GLOBAL_PROC_REF(cmp_name_asc))
setupTeleportLocs() // shitcode patch to make vorecode work until we get rid of this shit meme or refactor it entirely

/area/proc/addSorted()
GLOB.sortedAreas.Add(src)
tim_sort(GLOB.sortedAreas, GLOBAL_PROC_REF(cmp_name_asc))
/// Returns a sorted version of GLOB.areas, by name
/proc/get_sorted_areas()
if(!GLOB.sortedAreas)
GLOB.sortedAreas = tim_sort(GLOB.areas.Copy(), /proc/cmp_name_asc)
return GLOB.sortedAreas

//Takes: Area type as a text string from a variable.
//Returns: Instance for the area in the world.
Expand All @@ -207,17 +202,23 @@
var/list/areas = list()
if(subtypes)
var/list/cache = typecacheof(areatype)
for(var/V in GLOB.sortedAreas)
var/area/A = V
if(cache[A.type])
areas += V
for(var/area/area_to_check as anything in GLOB.areas)
if(cache[area_to_check.type])
areas += area_to_check
else
for(var/V in GLOB.sortedAreas)
var/area/A = V
if(A.type == areatype)
areas += V
for(var/area/area_to_check as anything in GLOB.areas)
if(area_to_check.type == areatype)
areas += area_to_check
return areas

/// Iterates over all turfs in the target area and returns the first non-dense one
/proc/get_first_open_turf_in_area(area/target)
if(!target)
return
for(var/turf/turf in target)
if(!turf.density)
return turf

//Takes: Area type as text string or as typepath OR an instance of the area.
//Returns: A list of all turfs in areas of that type of that type in the world.
/proc/get_area_turfs(areatype, target_z = 0, subtypes=FALSE)
Expand All @@ -237,15 +238,15 @@
var/list/turfs = list()
if(subtypes)
var/list/cache = typecacheof(areatype)
for(var/V in GLOB.sortedAreas)
for(var/V in GLOB.areas)
var/area/A = V
if(!cache[A.type])
continue
for(var/turf/T in A)
if(target_z == 0 || target_z == T.z)
turfs += T
else
for(var/V in GLOB.sortedAreas)
for(var/V in GLOB.areas)
var/area/A = V
if(A.type != areatype)
continue
Expand All @@ -266,7 +267,7 @@
var/prevname = "[area_to_rename.name]"
set_area_machinery_title(area_to_rename, new_name, prevname)
area_to_rename.name = new_name
// require_area_resort() //area renamed so resort the names
require_area_resort() //area renamed so resort the names

// if(LAZYLEN(area_to_rename.firedoors))
// for(var/obj/machinery/door/firedoor/area_firedoors as anything in area_to_rename.firedoors)
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/names.dm
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ var/syndicate_code_response//Code response for traitors.
var/safety[] = list(1,2,3)//Tells the proc which options to remove later on.
var/nouns[] = list("love","hate","anger","peace","pride","sympathy","bravery","loyalty","honesty","integrity","compassion","charity","success","courage","deceit","skill","beauty","brilliance","pain","misery","beliefs","dreams","justice","truth","faith","liberty","knowledge","thought","information","culture","trust","dedication","progress","education","hospitality","leisure","trouble","friendships", "relaxation")
var/drinks[] = list("vodka and tonic","gin fizz","bahama mama","manhattan","black Russian","whiskey soda","long island tea","margarita","Irish coffee"," manly dwarf","Irish cream","doctor's delight","Beepksy Smash","tequila sunrise","brave bull","gargle blaster","bloody mary","whiskey cola","white Russian","vodka martini","martini","Cuba libre","kahlua","vodka","wine","moonshine")
var/locations[] = teleportlocs.len ? teleportlocs : drinks//if null, defaults to drinks instead.
var/locations[] = GLOB.teleportlocs.len ? GLOB.teleportlocs : drinks//if null, defaults to drinks instead.

var/names[] = list()
for(var/datum/data/record/t in data_core.general)//Picks from crew manifest.
Expand Down
3 changes: 3 additions & 0 deletions code/_globals/lists/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ GLOBAL_REAL_LIST(ccw_dir) = list( // cww_dir[dir] = counter-clockwise rotation o
48, 56, 52, 60, 49, 57, 53, 61, 50, 58, 54, 62, 51, 59, 55, 63 // UP+DOWN - Same as first line but +48
)

/// Just a list of all the area objects in the game
/// Note, areas can have duplicate types
GLOBAL_LIST_EMPTY(areas)
/// used by jump-to-area etc. Updated by area/updateName()
GLOBAL_LIST_EMPTY(sortedAreas)
/// An association from typepath to area instance. Only includes areas with `unique` set.
Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystem/emergency_shuttle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ SUBSYSTEM_DEF(emergencyshuttle)

evac = 1
emergency_shuttle_called.Announce(replacetext((LEGACY_MAP_DATUM).emergency_shuttle_called_message, "%ETA%", "[estimated_time] minute\s"))
for(var/area/A in GLOB.sortedAreas)
for(var/area/A in get_sorted_areas())
if(istype(A, /area/hallway))
A.readyalert()
if(SSlegacy_atc.squelched == FALSE)
Expand Down Expand Up @@ -124,7 +124,7 @@ SUBSYSTEM_DEF(emergencyshuttle)
if (evac)
emergency_shuttle_recalled.Announce((LEGACY_MAP_DATUM).emergency_shuttle_recall_message)

for(var/area/A in GLOB.sortedAreas)
for(var/area/A in get_sorted_areas())
if(istype(A, /area/hallway))
A.readyreset()
evac = 0
Expand Down
3 changes: 1 addition & 2 deletions code/controllers/subsystem/mapping/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ SUBSYSTEM_DEF(mapping)
populate_spawn_points()

// finalize
// todo: refactor
repopulate_sorted_areas()
process_teleport_locs() //Sets up the wizard teleport locations

return SS_INIT_SUCCESS

Expand Down
5 changes: 3 additions & 2 deletions code/game/area/Space Station 13 areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
// All shuttles should now be under shuttle since we have smooth-wall code.

/area/shuttle
requires_power = 0
requires_power = FALSE
area_flags = AREA_RAD_SHIELDED | AREA_FLAG_ERODING
sound_env = SMALL_ENCLOSED
area_limited_icon_smoothing = /area/shuttle
Expand Down Expand Up @@ -576,7 +576,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
name = "\improper Independent Station"
icon_state = "yellow"
requires_power = 0
area_flags = AREA_RAD_SHIELDED
area_flags = AREA_RAD_SHIELDED | AREA_NO_TELEPORT
ambience = AMBIENCE_HIGHSEC

/area/syndicate_station/start
Expand Down Expand Up @@ -631,6 +631,7 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
name = "\improper Wizard's Den"
icon_state = "yellow"
requires_power = 0
area_flags = AREA_NO_TELEPORT
ambience = AMBIENCE_OTHERWORLDLY

/area/skipjack_station
Expand Down
Loading
Loading