I fear for my powernet

This commit is contained in:
Ghommie
2019-12-10 15:33:15 +01:00
parent f637e1e060
commit 19a3aca619
36 changed files with 386 additions and 248 deletions
+23 -1
View File
@@ -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"
+77 -28
View File
@@ -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)