anchor.diff:  	name = "doomsday device"
   	icon_state = "nuclearbomb_base"
   	desc = "A weapon which disintegrates all organic life in a large area."
  -	anchored = 1
  -	density = 1
  +	anchored = TRUE
  +	density = TRUE
   	verb_exclaim = "blares"
   	var/timing = FALSE
  -	var/default_timer = 4500
   	var/obj/effect/countdown/doomsday/countdown
   	var/detonation_timer
  -	var/list/milestones = list()
  -
  -/obj/machinery/doomsday_device/New()
  -	..()
  +	var/list/milestones
  +
  +/obj/machinery/doomsday_device/Initialize()
  +	. = ..()
   	countdown = new(src)
  +	milestones = list()
   
   /obj/machinery/doomsday_device/Destroy()
  -	if(countdown)
  -		qdel(countdown)
  -		countdown = null
  +	QDEL_NULL(countdown)
   	STOP_PROCESSING(SSfastprocess, src)
   	SSshuttle.clearHostileEnvironment(src)
   	SSmapping.remove_nuke_threat(src)
   	for(var/A in GLOB.ai_list)
  -		var/mob/living/silicon/ai/Mlf = A
  -		if(Mlf.doomsday_device == src)
  -			Mlf.doomsday_device = null
  -	. = ..()
  +		var/mob/living/silicon/ai/AI = A
  +		if(AI.doomsday_device == src)
  +			AI.doomsday_device = null
  +	return ..()
   
   /obj/machinery/doomsday_device/proc/start()
  -	detonation_timer = world.time + default_timer
  +	detonation_timer = world.time + DEFAULT_DOOMSDAY_TIMER
   	timing = TRUE
   	countdown.start()
   	START_PROCESSING(SSfastprocess, src)
  
positive.code: 	to_chat(src, "<span class='notice'>Doomsday device armed.</span>")
  	priority_announce("Hostile runtimes detected in all station systems, please deactivate your AI to prevent possible damage to its morality core.", "Anomaly Alert", 'sound/AI/aimalf.ogg')
  	set_security_level("delta")
  	nuking = 1
  	var/obj/machinery/doomsday_device/DOOM = new /obj/machinery/doomsday_device(src)
  	doomsday_device = DOOM
  	doomsday_device.start()
  	verbs -= /mob/living/silicon/ai/proc/nuke_station
  	for(var/obj/item/weapon/pinpointer/P in GLOB.pinpointer_list)
  		P.switch_mode_to(TRACK_MALF_AI) //Pinpointers start tracking the AI wherever it goes
  
  /obj/machinery/doomsday_device
  
negative.code: /obj/machinery/doomsday_device/process()
  	var/turf/T = get_turf(src)
  	if(!T || T.z != ZLEVEL_STATION)
  		minor_announce("DOOMSDAY DEVICE OUT OF STATION RANGE, ABORTING", "ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4", TRUE)
  		SSshuttle.clearHostileEnvironment(src)
  		qdel(src)
  		return
  	if(!timing)
  		STOP_PROCESSING(SSfastprocess, src)
  		return
  	var/sec_left = seconds_remaining()
  	if(!sec_left)
  		timing = FALSE
  		detonate(T.z)
  	else
  		var/key = num2text(sec_left)
  		if(!(sec_left % 60) && !(key in milestones))
  			milestones[key] = TRUE
  			minor_announce("[key] SECONDS UNTIL DOOMSDAY DEVICE ACTIVATION!", "ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4", TRUE)
  
  /obj/machinery/doomsday_device/proc/detonate(z_level = ZLEVEL_STATION)
  	for(var/mob/M in GLOB.player_list)
  		M << 'sound/machines/Alarm.ogg'
  	sleep(100)
  