anchor.diff: -/datum/game_mode
  -	var/list/datum/mind/syndicates = list()
  -	var/nukeops_lastname = ""
  -
   /datum/game_mode/nuclear
   	name = "nuclear emergency"
   	config_tag = "nuclear"
  
positive.code: 		new_op.special_role = "Nuclear Operative"
  		log_game("[new_op.key] (ckey) has been selected as a nuclear operative")
  	return TRUE
  
  ////////////////////////////////////////////////////////////////////////////////////////
  ////////////////////////////////////////////////////////////////////////////////////////
  /datum/game_mode/proc/update_synd_icons_added(datum/mind/synd_mind)
  	var/datum/atom_hud/antag/opshud = GLOB.huds[ANTAG_HUD_OPS]
  	opshud.join_hud(synd_mind.current)
  	set_antag_hud(synd_mind.current, "synd")
  
  /datum/game_mode/proc/update_synd_icons_removed(datum/mind/synd_mind)
  	var/datum/atom_hud/antag/opshud = GLOB.huds[ANTAG_HUD_OPS]
  	opshud.leave_hud(synd_mind.current)
  	set_antag_hud(synd_mind.current, null)
  
  ////////////////////////////////////////////////////////////////////////////////////////
  ////////////////////////////////////////////////////////////////////////////////////////
  
  /datum/game_mode/nuclear/post_setup()
  	var/nuke_code = random_nukecode()
  	var/agent_number = 1
  	var/datum/mind/leader = pick(pre_nukeops)
  	syndicates += pre_nukeops
  	for(var/i = 1 to pre_nukeops.len)
  		var/datum/mind/op = pre_nukeops[i]
  
  		forge_syndicate_objectives(op)
  		greet_syndicate(op)
  		equip_syndicate(op.current)
  
  		if(nuke_code)
  			op.store_memory("<B>Syndicate Nuclear Bomb Code</B>: [nuke_code]", 0, 0)
  			to_chat(op.current, "The nuclear authorization code is: <B>[nuke_code]</B>")
  
  		if(op == leader)
  			op.current.forceMove(pick(GLOB.nukeop_leader_start))
  			prepare_syndicate_leader(op, nuke_code)
  		else
  			op.current.forceMove(GLOB.nukeop_start[((i - 1) % GLOB.nukeop_start.len) + 1])
  			op.current.real_name = "[syndicate_name()] Operative #[agent_number++]"
  
  		update_synd_icons_added(op)
  		op.current.playsound_local(get_turf(op.current), 'sound/ambience/antag/ops.ogg',100,0)
  
  	var/obj/machinery/nuclearbomb/nuke = locate("syndienuke") in GLOB.nuke_list
  	if(nuke)
  		nuke.r_code = nuke_code
  	return ..()
  
  /datum/game_mode/proc/prepare_syndicate_leader(datum/mind/synd_mind, nuke_code)
  	var/leader_title = pick("Czar", "Boss", "Commander", "Chief", "Kingpin", "Director", "Overlord")
  	addtimer(CALLBACK(src, .proc/nuketeam_name_assign, synd_mind), 1)
  	synd_mind.current.real_name = "[syndicate_name()] [leader_title]"
  	to_chat(synd_mind.current, "<B>You are the Syndicate [leader_title] for this mission. You are responsible for the distribution of telecrystals and your ID is the only one who can open the launch bay doors.</B>")
  	to_chat(synd_mind.current, "<B>If you feel you are not up to this task, give your ID to another operative.</B>")
  	to_chat(synd_mind.current, "<B>In your hand you will find a special item capable of triggering a greater challenge for your team. Examine it carefully and consult with your fellow operatives before activating it.</B>")
  
  	var/obj/item/device/nuclear_challenge/challenge = new /obj/item/device/nuclear_challenge
  	synd_mind.current.put_in_hands(challenge, TRUE)
  
  	var/static/id_cache = typecacheof(/obj/item/card/id)
  	var/list/foundIDs = typecache_filter_list(synd_mind.current.GetAllContents(), id_cache)
  	if(foundIDs.len)
  		for(var/i in 1 to foundIDs.len)
  			var/obj/item/card/id/ID = foundIDs[i]
  			ID.name = "lead agent card"
  			ID.access += ACCESS_SYNDICATE_LEADER
  	else
  		message_admins("Warning: Nuke Ops spawned without access to leave their spawn area!")
  
  	var/obj/item/device/radio/headset/syndicate/alt/A = locate() in synd_mind.current
  	if(A)
  		A.command = TRUE
  
  	if(nuke_code)
  		var/obj/item/paper/P = new
  		P.info = "The nuclear authorization code is: <b>[nuke_code]</b>"
  		P.name = "nuclear bomb code"
  		var/mob/living/carbon/human/H = synd_mind.current
  		H.put_in_hands(P, TRUE)
  		H.update_icons()
  	else
  		nuke_code = "code will be provided later"
  	return
  
  /datum/game_mode/proc/nuketeam_name_assign(datum/mind/synd_mind)
  	nukeops_lastname = nukelastname(synd_mind.current)
  	NukeNameAssign(nukeops_lastname, syndicates)
  
  
  /datum/game_mode/proc/forge_syndicate_objectives(datum/mind/syndicate)
  	var/datum/objective/nuclear/syndobj = new
  	syndobj.owner = syndicate
  	syndicate.objectives += syndobj
  
  
  /datum/game_mode/proc/greet_syndicate(datum/mind/syndicate, you_are=1)
  	if(you_are)
  		to_chat(syndicate.current, "<span class='notice'>You are a [syndicate_name()] agent!</span>")
  	syndicate.announce_objectives()
  
  /datum/game_mode/proc/equip_syndicate(mob/living/carbon/human/synd_mob, telecrystals = TRUE)
  	synd_mob.set_species(/datum/species/human) //Plasamen burn up otherwise, and lizards are vulnerable to asimov AIs
  
  	if(telecrystals)
  		synd_mob.equipOutfit(/datum/outfit/syndicate)
  	else
  		synd_mob.equipOutfit(/datum/outfit/syndicate/no_crystals)
  	return TRUE
  
  /datum/game_mode/nuclear/OnNukeExplosion(off_station)
  	..()
  	nukes_left--
  	var/obj/docking_port/mobile/Shuttle = SSshuttle.getShuttle("syndicate")
  	syndies_didnt_escape = (Shuttle && (Shuttle.z == ZLEVEL_CENTCOM || Shuttle.z == ZLEVEL_TRANSIT)) ? 0 : 1
  	nuke_off_station = off_station
  
  /datum/game_mode/nuclear/check_win()
  	if (nukes_left == 0)
  
negative.code: 	..()
  
  /datum/game_mode/nuclear/declare_completion()
  	var result = nuke_team.get_result()
  	switch(result)
  		if(NUKE_RESULT_FLUKE)
  			SSticker.mode_result = "loss - syndicate nuked - disk secured"
  			SSticker.news_report = NUKE_SYNDICATE_BASE
  		if(NUKE_RESULT_NUKE_WIN)
  			SSticker.mode_result = "win - syndicate nuke"
  			SSticker.news_report = STATION_NUKED
  		if(NUKE_RESULT_NOSURVIVORS)
  			SSticker.mode_result = "halfwin - syndicate nuke - did not evacuate in time"
  			SSticker.news_report = STATION_NUKED
  		if(NUKE_RESULT_WRONG_STATION)
  			SSticker.mode_result = "halfwin - blew wrong station"
  			SSticker.news_report = NUKE_MISS
  		if(NUKE_RESULT_WRONG_STATION_DEAD)
  			SSticker.mode_result = "halfwin - blew wrong station - did not evacuate in time"
  			SSticker.news_report = NUKE_MISS
  		if(NUKE_RESULT_CREW_WIN_SYNDIES_DEAD)
  			SSticker.mode_result = "loss - evacuation - disk secured - syndi team dead"
  			SSticker.news_report = OPERATIVES_KILLED
  		if(NUKE_RESULT_CREW_WIN)
  			SSticker.mode_result = "loss - evacuation - disk secured"
  			SSticker.news_report = OPERATIVES_KILLED
  		if(NUKE_RESULT_DISK_LOST)
  			SSticker.mode_result = "halfwin - evacuation - disk not secured"
  			SSticker.news_report = OPERATIVE_SKIRMISH
  		if(NUKE_RESULT_DISK_STOLEN)
  			SSticker.mode_result = "halfwin - detonation averted"
  			SSticker.news_report = OPERATIVE_SKIRMISH
  		else
  			SSticker.mode_result = "halfwin - interrupted"
  			SSticker.news_report = OPERATIVE_SKIRMISH
  	return ..()
  
  /datum/game_mode/nuclear/generate_report()
  	return "One of Central Command's trading routes was recently disrupted by a raid carried out by the Gorlex Marauders. They seemed to only be after one ship - a highly-sensitive \
  