Fixes holodeck areas

This commit is contained in:
AnturK
2017-04-08 21:53:47 +02:00
parent c5999bcdb3
commit 794d3e9346
3 changed files with 48 additions and 32 deletions
+30 -21
View File
@@ -45,34 +45,42 @@
var/list/effects = list()
var/last_change = 0
/obj/machinery/computer/holodeck/New()
if(ispath(holodeck_type,/area))
linked = locate(holodeck_type)
if(ispath(offline_program,/area))
offline_program = locate(offline_program)
// the following is necessary for power reasons
var/area/AS = get_area(src)
if(istype(AS,/area/holodeck))
log_world("### MAPPING ERROR")
log_world("Holodeck computer cannot be in a holodeck.")
log_world("This would cause circular power dependency.")
qdel(src) // todo handle constructed computers
return //l-lewd...
else
linked.linked = src // todo detect multiple/constructed computers
..()
/obj/machinery/computer/holodeck/Initialize(mapload)
. = mapload //late-initialize, area_copy need turfs to have air
if(!mapload)
..()
if(ispath(holodeck_type,/area))
var/list/possible = get_areas(holodeck_type,subtypes = FALSE)
linked = pop(possible)
if(ispath(offline_program,/area))
var/list/possible = get_areas(offline_program,subtypes = FALSE)
offline_program = pop(possible)
// the following is necessary for power reasons
if(!linked || !offline_program)
log_world("No matching holodeck area found")
qdel(src)
return
var/area/AS = get_area(src)
if(istype(AS,/area/holodeck))
log_world("### MAPPING ERROR")
log_world("Holodeck computer cannot be in a holodeck.")
log_world("This would cause circular power dependency.")
qdel(src) // todo handle constructed computers
return //l-lewd...
else
linked.linked = src // todo detect multiple/constructed computers
program_cache = list()
emag_programs = list()
for(var/typekey in subtypesof(program_type))
var/area/holodeck/A = locate(typekey)
if(!A || A == offline_program) continue
if(A.contents.len == 0) continue // not loaded
if(!A || A == offline_program)
continue
if(A.contents.len == 0)
continue // not loaded
if(A.restricted)
emag_programs += A
else
@@ -191,8 +199,9 @@
nerf(!emagged)
/obj/machinery/computer/holodeck/Destroy()
emergency_shutdown()
linked.linked = null
if(linked)
emergency_shutdown()
linked.linked = null
return ..()
/obj/machinery/computer/holodeck/emp_act(severity)