diff --git a/code/__HELPERS/areas.dm b/code/__HELPERS/areas.dm
index 1f5b82f7bf..316c159fb8 100644
--- a/code/__HELPERS/areas.dm
+++ b/code/__HELPERS/areas.dm
@@ -1,5 +1,81 @@
#define BP_MAX_ROOM_SIZE 300
+//Repopulates sortedAreas list
+/proc/repopulate_sorted_areas()
+ GLOB.sortedAreas = list()
+
+ for(var/area/A in world)
+ GLOB.sortedAreas.Add(A)
+
+ sortTim(GLOB.sortedAreas, /proc/cmp_name_asc)
+
+/area/proc/addSorted()
+ GLOB.sortedAreas.Add(src)
+ sortTim(GLOB.sortedAreas, /proc/cmp_name_asc)
+
+//Takes: Area type as a text string from a variable.
+//Returns: Instance for the area in the world.
+/proc/get_area_instance_from_text(areatext)
+ if(istext(areatext))
+ areatext = text2path(areatext)
+ return GLOB.areas_by_type[areatext]
+
+//Takes: Area type as text string or as typepath OR an instance of the area.
+//Returns: A list of all areas of that type in the world.
+/proc/get_areas(areatype, subtypes=TRUE)
+ if(istext(areatype))
+ areatype = text2path(areatype)
+ else if(isarea(areatype))
+ var/area/areatemp = areatype
+ areatype = areatemp.type
+ else if(!ispath(areatype))
+ return null
+
+ 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
+ else
+ for(var/V in GLOB.sortedAreas)
+ var/area/A = V
+ if(A.type == areatype)
+ areas += V
+ return areas
+
+//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)
+ if(istext(areatype))
+ areatype = text2path(areatype)
+ else if(isarea(areatype))
+ var/area/areatemp = areatype
+ areatype = areatemp.type
+ else if(!ispath(areatype))
+ return null
+
+ var/list/turfs = list()
+ if(subtypes)
+ var/list/cache = typecacheof(areatype)
+ for(var/V in GLOB.sortedAreas)
+ 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)
+ var/area/A = V
+ if(A.type != areatype)
+ continue
+ for(var/turf/T in A)
+ if(target_z == 0 || target_z == T.z)
+ turfs += T
+ return turfs
+
// Gets an atmos isolated contained space
// Returns an associative list of turf|dirs pairs
// The dirs are connected turfs in the same space
@@ -96,4 +172,59 @@
to_chat(creator, "You have created a new area, named [newA.name]. It is now weather proof, and constructing an APC will allow it to be powered.")
return TRUE
+
+/**
+ * Returns either the base area the target's belongs to or the target's area itself.
+ */
+/proc/get_base_area(atom/target)
+ var/area/A = get_area(target)
+ if(A?.master_area)
+ return A.master_area
+ return A
+
+/**
+ * Returns either null, or a list containing all the sub_areas associated with the base area the target is located in.
+ * If include_base is TRUE, the base area will also be added to the return list.
+ */
+/proc/get_sub_areas(atom/target, include_base = FALSE)
+ var/area/A = get_area(target)
+ if(!A)
+ return
+ . = list()
+ if(A.master_area)
+ A = A.master_area
+ if(include_base)
+ . += A
+ if(A.sub_areas)
+ . += A.sub_areas
+
+/**
+ * Proc for purposes similar to the get_areas_turfs(), but aimed to include associated areas.
+ * Only takes area (A) instances and paths, no text strings.
+ * Returns a list of all turfs found in the associated sub_areas (including the base's if include_base is TRUE)
+ * and located in the same z as target_z, or anywhere if the latter is 0
+ */
+
+/proc/get_sub_areas_turfs(area/A, target_z = 0, include_base = TRUE)
+ var/list/contents = get_sub_areas_contents(A, include_base)
+ . = list()
+ for(var/turf/T in contents)
+ if(target_z == 0 || target_z == T.z)
+ . += T
+/**
+ * Simple proc that returns all a sum of all contents from all associated areas,
+ * Think of the above but for all contents, not just turfs, and without target z.
+ */
+
+/proc/get_sub_areas_contents(area/A, include_base = TRUE)
+ if(ispath(A))
+ A = GLOB.areas_by_type[A]
+ if(!A)
+ return
+ if(A.master_area)
+ A = A.master_area
+ . = list(A.contents)
+ for(var/i in A.sub_areas)
+ . += A.sub_areas[i].contents
+
#undef BP_MAX_ROOM_SIZE
diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm
index d76fc7731a..4b43782b12 100644
--- a/code/__HELPERS/game.dm
+++ b/code/__HELPERS/game.dm
@@ -8,8 +8,8 @@
#define Z_TURFS(ZLEVEL) block(locate(1,1,ZLEVEL), locate(world.maxx, world.maxy, ZLEVEL))
#define CULT_POLL_WAIT 2400
-/proc/get_area_name(atom/X, format_text = FALSE)
- var/area/A = isarea(X) ? X : get_area(X)
+/proc/get_area_name(atom/X, format_text = FALSE, get_base_area = FALSE)
+ var/area/A = get_base_area ? get_base_area(X) : get_area(X)
if(!A)
return null
return format_text ? format_text(A.name) : A.name
diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm
index 9abe42ea8e..1080dc5710 100644
--- a/code/__HELPERS/unsorted.dm
+++ b/code/__HELPERS/unsorted.dm
@@ -566,82 +566,6 @@ Turf and target are separate in case you want to teleport some distance from a t
else
return 0
-//Repopulates sortedAreas list
-/proc/repopulate_sorted_areas()
- GLOB.sortedAreas = list()
-
- for(var/area/A in world)
- GLOB.sortedAreas.Add(A)
-
- sortTim(GLOB.sortedAreas, /proc/cmp_name_asc)
-
-/area/proc/addSorted()
- GLOB.sortedAreas.Add(src)
- sortTim(GLOB.sortedAreas, /proc/cmp_name_asc)
-
-//Takes: Area type as a text string from a variable.
-//Returns: Instance for the area in the world.
-/proc/get_area_instance_from_text(areatext)
- if(istext(areatext))
- areatext = text2path(areatext)
- return GLOB.areas_by_type[areatext]
-
-//Takes: Area type as text string or as typepath OR an instance of the area.
-//Returns: A list of all areas of that type in the world.
-/proc/get_areas(areatype, subtypes=TRUE)
- if(istext(areatype))
- areatype = text2path(areatype)
- else if(isarea(areatype))
- var/area/areatemp = areatype
- areatype = areatemp.type
- else if(!ispath(areatype))
- return null
-
- 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
- else
- for(var/V in GLOB.sortedAreas)
- var/area/A = V
- if(A.type == areatype)
- areas += V
- return areas
-
-//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)
- if(istext(areatype))
- areatype = text2path(areatype)
- else if(isarea(areatype))
- var/area/areatemp = areatype
- areatype = areatemp.type
- else if(!ispath(areatype))
- return null
-
- var/list/turfs = list()
- if(subtypes)
- var/list/cache = typecacheof(areatype)
- for(var/V in GLOB.sortedAreas)
- 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)
- var/area/A = V
- if(A.type != areatype)
- continue
- for(var/turf/T in A)
- if(target_z == 0 || target_z == T.z)
- turfs += T
- return turfs
-
/proc/get_cardinal_dir(atom/A, atom/B)
var/dx = abs(B.x - A.x)
var/dy = abs(B.y - A.y)
diff --git a/code/datums/components/virtual_reality.dm b/code/datums/components/virtual_reality.dm
index 7bad836e47..d72b741abe 100644
--- a/code/datums/components/virtual_reality.dm
+++ b/code/datums/components/virtual_reality.dm
@@ -114,7 +114,7 @@
to_chat(mastermind, "You feel everything fading away...")
dreamer.death(FALSE)
if(cleanup)
- var/obj/effect/vr_clean_master/cleanbot = locate() in get_area(M)
+ var/obj/effect/vr_clean_master/cleanbot = locate() in get_base_area(M)
if(cleanbot)
LAZYADD(cleanbot.corpse_party, M)
if(vr_sleeper)
diff --git a/code/datums/diseases/wizarditis.dm b/code/datums/diseases/wizarditis.dm
index b288046380..3a74663643 100644
--- a/code/datums/diseases/wizarditis.dm
+++ b/code/datums/diseases/wizarditis.dm
@@ -94,7 +94,7 @@ STI KALY - blind
var/area/thearea = pick(theareas)
var/list/L = list()
- for(var/turf/T in get_area_turfs(thearea.type))
+ for(var/turf/T in thearea)
if(T.z != affected_mob.z)
continue
if(T.name == "space")
diff --git a/code/datums/weather/weather.dm b/code/datums/weather/weather.dm
index a3b666dcc6..01b9facbb8 100644
--- a/code/datums/weather/weather.dm
+++ b/code/datums/weather/weather.dm
@@ -50,7 +50,10 @@
stage = STARTUP_STAGE
var/list/affectareas = list()
for(var/V in get_areas(area_type))
- affectareas += V
+ var/area/A = V
+ affectareas |= A
+ if(A.sub_areas)
+ affectareas |= A.sub_areas
for(var/V in protected_areas)
affectareas -= get_areas(V)
for(var/V in affectareas)
diff --git a/code/datums/wires/airalarm.dm b/code/datums/wires/airalarm.dm
index 6eb4dc04db..0c4715e27e 100644
--- a/code/datums/wires/airalarm.dm
+++ b/code/datums/wires/airalarm.dm
@@ -46,7 +46,7 @@
A.mode = 1 // AALARM_MODE_SCRUB
A.apply_mode()
if(WIRE_ALARM) // Clear alarms.
- var/area/AA = get_area(A)
+ var/area/AA = get_base_area(A)
if(AA.atmosalert(0, holder))
A.post_alert(0)
A.update_icon()
@@ -68,7 +68,7 @@
A.mode = 3 // AALARM_MODE_PANIC
A.apply_mode()
if(WIRE_ALARM) // Post alarm.
- var/area/AA = get_area(A)
+ var/area/AA = get_base_area(A)
if(AA.atmosalert(2, holder))
A.post_alert(2)
A.update_icon()
\ No newline at end of file
diff --git a/code/game/area/Space_Station_13_areas.dm b/code/game/area/Space_Station_13_areas.dm
index fa66306302..733a5ace75 100644
--- a/code/game/area/Space_Station_13_areas.dm
+++ b/code/game/area/Space_Station_13_areas.dm
@@ -403,7 +403,6 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
/area/crew_quarters/dorms
name = "Dormitories"
icon_state = "Sleep"
- safe = TRUE
/area/crew_quarters/dorms/male
name = "Male Dorm"
@@ -413,6 +412,29 @@ NOTE: there are two lists of areas in the end of this file: centcom and station
name = "Female Dorm"
icon_state = "Sleep"
+/area/crew_quarters/dorms/cabin
+ name = "Dorms Cabin One"
+ icon_state = "sleep_cabin"
+ safe = TRUE
+
+/area/crew_quarters/dorms/cabin/two
+ name = "Dorms Cabin Two"
+
+/area/crew_quarters/dorms/cabin/three
+ name = "Dorms Cabin Three"
+
+/area/crew_quarters/dorms/cabin/four
+ name = "Dorms Cabin Four"
+
+/area/crew_quarters/dorms/cabin/five
+ name = "Dorms Cabin Five"
+
+/area/crew_quarters/dorms/cabin/six
+ name = "Dorms Cabin Six"
+
+/area/crew_quarters/dorms/cabin/seven
+ name = "Dorms Cabin Seven"
+
/area/crew_quarters/rehab_dome
name = "Rehabilitation Dome"
icon_state = "Sleep"
diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm
index 612c3cba42..74e238cdc0 100644
--- a/code/game/area/areas.dm
+++ b/code/game/area/areas.dm
@@ -63,6 +63,15 @@
var/xenobiology_compatible = FALSE //Can the Xenobio management console transverse this area by default?
var/list/canSmoothWithAreas //typecache to limit the areas that atoms in this area can smooth with
+/**
+ * These two vars allow for multiple unique areas to be linked to a master area
+ * for reasons such as APC powernet nodes, fire alarms and similar, without sacrificing
+ * their own flags, statuses, variables and uniqueness.
+ * Friendly reminder: don't varedit area paths, make new typepaths instead.
+ */
+ var/list/area/sub_areas //list of typepaths of the areas you wish to link here, will be replaced with a list of references on mapload.
+ var/area/master_area //The area we wish to use in place of src for certain actions such as APC area linking.
+
/*Adding a wizard area teleport list because motherfucking lag -- Urist*/
/*I am far too lazy to make it a proper list of areas so I'll just make it run the usual telepot routine at the start of the game*/
GLOBAL_LIST_EMPTY(teleportlocs)
@@ -121,10 +130,31 @@ GLOBAL_LIST_EMPTY(teleportlocs)
reg_in_areas_in_z()
+ //so far I'm only implementing it on mapped unique areas, it's easier this way.
+ if(unique && LAZYLEN(sub_areas))
+ var/paths = sub_areas.Copy()
+ sub_areas = null
+ for(var/type in paths)
+ var/area/A = GLOB.areas_by_type[type]
+ if(!A)
+ /* By chance an area not loaded in the station, ruin or map, let's not bother for now.
+ WARNING("No area of type [type] found in GLOB.areas_by_type for [src]'s linked areas.")
+ */
+ continue
+ if(A == src)
+ WARNING("\"[src]\" area a attempted to link with itself.")
+ continue
+ if(A.master_area)
+ WARNING("[src] attempted to link with [A] while the latter is already linked to another area ([A.master_area]).")
+ continue
+ LAZYADD(sub_areas, A)
+ A.master_area = src
+
return INITIALIZE_HINT_LATELOAD
/area/LateInitialize()
- power_change() // all machines set to current power level, also updates icon
+ if(!master_area) //we don't want to run it twice.
+ power_change() // all machines set to current power level, also updates icon
/area/proc/reg_in_areas_in_z()
if(contents.len)
@@ -147,6 +177,19 @@ GLOBAL_LIST_EMPTY(teleportlocs)
/area/Destroy()
if(GLOB.areas_by_type[type] == src)
GLOB.areas_by_type[type] = null
+ if(master_area)
+ LAZYREMOVE(master_area, src)
+ master_area = null
+ if(sub_areas)
+ for(var/i in sub_areas)
+ var/area/A = i
+ A.master_area = null
+ sub_areas -= A
+ if(A.requires_power)
+ A.power_light = FALSE
+ A.power_equip = FALSE
+ A.power_environ = FALSE
+ INVOKE_ASYNC(A, .proc/power_change)
STOP_PROCESSING(SSobj, src)
return ..()
@@ -212,9 +255,11 @@ GLOBAL_LIST_EMPTY(teleportlocs)
var/datum/computer_file/program/alarm_monitor/p = item
p.cancelAlarm("Atmosphere", src, source)
- src.atmosalm = danger_level
- return 1
- return 0
+ atmosalm = danger_level
+ for(var/i in sub_areas)
+ sub_areas[i].atmosalm = danger_level
+ return TRUE
+ return FALSE
/area/proc/ModifyFiredoors(opening)
if(firedoors)
@@ -239,7 +284,7 @@ GLOBAL_LIST_EMPTY(teleportlocs)
return
if (!fire)
- set_fire_alarm_effect()
+ set_fire_alarm_effects(TRUE)
ModifyFiredoors(FALSE)
for(var/item in firealarms)
var/obj/machinery/firealarm/F = item
@@ -262,7 +307,7 @@ GLOBAL_LIST_EMPTY(teleportlocs)
/area/proc/firereset(obj/source)
if (fire)
- unset_fire_alarm_effects()
+ set_fire_alarm_effects(FALSE)
ModifyFiredoors(TRUE)
for(var/item in firealarms)
var/obj/machinery/firealarm/F = item
@@ -298,9 +343,9 @@ GLOBAL_LIST_EMPTY(teleportlocs)
return
//Trigger alarm effect
- set_fire_alarm_effect()
+ set_fire_alarm_effects(TRUE)
//Lockdown airlocks
- for(var/obj/machinery/door/DOOR in src)
+ for(var/obj/machinery/door/DOOR in get_sub_areas_contents(src))
close_and_lock_door(DOOR)
for (var/i in GLOB.silicon_mobs)
@@ -309,23 +354,16 @@ GLOBAL_LIST_EMPTY(teleportlocs)
//Cancel silicon alert after 1 minute
addtimer(CALLBACK(SILICON, /mob/living/silicon.proc/cancelAlarm,"Burglar",src,trigger), 600)
-/area/proc/set_fire_alarm_effect()
- fire = TRUE
- mouse_opacity = MOUSE_OPACITY_TRANSPARENT
- for(var/alarm in firealarms)
- var/obj/machinery/firealarm/F = alarm
- F.update_fire_light(fire)
- for(var/obj/machinery/light/L in src)
- L.update()
-
-/area/proc/unset_fire_alarm_effects()
- fire = FALSE
+/area/proc/set_fire_alarm_effects(boolean)
+ fire = boolean
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
for(var/alarm in firealarms)
var/obj/machinery/firealarm/F = alarm
F.update_fire_light(fire)
for(var/obj/machinery/light/L in src)
L.update()
+ for(var/i in sub_areas)
+ sub_areas[i].fire = boolean
/area/proc/updateicon()
var/weather_icon
@@ -370,26 +408,34 @@ GLOBAL_LIST_EMPTY(teleportlocs)
/area/proc/power_change()
for(var/obj/machinery/M in src) // for each machine in the area
M.power_change() // reverify power status (to update icons etc.)
+ if(sub_areas)
+ for(var/i in sub_areas)
+ var/area/A = i
+ A.power_light = power_light
+ A.power_equip = power_equip
+ A.power_environ = power_environ
+ INVOKE_ASYNC(A, .proc/power_change)
updateicon()
/area/proc/usage(chan)
- var/used = 0
switch(chan)
if(LIGHT)
- used += used_light
+ . += used_light
if(EQUIP)
- used += used_equip
+ . += used_equip
if(ENVIRON)
- used += used_environ
+ . += used_environ
if(TOTAL)
- used += used_light + used_equip + used_environ
+ . += used_light + used_equip + used_environ
if(STATIC_EQUIP)
- used += static_equip
+ . += static_equip
if(STATIC_LIGHT)
- used += static_light
+ . += static_light
if(STATIC_ENVIRON)
- used += static_environ
- return used
+ . += static_environ
+ if(sub_areas)
+ for(var/i in sub_areas)
+ . += sub_areas[i].usage(chan)
/area/proc/addStaticPower(value, powerchannel)
switch(powerchannel)
@@ -404,6 +450,9 @@ GLOBAL_LIST_EMPTY(teleportlocs)
used_equip = 0
used_light = 0
used_environ = 0
+ if(sub_areas)
+ for(var/i in sub_areas)
+ sub_areas[i].clear_usage()
/area/proc/use_power(amount, chan)
diff --git a/code/game/gamemodes/events.dm b/code/game/gamemodes/events.dm
index 8d3254933a..d0671dd285 100644
--- a/code/game/gamemodes/events.dm
+++ b/code/game/gamemodes/events.dm
@@ -12,7 +12,7 @@
var/list/skipped_areas = list(/area/engine/engineering, /area/engine/supermatter, /area/engine/atmospherics_engine, /area/ai_monitored/turret_protected/ai)
for(var/area/A in world)
- if( !A.requires_power || A.always_unpowered )
+ if( !A.requires_power || A.always_unpowered || A.master_area)
continue
var/skip = 0
@@ -61,8 +61,9 @@
S.output_attempt = 1
S.update_icon()
S.power_change()
+
for(var/area/A in world)
- if(!istype(A, /area/space) && !istype(A, /area/shuttle) && !istype(A, /area/arrival))
+ if(!istype(A, /area/space) && !istype(A, /area/shuttle) && !istype(A, /area/arrival) && !A.always_unpowered && !A.master_area)
A.power_light = TRUE
A.power_equip = TRUE
A.power_environ = TRUE
diff --git a/code/game/machinery/cell_charger.dm b/code/game/machinery/cell_charger.dm
index 1839e44e3b..c0317f0c94 100644
--- a/code/game/machinery/cell_charger.dm
+++ b/code/game/machinery/cell_charger.dm
@@ -44,7 +44,7 @@
var/area/a = loc.loc // Gets our locations location, like a dream within a dream
if(!isarea(a))
return
- if(a.power_equip == 0) // There's no APC in this area, don't try to cheat power!
+ if(!a.powered(EQUIP)) // There's no APC in this area, don't try to cheat power!
to_chat(user, "[src] blinks red as you try to insert the cell!")
return
if(!user.transferItemToLoc(W,src))
diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm
index dec41b0a59..61ad9f7c41 100644
--- a/code/game/machinery/doors/firedoor.dm
+++ b/code/game/machinery/doors/firedoor.dm
@@ -44,7 +44,7 @@
/obj/machinery/door/firedoor/proc/CalculateAffectingAreas()
remove_from_areas()
- affecting_areas = get_adjacent_open_areas(src) | get_area(src)
+ affecting_areas = get_adjacent_open_areas(src) | get_base_area(src)
for(var/I in affecting_areas)
var/area/A = I
LAZYADD(A.firedoors, src)
diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm
index 5c2676c2b9..fd7d2216ce 100644
--- a/code/game/machinery/firealarm.dm
+++ b/code/game/machinery/firealarm.dm
@@ -44,7 +44,7 @@
pixel_x = (dir & 3)? 0 : (dir == 4 ? -24 : 24)
pixel_y = (dir & 3)? (dir ==1 ? -24 : 24) : 0
update_icon()
- myarea = get_area(src)
+ myarea = get_base_area(src)
LAZYADD(myarea.firealarms, src)
/obj/machinery/firealarm/Destroy()
@@ -116,14 +116,14 @@
if(!is_operational() && (last_alarm+FIREALARM_COOLDOWN < world.time))
return
last_alarm = world.time
- var/area/A = get_area(src)
+ var/area/A = get_base_area(src)
A.firealert(src)
playsound(src.loc, 'goon/sound/machinery/FireAlarm.ogg', 75)
/obj/machinery/firealarm/proc/reset()
if(!is_operational())
return
- var/area/A = get_area(src)
+ var/area/A = get_base_area(src)
A.firereset(src)
/obj/machinery/firealarm/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
@@ -142,7 +142,7 @@
else
data["seclevel"] = "green"
- var/area/A = get_area(src)
+ var/area/A = get_base_area(src)
data["alarm"] = A.fire
return data
@@ -306,7 +306,7 @@
/obj/machinery/firealarm/partyalarm/reset()
if (stat & (NOPOWER|BROKEN))
return
- var/area/A = get_area(src)
+ var/area/A = get_base_area(src)
if (!A || !A.party)
return
A.party = FALSE
@@ -315,7 +315,7 @@
/obj/machinery/firealarm/partyalarm/alarm()
if (stat & (NOPOWER|BROKEN))
return
- var/area/A = get_area(src)
+ var/area/A = get_base_area(src)
if (!A || A.party || A.name == "Space")
return
A.party = TRUE
@@ -325,5 +325,5 @@
/obj/machinery/firealarm/partyalarm/ui_data(mob/user)
. = ..()
- var/area/A = get_area(src)
+ var/area/A = get_base_area(src)
.["alarm"] = A && A.party
diff --git a/code/game/machinery/recharger.dm b/code/game/machinery/recharger.dm
index 927608d3d5..001ef94163 100755
--- a/code/game/machinery/recharger.dm
+++ b/code/game/machinery/recharger.dm
@@ -53,7 +53,7 @@
//Checks to make sure he's not in space doing it, and that the area got proper power.
var/area/a = get_area(src)
- if(!isarea(a) || a.power_equip == 0)
+ if(!a || !a.powered(EQUIP))
to_chat(user, "[src] blinks red as you try to insert [G].")
return 1
diff --git a/code/game/mecha/equipment/tools/other_tools.dm b/code/game/mecha/equipment/tools/other_tools.dm
index a8ba9850ff..579273d5e5 100644
--- a/code/game/mecha/equipment/tools/other_tools.dm
+++ b/code/game/mecha/equipment/tools/other_tools.dm
@@ -283,7 +283,7 @@
/obj/item/mecha_parts/mecha_equipment/tesla_energy_relay/proc/get_charge()
if(equip_ready) //disabled
return
- var/area/A = get_area(chassis)
+ var/area/A = get_base_area(chassis)
var/pow_chan = get_power_channel(A)
if(pow_chan)
return 1000 //making magic
@@ -328,7 +328,7 @@
occupant_message("No powercell detected.")
return
if(cur_charge < chassis.cell.maxcharge)
- var/area/A = get_area(chassis)
+ var/area/A = get_base_area(chassis)
if(A)
var/pow_chan
for(var/c in list(EQUIP,ENVIRON,LIGHT))
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index 10ee73915c..a3ba63108c 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -126,7 +126,7 @@
T.PlaceOnTop(/turf/open/floor/plating/foam)
for(var/direction in GLOB.cardinals)
var/turf/cardinal_turf = get_step(T, direction)
- if(get_area(cardinal_turf) != get_area(T)) //We're at an area boundary, so let's block off this turf!
+ if(get_base_area(cardinal_turf) != get_area(T)) //We're at an area boundary, so let's block off this turf!
new/obj/structure/foamedmetal(T)
break
flick("[icon_state]-disolve", src)
diff --git a/code/game/objects/items/crayons.dm b/code/game/objects/items/crayons.dm
index 2a7b5d24cd..4a8c46e551 100644
--- a/code/game/objects/items/crayons.dm
+++ b/code/game/objects/items/crayons.dm
@@ -425,7 +425,7 @@
/obj/item/toy/crayon/proc/can_claim_for_gang(mob/user, atom/target)
// Check area validity.
// Reject space, player-created areas, and non-station z-levels.
- var/area/A = get_area(target)
+ var/area/A = get_base_area(target)
if(!A || (!is_station_level(A.z)) || !A.valid_territory)
to_chat(user, "[A] is unsuitable for tagging.")
return FALSE
@@ -459,7 +459,7 @@
qdel(old_marking)
var/datum/antagonist/gang/G = user.mind.has_antag_datum(/datum/antagonist/gang)
- var/area/territory = get_area(target)
+ var/area/territory = get_base_area(target)
new /obj/effect/decal/cleanable/crayon/gang(target,G.gang,"graffiti",0,user) // Heres the gang tag.
to_chat(user, "You tagged [territory] for your gang!")
diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm
index 8964d1ca41..0b8732fb1c 100644
--- a/code/game/objects/structures/ai_core.dm
+++ b/code/game/objects/structures/ai_core.dm
@@ -52,7 +52,7 @@
var/area/A = get_area(src)
if(!A.blob_allowed)
return FALSE
- if(!A.power_equip)
+ if(!A.powered(EQUIP))
return FALSE
if(!SSmapping.level_trait(T.z,ZTRAIT_STATION))
return FALSE
diff --git a/code/game/objects/structures/displaycase.dm b/code/game/objects/structures/displaycase.dm
index 771b4bc04e..df1b6cadf8 100644
--- a/code/game/objects/structures/displaycase.dm
+++ b/code/game/objects/structures/displaycase.dm
@@ -80,7 +80,7 @@
/obj/structure/displaycase/proc/trigger_alarm()
//Activate Anti-theft
if(alert)
- var/area/alarmed = get_area(src)
+ var/area/alarmed = get_base_area(src)
alarmed.burglaralert(src)
playsound(src, 'sound/effects/alert.ogg', 50, 1)
diff --git a/code/modules/VR/vr_sleeper.dm b/code/modules/VR/vr_sleeper.dm
index 72cbdc1409..dd9620e3be 100644
--- a/code/modules/VR/vr_sleeper.dm
+++ b/code/modules/VR/vr_sleeper.dm
@@ -211,17 +211,20 @@
/obj/effect/vr_clean_master/Initialize()
. = ..()
- vr_area = get_area(src)
- addtimer(CALLBACK(src, .proc/clean_up), 3 MINUTES)
+ vr_area = get_base_area(src)
+ addtimer(CALLBACK(src, .proc/clean_up), 3 MINUTES, TIMER_LOOP)
/obj/effect/vr_clean_master/proc/clean_up()
- if (vr_area)
- for (var/obj/item/ammo_casing/casing in vr_area)
- qdel(casing)
- for(var/obj/effect/decal/cleanable/C in vr_area)
- qdel(C)
- for (var/A in corpse_party)
- var/mob/M = A
- if(get_area(M) == vr_area && M.stat == DEAD)
- qdel(M)
- addtimer(CALLBACK(src, .proc/clean_up), 3 MINUTES)
+ if (!vr_area)
+ qdel(src)
+ return
+ var/list/contents = get_sub_areas_contents(src)
+ for (var/obj/item/ammo_casing/casing in contents)
+ qdel(casing)
+ for(var/obj/effect/decal/cleanable/C in contents)
+ qdel(C)
+ for (var/A in corpse_party)
+ var/mob/M = A
+ if(!QDELETED(M) && (M in contents) && M.stat == DEAD)
+ qdel(M)
+ corpse_party -= M
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 53fdb315b5..e474e4c9fe 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -541,7 +541,9 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
var/list/areas_all = list()
var/list/areas_with_APC = list()
var/list/areas_with_multiple_APCs = list()
+ var/list/sub_areas_APC = list()
var/list/areas_with_air_alarm = list()
+ var/list/sub_areas_air_alarm = list()
var/list/areas_with_RC = list()
var/list/areas_with_light = list()
var/list/areas_with_LS = list()
@@ -578,6 +580,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!A)
dat += "Skipped over [APC] in invalid location, [APC.loc]."
continue
+ LAZYSET(sub_areas_APC, A.type, get_sub_areas(A, FALSE))
if(!(A.type in areas_with_APC))
areas_with_APC.Add(A.type)
else if(A.type in areas_all)
@@ -585,10 +588,11 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
CHECK_TICK
for(var/obj/machinery/airalarm/AA in GLOB.machines)
- var/area/A = get_area(AA)
+ var/area/A = get_base_area(AA)
if(!A) //Make sure the target isn't inside an object, which results in runtimes.
dat += "Skipped over [AA] in invalid location, [AA.loc].
"
continue
+ LAZYSET(sub_areas_air_alarm, A.type, get_sub_areas(A, FALSE))
if(!(A.type in areas_with_air_alarm))
areas_with_air_alarm.Add(A.type)
CHECK_TICK
@@ -638,8 +642,8 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
areas_with_camera.Add(A.type)
CHECK_TICK
- var/list/areas_without_APC = areas_all - areas_with_APC
- var/list/areas_without_air_alarm = areas_all - areas_with_air_alarm
+ var/list/areas_without_APC = areas_all - (areas_with_APC + flatten_list(sub_areas_APC))
+ var/list/areas_without_air_alarm = areas_all - (areas_with_air_alarm + flatten_list(sub_areas_air_alarm))
var/list/areas_without_RC = areas_all - areas_with_RC
var/list/areas_without_light = areas_all - areas_with_light
var/list/areas_without_LS = areas_all - areas_with_LS
@@ -656,12 +660,18 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
dat += "