Adds SHOULD_NOT_SLEEP to Destroy. Why didn't we do this before. (#61943)

This commit is contained in:
LemonInTheDark
2021-10-09 04:29:33 -07:00
committed by GitHub
parent 861bf808bc
commit e663308b0d
11 changed files with 54 additions and 32 deletions
+30 -16
View File
@@ -206,21 +206,7 @@ and clear when youre done! if you dont i will use :newspaper2: on you
update_use_power(active + IDLE_POWER_USE)
program = map_id
//clear the items from the previous program
for(var/holo_atom in spawned)
derez(holo_atom)
for(var/obj/effect/holodeck_effect/holo_effect as anything in effects)
effects -= holo_effect
holo_effect.deactivate(src)
//makes sure that any time a holoturf is inside a baseturf list (e.g. if someone put a wall over it) its set to the OFFLINE turf
//so that you cant bring turfs from previous programs into other ones (like putting the plasma burn turf into lounge for example)
for(var/turf/closed/holo_turf in linked)
for(var/baseturf in holo_turf.baseturfs)
if(ispath(baseturf, /turf/open/floor/holofloor))
holo_turf.baseturfs -= baseturf
holo_turf.baseturfs += /turf/open/floor/holofloor/plating
clear_projection()
template = SSmapping.holodeck_templates[map_id]
template.load(bottom_left) //this is what actually loads the holodeck simulation into the map
@@ -238,6 +224,34 @@ and clear when youre done! if you dont i will use :newspaper2: on you
nerf(!(obj_flags & EMAGGED))
finish_spawn()
///To be used on destroy, mainly to prevent sleeping inside well, destroy. Missing a lot of the things contained in load_program
/obj/machinery/computer/holodeck/proc/reset_to_default()
if (program == offline_program)
return
program = offline_program
clear_projection()
template = SSmapping.holodeck_templates[offline_program]
INVOKE_ASYNC(template, /datum/map_template/proc/load, bottom_left) //this is what actually loads the holodeck simulation into the map
/obj/machinery/computer/holodeck/proc/clear_projection()
//clear the items from the previous program
for(var/holo_atom in spawned)
derez(holo_atom)
for(var/obj/effect/holodeck_effect/holo_effect as anything in effects)
effects -= holo_effect
holo_effect.deactivate(src)
//makes sure that any time a holoturf is inside a baseturf list (e.g. if someone put a wall over it) its set to the OFFLINE turf
//so that you cant bring turfs from previous programs into other ones (like putting the plasma burn turf into lounge for example)
for(var/turf/closed/holo_turf in linked)
for(var/baseturf in holo_turf.baseturfs)
if(ispath(baseturf, /turf/open/floor/holofloor))
holo_turf.baseturfs -= baseturf
holo_turf.baseturfs += /turf/open/floor/holofloor/plating
///finalizes objects in the spawned list
/obj/machinery/computer/holodeck/proc/finish_spawn()
for(var/atom/holo_atom as anything in spawned)
@@ -393,7 +407,7 @@ and clear when youre done! if you dont i will use :newspaper2: on you
return ..()
/obj/machinery/computer/holodeck/Destroy()
emergency_shutdown()
reset_to_default()
if(linked)
linked.linked = null
linked.power_usage = list(AREA_USAGE_LEN)