code:
/datum/objective/build
	dangerrating = 15
	martyr_compatible = 1

/datum/objective/build/proc/gen_amount_goal(lower, upper)
	target_amount = rand(lower, upper)
	explanation_text = "Build [target_amount] shrines."
	return target_amount

/datum/objective/build/check_completion()
	if(!owner || !owner.current)
		return 0

	var/shrines = 0
	if(is_handofgod_god(owner.current))
		var/mob/camera/god/G = owner.current
		for(var/obj/structure/divine/shrine/S in G.structures)
			S++

	return (shrines >= target_amount)

/datum/objective/deicide
	dangerrating = 20
	martyr_compatible = 1

/datum/objective/deicide/check_completion()
	if(target)
		if(target.current) //Gods are deleted when they lose
			return 0
	return 1

/datum/objective/deicide/find_target()
	if(!owner || !owner.current)
		return

	if(is_handofgod_god(owner.current))
		var/mob/camera/god/G = owner.current
		if(G.side == "red")
			if(ticker.mode.blue_deities.len)
				target = ticker.mode.blue_deities[1]
		if(G.side == "blue")
			if(ticker.mode.red_deities.len)
				target = ticker.mode.red_deities[1]
		if(!target)
			return 0
	update_explanation_text()

/datum/objective/deicide/update_explanation_text()
	..()
	if(target && target.current)
		explanation_text = "Phase [target.name], the false god, out of this plane of existence.."
	else
		explanation_text = "Free Objective"

/datum/objective/follower_block
	explanation_text = "Do not allow any followers of the false god to escape on the station's shuttle alive."
	dangerrating = 25
	martyr_compatible = 1

/datum/objective/follower_block/check_completion()
	var/side = "ABORT"
	if(is_handofgod_redcultist(owner.current))
		side = "red"
	else if(is_handofgod_bluecultist(owner.current))
		side = "blue"
	if(side == "ABORT")
		return 0

	var/area/A = SSshuttle.emergency.areaInstance

	for(var/mob/living/player in player_list)
		if(player.mind && player.stat != DEAD && get_area(player) == A)
			if(side == "red")
				if(is_handofgod_bluecultist(player))
					return 0
			else if(side == "blue")
				if(is_handofgod_redcultist(player))
					return 0
	return 1

/datum/objective/escape_followers
	dangerrating = 5

/datum/objective/escape_followers/proc/gen_amount_goal(lower,upper)
	target_amount = rand(lower,upper)
	explanation_text = "Your will must surpass this station. Having [target_amount] followers escape on the shuttle or pods will allow that."
	return target_amount

/datum/objective/escape_followers/check_completion()
	var/escaped = 0
	if(is_handofgod_god(owner.current))
		var/mob/camera/god/G = owner.current
		if(G.side == "red")
			for(var/datum/mind/follower_mind in ticker.mode.red_deity_followers)
				if(follower_mind.current && follower_mind.current.stat != DEAD)
					if(follower_mind.current.onCentcom())
						escaped++

		if(G.side == "blue")
			for(var/datum/mind/follower_mind in ticker.mode.blue_deity_followers)
				if(follower_mind.current && follower_mind.current.stat != DEAD)
					if(follower_mind.current.onCentcom())
						escaped++

	return (escaped >= target_amount)

/datum/objective/sacrifice_prophet
	explanation_text = "A false prophet is preaching their god's faith on the station. Sacrificing them will show the mortals who the true god is."
	dangerrating = 10

/datum/objective/sacrifice_prophet/check_completion()
	var/mob/camera/god/G = owner.current
	if(istype(G))
		return G.prophets_sacrificed_in_name
	return 0


code:
/mob/camera/god/proc/ability_cost(cost = 0,structures = 0, requires_conduit = 0, can_place_near_enemy_nexus = 0)
	if(faith < cost)
		src << "You lack the faith!"
		return 0

	if(structures)
		if(!isturf(loc) || istype(loc, /turf/open/space))
			src << "Your structure would just float away, you need stable ground!"
			return 0

		var/turf/T = get_turf(src)
		if(T)
			if(T.density)
				src << "There is something blocking your structure!"
				return 0

			for(var/atom/movable/AM in T)
				if(AM == src)
					continue
				if(AM.density)
					src << "There is something blocking your structure!"
					return 0

	if(requires_conduit)
		//Organised this way as there can be multiple conduits, so it's more likely to be a conduit check.
		var/valid = 0

		for(var/obj/structure/divine/conduit/C in conduits)
			if(get_dist(src, C) <= CONDUIT_RANGE)
				valid++
				break

		if(!valid)
			if(get_dist(src, god_nexus) <= CONDUIT_RANGE)
				valid++

		if(!valid)
			src << "You must be near your Nexus or a Conduit to do this!"
			return 0

	if(!can_place_near_enemy_nexus)
		var/datum/mind/enemy
		switch(side)
			if("red")
				if(ticker.mode.blue_deities.len)
					enemy = ticker.mode.blue_deities[1]
			if("blue")
				if(ticker.mode.red_deities.len)
					enemy = ticker.mode.red_deities[1]

		if(enemy && is_handofgod_god(enemy.current))
			var/mob/camera/god/enemy_god = enemy.current
			if(enemy_god.god_nexus && (get_dist(src,enemy_god.god_nexus) <= CONDUIT_RANGE*2))
				src << "You are too close to the other god's stronghold!"
				return 0

	return 1

/mob/camera/god/verb/returntonexus()
	set category = "Deity"
	set name = "Goto Nexus"
	set desc = "Teleports you to your next instantly."

	if(god_nexus)
		Move(get_turf(god_nexus))
	else
		src << "You don't even have a Nexus, construct one."

/mob/camera/god/verb/jumptofollower()
	set category = "Deity"
	set name = "Jump to Follower"
	set desc = "Teleports you to one of your followers."
	var/list/following = list()
	if(side == "red")
		following = ticker.mode.red_deity_followers|ticker.mode.red_deity_prophets
	else if(side == "blue")
		following = ticker.mode.blue_deity_followers|ticker.mode.blue_deity_prophets
	else
		src << "You are unaligned, and thus do not have followers"
		return

	var/datum/mind/choice = input("Choose a follower","Jump to Follower") as null|anything in following
	if(choice && choice.current)
		Move(get_turf(choice.current))

/mob/camera/god/verb/newprophet()
	set category = "Deity"
	set name = "Appoint Prophet (100)"
	set desc = "Appoint one of your followers as your Prophet, who can hear your words"

	var/list/following = list()

	if(!ability_cost(100))
		return
	if(side == "red")
		var/datum/mind/old_proph = locate() in ticker.mode.red_deity_prophets
		if(old_proph && old_proph.current && old_proph.current.stat != DEAD)
			src << "You can only have one prophet alive at a time."
			return
		else
			following = ticker.mode.red_deity_followers
	else if(side == "blue")
		var/datum/mind/old_proph = locate() in ticker.mode.blue_deity_prophets
		if(old_proph && old_proph.current && old_proph.current.stat != DEAD)
			src << "You can only have one prophet alive at a time."
			return
		else
			following = ticker.mode.blue_deity_followers

	else
		src << "You are unalligned, and thus do not have prophets"
		return

	var/datum/mind/choice = input("Choose a follower to make into your prophet","Prophet Uplifting") as null|anything in following
	if(choice && choice.current && choice.current.stat != DEAD)
		src << "You choose [choice.current] as your prophet."
		choice.make_Handofgod_prophet(side)
		speak2god = new()
		speak2god.god = src
		speak2god.Grant(choice.current)

		//Prophet gear
		var/mob/living/carbon/human/H = choice.current
		var/popehat = null
		var/popestick = null

		switch(side)
			if("red")
				popehat = /obj/item/clothing/head/helmet/plate/crusader/prophet/red
				popestick = /obj/item/weapon/godstaff/red
			if("blue")
				popehat = /obj/item/clothing/head/helmet/plate/crusader/prophet/blue
				popestick = /obj/item/weapon/godstaff/blue

		if(popehat)
			var/obj/item/clothing/head/helmet/plate/crusader/prophet/P = new popehat()

			H.unEquip(H.head)
			H << "A powerful hat has been bestowed upon your head, you will need to wear this to utilize your staff fully.."
			H.equip_to_slot_or_del(P,slot_head)

		if(popestick)
			var/obj/item/weapon/godstaff/G = new popestick()
			G.god = src
			var/success = ""
			if(!H.put_in_hands(G))
				if(!H.equip_to_slot_if_possible(G,slot_in_backpack,0,1,1))
					G.loc = get_turf(H)
					success = "It is on the floor..."
				else
					success = "It is in your backpack..."
			else
				success = "It is in your hands..."

			if(success)
				H << "A powerful staff has been bestowed upon you, you can use this to convert the false god's structures!"
				H << "[success]"
		//end prophet gear

		add_faith(-100)

/mob/camera/god/verb/talk(msg as text)
	set category = "Deity"
	set name = "Talk to Anyone (20)"
	set desc = "Allows you to send a message to anyone, regardless of their faith."
	if(!ability_cost(20))
		return
	var/mob/choice = input("Choose who you wish to talk to", "Talk to ANYONE") as null|anything in mob_list
	if(choice)
		var/original = msg
		msg = "You hear a voice coming from everywhere and nowhere... [msg]"
		choice << msg
		src << "You say the following to [choice], [original]"
		add_faith(-20)

/mob/camera/god/verb/smite()
	set category = "Deity"
	set name = "Smite (40)"
	set desc = "Hits anything under you with a moderate amount of damage."

	if(!ability_cost(40,0,1))
		return
	if(!range(7,god_nexus))
		src << "You lack the strength to smite this far from your nexus."
		return

	var/has_smitten = 0 //Hast thou been smitten, infidel?
	for(var/mob/living/L in get_turf(src))
		L.adjustFireLoss(20)
		L.adjustBruteLoss(20)
		L << "You feel the wrath of [name]!"
		has_smitten = 1
	if(has_smitten)
		add_faith(-40)

/mob/camera/god/verb/disaster()
	set category = "Deity"
	set name = "Invoke Disaster (300)" //difficult to reach without lots of followers
	set desc = "Tug at the fibres of reality itself and bend it to your whims!"

	if(!ability_cost(300,0,1))
		return

	var/event = pick(/datum/round_event/meteor_wave, /datum/round_event/communications_blackout, /datum/round_event/radiation_storm, /datum/round_event/carp_migration,
	/datum/round_event/spacevine, /datum/round_event/vent_clog, /datum/round_event/wormholes)
	if(event)
		new event()
		add_faith(-300)

/mob/camera/god/verb/constructnexus()
	set category = "Deity"
	set name = "Construct Nexus"
	set desc = "Instantly creates your nexus, You can only do this once, make sure you're happy with it!"

	if(!ability_cost(0,1,0))
		return

	place_nexus()

/* //Transolocators have no sprite
/mob/camera/god/verb/movenexus()
	set category = "Deity"
	set name = "Relocate Nexus (50)"
	set desc = "Instantly relocates your nexus to an existing translocator belonging to your faith, this destroys the translocator in the process"

	if(ability_cost(50,0,0) && god_nexus)
		var/list/translocators = list()
		var/list/used_keys = list()
		for(var/obj/structure/divine/translocator/T in structures)
			translocators["[T.name] ([get_area(T)])"] = T

		if(!translocators.len)
			src << "You have no translocators!"
			return

		var/picked = input(src,"Choose a translocator","Relocate Nexus") as null|anything in translocators
		if(!picked || !translocators[picked])
			return

		var/obj/structure/divine/translocator/T = translocators[T]
		var/turf/Tturf = get_turf(T)
		god_nexus.loc = T
		translocators[picked] = null
		add_faith(-50)
		qdel(T)
*/

/mob/camera/god/verb/construct_structures()
	set category = "Deity"
	set name = "Construct Structure (75)"
	set desc = "Create the foundation of a divine object."

	if(!ability_cost(75,1,1))
		return

	structure_construction_ui(src)

/mob/camera/god/verb/construct_traps()
	set category = "Deity"
	set name = "Construct Trap (20)"
	set desc = "Creates a ward or trap."

	if(!ability_cost(20,1,1))
		return

	trap_construction_ui(src)

/mob/camera/god/verb/construct_items()
	set category = "Deity"
	set name = "Construct Items (20)"
	set desc = "Construct some items for your followers"

	if(!ability_cost(20,1,1))
		return

	var/list/item_types = list("claymore sword" = /obj/item/weapon/claymore/hog)
	if(side == "red")
		item_types["red banner"] = /obj/item/weapon/banner/red
		item_types["red bannerbackpack"] = /obj/item/weapon/storage/backpack/bannerpack/red
		item_types["red armour"] = /obj/item/weapon/storage/box/itemset/crusader/red

	else if(side == "blue")
		item_types["blue banner"] = /obj/item/weapon/banner/blue
		item_types["blue bannerbackpack"] = /obj/item/weapon/storage/backpack/bannerpack/blue
		item_types["blue armour"] = /obj/item/weapon/storage/box/itemset/crusader/blue

	var/item = input("Choose what you wish to create.", "Divine Items") as null|anything in item_types
	if(!item || !item_types[item] || !ability_cost(20,1,1))
		return

	src << "You produce \a [item]"
	add_faith(-20)

	var/itemtype = item_types[item]
	new itemtype (get_turf(src))

/mob/camera/god/verb/veil_structures()
	set category = "Deity"
	set name = "Veil Structures (20)"
	set desc = "Hide your structures from sight and touch, but prevent yourself from using them."

	if(!ability_cost(20,1,1))
		return

	src << "You focus your powers and start dragging your influence into the spiritual plane."
	for(var/mob/M in orange(3,src))//Yes I know this is terrible, but visible message doesnt work for this
		M << "The air begins to shimmer..."
	if(do_after(src, 30, 0, src))
		for(var/obj/structure/divine/R in orange(3,src))
			if(istype(R, /obj/structure/divine/nexus)|| istype(R, /obj/structure/divine/trap)||(src.side != R.side))
				continue
			R.visible_message("[R] fades away.")
			R.invisibility = 55
			R.alpha = 100 //To help ghosts distinguish hidden structures
			R.density = 0
			R.deactivate()
		src << "You hide your influence from view"
		add_faith(-20)

/mob/camera/god/verb/reveal_structures()
	set category = "Deity"
	set name = "Reveal Structures (20)"
	set desc = "Make your structures visible again and allow them to be used."

	if(!ability_cost(20,1,1))
		return

	src << "You focus your powers and start dragging your influence into the material plane."
	for(var/mob/M in orange(3,src))//Yes I know this is terrible, but visible message doesnt work for this
		M << "The air begins to shimmer..."
	if(do_after(src, 40, 0, src))
		for(var/obj/structure/divine/R in orange(3,src))
			if(istype(R, /obj/structure/divine/nexus)|| istype(R, /obj/structure/divine/trap)||(src.side != R.side))
				continue
			R.visible_message("[R] suddenly appears!")
			R.invisibility = 0
			R.alpha = initial(R.alpha)
			R.density = initial(R.density)
			R.activate()
		src << "You bring your influence into view"
		add_faith(-20)

license: mit


code:
/proc/build_hog_construction_lists()
	if(global_handofgod_traptypes.len && global_handofgod_structuretypes.len)
		return

	var/list/types = subtypesof(/obj/structure/divine) - /obj/structure/divine/trap
	for(var/T in types)
		var/obj/structure/divine/D = T
		if(initial(D.constructable))
			if(initial(D.trap))
				global_handofgod_traptypes[initial(D.name)] = T
			else
				global_handofgod_structuretypes[initial(D.name)] = T

/obj/structure/divine
	name = "divine construction site"
	icon = 'icons/obj/hand_of_god_structures.dmi'
	desc = "An unfinished divine building"
	anchored = 1
	density = 1
	var/constructable = TRUE
	var/trap = FALSE
	var/metal_cost = 0
	var/glass_cost = 0
	var/lesser_gem_cost = 0
	var/greater_gem_cost = 0
	var/mob/camera/god/deity
	var/side = "neutral" //"blue" or "red", also used for colouring structures when construction is started by a deity
	var/health = 100
	var/maxhealth = 100
	var/deactivated = 0		//Structures being hidden can't be used. Mainly to prevent invisible defense pylons.
	var/autocolours = TRUE //do we colour to our side?

/obj/structure/divine/New()
	..()

/obj/structure/divine/proc/deactivate()
	deactivated = 1

/obj/structure/divine/proc/activate()
	deactivated = 0

/obj/structure/divine/proc/update_icons()
	if(autocolours)
		icon_state = "[initial(icon_state)]-[side]"

/obj/structure/divine/Destroy()
	if(deity)
		deity.structures -= src
	return ..()

/obj/structure/divine/proc/healthcheck()
	if(!health)
		visible_message("\The [src] was destroyed!")
		qdel(src)

/obj/structure/divine/attackby(obj/item/I, mob/user)
	if(!I || (I.flags & ABSTRACT))
		return 0

	//Structure conversion/capture
	if(istype(I, /obj/item/weapon/godstaff))
		if(!is_handofgod_cultist(user))
			user << "You're not quite sure what the hell you're even doing."
			return
		var/obj/item/weapon/godstaff/G = I
		if(G.god && deity != G.god)
			assign_deity(G.god, alert_old_deity = TRUE)
			visible_message("\The [src] has been captured by [user]!")
		return

	user.changeNext_move(CLICK_CD_MELEE)
	user.do_attack_animation(src)
	playsound(get_turf(src), I.hitsound, 50, 1)
	visible_message("\The [src] has been attacked with \the [I][(user ? " by [user]" : ".")]!")
	health = max(0, health-I.force)
	healthcheck()

/obj/structure/divine/bullet_act(obj/item/projectile/Proj)
	if(!Proj)
		return 0

	if(Proj.damage_type == BRUTE || Proj.damage_type == BURN)
		health = max(0, health-Proj.damage)
		healthcheck()

/obj/structure/divine/attack_animal(mob/living/simple_animal/M)
	if(!M)
		return 0

	visible_message("\The [src] has been attacked by \the [M]!")
	var/damage = rand(M.melee_damage_lower, M.melee_damage_upper)
	if(!damage)
		return
	health = max(0, health-damage)
	healthcheck()

/obj/structure/divine/proc/assign_deity(mob/camera/god/new_deity, alert_old_deity = TRUE)
	if(!new_deity)
		return 0
	if(deity)
		if(alert_old_deity)
			deity << "Your [name] was captured by [new_deity]'s cult!"
		deity.structures -= src
	deity = new_deity
	deity.structures |= src
	side = deity.side
	update_icons()
	return 1

/obj/structure/divine/construction_holder
	alpha = 125
	constructable = FALSE
	var/obj/structure/divine/construction_result = /obj/structure/divine //a path, but typed to /obj/structure/divine for initial()

/obj/structure/divine/construction_holder/assign_deity(mob/camera/god/new_deity, alert_old_deity = TRUE)
	if(..())
		color = side

/obj/structure/divine/construction_holder/attack_god(mob/camera/god/user)
	if(user.side == side && construction_result)
		user.add_faith(75)
		visible_message("[user] has cancelled \the [initial(construction_result.name)]")
		qdel(src)

/obj/structure/divine/construction_holder/proc/setup_construction(construct_type)
	if(ispath(construct_type))
		construction_result = construct_type
		name = "[initial(construction_result.name)] construction site "
		icon_state = initial(construction_result.icon_state)
		metal_cost = initial(construction_result.metal_cost)
		glass_cost = initial(construction_result.glass_cost)
		lesser_gem_cost = initial(construction_result.lesser_gem_cost)
		greater_gem_cost = initial(construction_result.greater_gem_cost)
		desc = "An unfinished [initial(construction_result.name)]."

/obj/structure/divine/construction_holder/attackby(obj/item/I, mob/user)
	if(!I || !user)
		return 0

	if(istype(I, /obj/item/stack/sheet/metal))
		var/obj/item/stack/sheet/metal/M = I
		if(metal_cost)
			var/spend = min(metal_cost, M.amount)
			user << "You add [spend] metal to \the [src]."
			metal_cost = max(0, metal_cost - spend)
			M.use(spend)
			check_completion()
		else
			user << "\The [src] does not require any more metal!"
		return

	if(istype(I, /obj/item/stack/sheet/glass))
		var/obj/item/stack/sheet/glass/G = I
		if(glass_cost)
			var/spend = min(glass_cost, G.amount)
			user << "You add [spend] glass to \the [src]."
			glass_cost = max(0, glass_cost - spend)
			G.use(spend)
			check_completion()
		else
			user << "\The [src] does not require any more glass!"
		return

	if(istype(I, /obj/item/stack/sheet/lessergem))
		var/obj/item/stack/sheet/lessergem/LG = I
		if(lesser_gem_cost)
			var/spend = min(lesser_gem_cost, LG.amount)
			user << "You add [spend] lesser gems to \the [src]."
			lesser_gem_cost = max(0, lesser_gem_cost - spend)
			LG.use(spend)
			check_completion()
		else
			user << "\The [src] does not require any more lesser gems!"
		return

	if(istype(I, /obj/item/stack/sheet/greatergem))
		var/obj/item/stack/sheet/greatergem/GG = I //GG!
		if(greater_gem_cost)
			var/spend = min(greater_gem_cost, GG.amount)
			user << "You add [spend] greater gems to \the [src]."
			greater_gem_cost = max(0, greater_gem_cost - spend)
			GG.use(spend)
			check_completion()
		else
			user << "\The [src] does not require any more greater gems!"
		return

	..()

/obj/structure/divine/construction_holder/proc/check_completion()
	if(!metal_cost && !glass_cost && !lesser_gem_cost && !greater_gem_cost)
		visible_message("\The [initial(construction_result.name)] is complete!")
		var/obj/structure/divine/D = new construction_result (get_turf(src))
		D.assign_deity(deity)
		qdel(src)

/obj/structure/divine/construction_holder/examine(mob/user)
	..()

	if(metal_cost || glass_cost || lesser_gem_cost || greater_gem_cost)
		user << "To finish construction it requires the following materials:"
		if(metal_cost)
			user << "[metal_cost] metal "
		if(glass_cost)
			user << "[glass_cost] glass "
		if(lesser_gem_cost)
			user << "[lesser_gem_cost] lesser gems "
		if(greater_gem_cost)
			user << "[greater_gem_cost] greater gems "

/obj/structure/divine/nexus
	name = "nexus"
	desc = "It anchors a deity to this world. It radiates an unusual aura. Cultists protect this at all costs. It looks well protected from explosive shock."
	icon_state = "nexus"
	health = 500
	maxhealth = 500
	constructable = FALSE
	var/faith_regen_rate = 1
	var/list/powerpylons = list()

/obj/structure/divine/nexus/ex_act()
	return

/obj/structure/divine/nexus/healthcheck()
	if(deity)
		deity.update_health_hud()

	if(!health)
		if(!qdeleted(deity) && deity.nexus_required)
			deity << "Your nexus was destroyed. You feel yourself fading..."
			qdel(deity)
		visible_message("\The [src] was destroyed!")
		qdel(src)

/obj/structure/divine/nexus/New()
	SSobj.processing |= src

/obj/structure/divine/nexus/process()
	healthcheck()
	if(deity)
		deity.update_followers()
		deity.add_faith(faith_regen_rate + (powerpylons.len / 5) + (deity.alive_followers / 3))
		deity.max_faith = initial(deity.max_faith) + (deity.alive_followers*10) //10 followers = 100 max faith, so disaster() at around 20 followers
		deity.check_death()

/obj/structure/divine/nexus/Destroy()
	SSobj.processing -= src
	return ..()

/obj/structure/divine/conduit
	name = "conduit"
	desc = "It allows a deity to extend their reach.  Their powers are just as potent near a conduit as a nexus."
	icon_state = "conduit"
	health = 150
	maxhealth = 150
	metal_cost = 10
	glass_cost = 5

/obj/structure/divine/conduit/assign_deity(mob/camera/god/new_deity, alert_old_deity = TRUE)
	if(deity)
		deity.conduits -= src
	..()
	if(deity)
		deity.conduits += src

/obj/structure/divine/conduit/deactivate()
	..()
	if(deity)
		deity.conduits -= src

/obj/structure/divine/conduit/activate()
	..()
	if(deity)
		deity.conduits += src

/* //No good sprites, and not enough items to make it viable yet
/obj/structure/divine/forge
	name = "forge"
	desc = "A forge fueled by divine might, it allows the creation of sacred and powerful artifacts.  It requires common materials to craft objects."
	icon_state = "forge"
	health = 250
	maxhealth = 250
	density = 0
	maxhealth = 250
	metal_cost = 40
*/

/obj/structure/divine/convertaltar
	name = "conversion altar"
	desc = "An altar dedicated to a deity.  Cultists can \"forcefully teach\" their non-aligned crewmembers to join their side and take up their deity."
	icon_state = "convertaltar"
	density = 0
	metal_cost = 10
	can_buckle = 1

/obj/structure/divine/convertaltar/attack_hand(mob/living/user)
	..()
	if(deactivated)
		return
	var/mob/living/carbon/human/H = locate() in get_turf(src)
	if(!is_handofgod_cultist(user))
		user << "You try to use it, but unfortunately you don't know any rituals."
		return
	if(!H)
		return
	if(!H.mind)
		user << "Only sentients may serve your deity."
		return
	if((side == "red" && is_handofgod_redcultist(user) && !is_handofgod_redcultist(H)) || (side == "blue" && is_handofgod_bluecultist(user) && !is_handofgod_bluecultist(H)))
		user << "You invoke the conversion ritual."
		ticker.mode.add_hog_follower(H.mind, side)
	else
		user << "You invoke the conversion ritual."
		user << "But the altar ignores your words..."

/obj/structure/divine/sacrificealtar
	name = "sacrificial altar"
	desc = "An altar designed to perform blood sacrifice for a deity.  The cultists performing the sacrifice will gain a powerful material to use in their forge.  Sacrificing a prophet will yield even better results."
	icon_state = "sacrificealtar"
	density = 0
	metal_cost = 15
	can_buckle = 1

/obj/structure/divine/sacrificealtar/attack_hand(mob/living/user)
	..()
	if(deactivated)
		return
	var/mob/living/L = locate() in get_turf(src)
	if(!is_handofgod_cultist(user))
		user << "You try to use it, but unfortunately you don't know any rituals."
		return
	if(!L)
		return
	if((side == "red" && is_handofgod_redcultist(user))	|| (side == "blue" && is_handofgod_bluecultist(user)))
		if((side == "red" && is_handofgod_redcultist(L)) || (side == "blue" && is_handofgod_bluecultist(L)))
			user << "You cannot sacrifice a fellow cultist."
			return
		user << "You attempt to sacrifice [L] by invoking the sacrificial ritual."
		sacrifice(L)
	else
		user << "You attempt to sacrifice [L] by invoking the sacrificial ritual."
		user << "But the altar ignores your words..."

/obj/structure/divine/sacrificealtar/proc/sacrifice(mob/living/L)
	if(!L)
		L = locate() in get_turf(src)
	if(L)
		if(ismonkey(L))
			var/luck = rand(1,4)
			if(luck > 3)
				new /obj/item/stack/sheet/lessergem(get_turf(src))

		else if(ishuman(L))
			var/mob/living/carbon/human/H = L

			//Sacrifice altars can't teamkill
			if(side == "red" && is_handofgod_redcultist(H))
				return
			else if(side == "blue" && is_handofgod_bluecultist(H))
				return

			if(is_handofgod_prophet(H))
				new /obj/item/stack/sheet/greatergem(get_turf(src))
				if(deity)
					deity.prophets_sacrificed_in_name++
			else
				new /obj/item/stack/sheet/lessergem(get_turf(src))

		else if(isAI(L) || istype(L, /mob/living/carbon/alien/humanoid/royal/queen))
			new /obj/item/stack/sheet/greatergem(get_turf(src))
		else
			new /obj/item/stack/sheet/lessergem(get_turf(src))
		L.gib()

/obj/structure/divine/healingfountain
	name = "healing fountain"
	desc = "A fountain containing the waters of life... or death, depending on where your allegiances lie."
	icon_state = "fountain"
	metal_cost = 10
	glass_cost = 5
	autocolours = FALSE
	var/time_between_uses = 1800
	var/last_process = 0
	var/cult_only = TRUE

/obj/structure/divine/healingfountain/anyone
	desc = "A fountain containing the waters of life."
	cult_only = FALSE

/obj/structure/divine/healingfountain/attack_hand(mob/living/user)
	if(deactivated)
		return
	if(last_process + time_between_uses > world.time)
		user << "The fountain appears to be empty."
		return
	last_process = world.time
	if(!is_handofgod_cultist(user) && cult_only)
		user << "The water burns!</spam>"
		user.reagents.add_reagent("hell_water",20)
	else
		user << "The water feels warm and soothing as you touch it. The fountain immediately dries up shortly afterwards."
		user.reagents.add_reagent("godblood",20)
	update_icons()
	spawn(time_between_uses)
		if(src)
			update_icons()

/obj/structure/divine/healingfountain/update_icons()
	if(last_process + time_between_uses > world.time)
		icon_state = "fountain"
	else
		icon_state = "fountain-[side]"

/obj/structure/divine/powerpylon
	name = "power pylon"
	desc = "A pylon which increases the deity's rate it can influence the world."
	icon_state = "powerpylon"
	density = 1
	health = 30
	maxhealth = 30
	metal_cost = 5
	glass_cost = 15

/obj/structure/divine/powerpylon/New()
	..()
	if(deity && deity.god_nexus)
		deity.god_nexus.powerpylons += src

/obj/structure/divine/powerpylon/Destroy()
	if(deity && deity.god_nexus)
		deity.god_nexus.powerpylons -= src
	return ..()

/obj/structure/divine/powerpylon/deactivate()
	..()
	if(deity)
		deity.god_nexus.powerpylons -= src

/obj/structure/divine/powerpylon/activate()
	..()
	if(deity)
		deity.god_nexus.powerpylons += src

/obj/structure/divine/defensepylon
	name = "defense pylon"
	desc = "A pylon which is blessed to withstand many blows, and fire strong bolts at nonbelievers. A god can toggle it."
	icon_state = "defensepylon"
	health = 150
	maxhealth = 150
	metal_cost = 25
	glass_cost = 30
	var/obj/machinery/porta_turret/defensepylon_internal_turret/pylon_gun

/obj/structure/divine/defensepylon/New()
	..()
	pylon_gun = new(src)
	pylon_gun.base = src
	pylon_gun.faction = list("[side] god")

/obj/structure/divine/defensepylon/Destroy()
	qdel(pylon_gun) //just in case
	return ..()

/obj/structure/divine/defensepylon/examine(mob/user)
        ..()
        user << "\The [src] looks [pylon_gun.on ? "on" : "off"]."

/obj/structure/divine/defensepylon/assign_deity(mob/camera/god/new_deity, alert_old_deity = TRUE)
	if(..() && pylon_gun)
		pylon_gun.faction = list("[side] god")
		pylon_gun.side = side

/obj/structure/divine/defensepylon/attack_god(mob/camera/god/user)
	if(user.side == side)
		if(deactivated)
			user << "You need to reveal it first!"
			return
		pylon_gun.on = !pylon_gun.on
		icon_state = (pylon_gun.on) ? "defensepylon-[side]" : "defensepylon"

/obj/structure/divine/defensepylon/deactivate()
	..()
	pylon_gun.on = 0
	icon_state = (pylon_gun.on) ? "defensepylon-[side]" : "defensepylon"

/obj/structure/divine/defensepylon/activate()
	..()
	pylon_gun.on = 1
	icon_state = (pylon_gun.on) ? "defensepylon-[side]" : "defensepylon"

//This sits inside the defensepylon, to avoid copypasta
/obj/machinery/porta_turret/defensepylon_internal_turret
	name = "defense pylon"
	desc = "A plyon which is blessed to withstand many blows, and fire strong bolts at nonbelievers."
	icon = 'icons/obj/hand_of_god_structures.dmi'
	installation = null
	always_up = 1
	use_power = 0
	has_cover = 0
	health = 200
	projectile =  /obj/item/projectile/beam/pylon_bolt
	eprojectile =  /obj/item/projectile/beam/pylon_bolt
	shot_sound =  'sound/weapons/emitter2.ogg'
	eshot_sound = 'sound/weapons/emitter2.ogg'
	base_icon_state = "defensepylon"
	active_state = ""
	off_state = ""
	faction = null
	emp_vunerable = 0
	var/side = "neutral"

/obj/machinery/porta_turret/defensepylon_internal_turret/setup()
	return

/obj/machinery/porta_turret/defensepylon_internal_turret/shootAt(atom/movable/target)
	var/obj/item/projectile/A = ..()
	if(A)
		A.color = side

/obj/machinery/porta_turret/defensepylon_internal_turret/assess_perp(mob/living/carbon/human/perp)
	if(perp.handcuffed) //dishonourable to kill somebody who might be converted.
		return 0
	var/badtarget = 0
	switch(side)
		if("blue")
			badtarget = is_handofgod_bluecultist(perp)
		if("red")
			badtarget = is_handofgod_redcultist(perp)
		else
			badtarget = 1
	if(badtarget)
		return 0
	return 10

/obj/item/projectile/beam/pylon_bolt
	name = "divine bolt"
	icon_state = "greyscale_bolt"
	damage = 15

/obj/structure/divine/shrine
	name = "shrine"
	desc = "A shrine dedicated to a deity."
	icon_state = "shrine"
	metal_cost = 15
	glass_cost = 15

/obj/structure/divine/shrine/assign_deity(mob/camera/god/new_deity, alert_old_deity = TRUE)
	if(..())
		name = "shrine to [new_deity.name]"
		desc = "A shrine dedicated to [new_deity.name]"

//Functional, but need sprites
/*
/obj/structure/divine/translocator
	name = "translocator"
	desc = "A powerful structure, made with a greater gem.  It allows a deity to move their nexus to where this stands"
	icon_state = "translocator"
	health = 100
	maxhealth = 100
	metal_cost = 20
	glass_cost = 20
	greater_gem_cost = 1

/obj/structure/divine/lazarusaltar
	name = "lazarus altar"
	desc = "A very powerful altar capable of bringing life back to the recently deceased, made with a greater gem.  It can revive anyone and will heal virtually all wounds, but they are but a shell of their former self."
	icon_state = "lazarusaltar"
	density = 0
	health = 100
	maxhealth = 100
	metal_cost = 20
	greater_gem_cost = 1

/obj/structure/divine/lazarusaltar/attack_hand(mob/living/user)
	var/mob/living/L = locate() in get_turf(src)
	if(!is_handofgod_culstist(user))
		user << "You try to use it, but unfortunately you don't know any rituals."
		return
	if(!L)
		return

	if((side == "red" && is_handofgod_redcultist(user))) || (side == "blue" && is_handofgod_bluecultist(user)))
		user << "You attempt to revive [L] by invoking the rebirth ritual."
		L.revive()
		L.adjustCloneLoss(50)
		L.adjustStaminaLoss(100)
	else
		user << "You attempt to revive [L] by invoking the rebirth ritual."
		user << "But the altar ignores your words..."
*/


code:
/obj/structure/divine/trap
	name = "IT'S A TARP"
	desc = "stepping on me is a guaranteed bad day"
	icon_state = "trap"
	density = 0
	alpha = 30 //initially quite hidden when not "recharging"
	health = 20
	maxhealth = 20
	trap = TRUE
	autocolours = FALSE
	var/last_trigger = 0
	var/time_between_triggers = 600 //takes a minute to recharge

/obj/structure/divine/trap/Crossed(atom/movable/AM)
	if(last_trigger + time_between_triggers > world.time)
		return
	alpha = 30
	if(isliving(AM))
		var/mob/living/L = AM
		last_trigger = world.time
		alpha = 200
		trap_effect(L)
		animate(src, alpha = 30, time = time_between_triggers)

/obj/structure/divine/trap/examine(mob/user)
	..()
	if(!isliving(user)) //bad ghosts, stop trying to powergame from beyond the grave
		return
	user << "You reveal a trap!"
	alpha = 200
	animate(src, alpha = 30, time = time_between_triggers)

/obj/structure/divine/trap/proc/trap_effect(mob/living/L)
	return

/obj/structure/divine/trap/stun
	name = "shock trap"
	desc = "A trap that will shock you, it will burn your flesh and render you immobile, You'd better avoid it."
	icon_state = "trap-shock"

/obj/structure/divine/trap/stun/trap_effect(mob/living/L)
	L << "You are paralyzed from the intense shock!"
	L.Weaken(5)
	var/turf/Lturf = get_turf(L)
	new /obj/effect/particle_effect/sparks/electricity(Lturf)
	new /obj/effect/particle_effect/sparks(Lturf)

/obj/structure/divine/trap/fire
	name = "flame trap"
	desc = "A trap that will set you ablaze. You'd better avoid it."
	icon_state = "trap-fire"

/obj/structure/divine/trap/fire/trap_effect(mob/living/L)
	L << "Spontaneous combustion!"
	L.Weaken(1)
	var/turf/Lturf = get_turf(L)
	new /obj/effect/hotspot(Lturf)
	new /obj/effect/particle_effect/sparks(Lturf)

/obj/structure/divine/trap/chill
	name = "frost trap"
	desc = "A trap that will chill you to the bone. You'd better avoid it."
	icon_state = "trap-frost"

/obj/structure/divine/trap/chill/trap_effect(mob/living/L)
	L << "You're frozen solid!"
	L.Weaken(1)
	L.bodytemperature -= 300
	new /obj/effect/particle_effect/sparks(get_turf(L))

/obj/structure/divine/trap/damage
	name = "earth trap"
	desc = "A trap that will summon a small earthquake, just for you. You'd better avoid it."
	icon_state = "trap-earth"

/obj/structure/divine/trap/damage/trap_effect(mob/living/L)
	L << "The ground quakes beneath your feet!"
	L.Weaken(5)
	L.adjustBruteLoss(35)
	var/turf/Lturf = get_turf(L)
	new /obj/effect/particle_effect/sparks(Lturf)
	new /obj/structure/flora/rock(Lturf)

/obj/structure/divine/trap/ward
	name = "divine ward"
	desc = "A divine barrier, It looks like you could destroy it with enough effort, or wait for it to dissipate..."
	icon_state = "ward"
	health = 150
	maxhealth = 150
	density = 1
	time_between_triggers = 1200 //Exists for 2 minutes

/obj/structure/divine/trap/ward/New()
	..()
	spawn(time_between_triggers)
		if(src)
			qdel(src)


code:
/datum/intercept_text
	var/text
	/*
	var/prob_correct_person_lower = 20
	var/prob_correct_person_higher = 80
	var/prob_correct_job_lower = 20
	var/prob_correct_job_higher = 80
	var/prob_correct_prints_lower = 20
	var/prob_correct_print_higher = 80
	var/prob_correct_objective_lower = 20
	var/prob_correct_objective_higher = 80
	*/
	var/list/org_names_1 = list(
		"Blighted",
		"Defiled",
		"Unholy",
		"Murderous",
		"Ugly",
		"French",
		"Blue",
		"Farmer"
	)
	var/list/org_names_2 = list(
		"Reapers",
		"Swarm",
		"Rogues",
		"Menace",
		"Jeff Worshippers",
		"Drunks",
		"Strikers",
		"Creed"
	)
	var/list/anomalies = list(
		"Huge electrical storm",
		"Photon emitter",
		"Meson generator",
		"Blue swirly thing"
	)
	var/list/SWF_names = list(
		"Grand Wizard",
		"His Most Unholy Master",
		"The Most Angry",
		"Bighands",
		"Tall Hat",
		"Deadly Sandals"
	)
	var/list/changeling_names = list(
		"Odo",
		"The Thing",
		"Booga",
		"The Goatee of Wrath",
		"Tam Lin",
		"Species 3157",
		"Small Prick"
	)

/datum/intercept_text/proc/build(mode_type, datum/mind/correct_person)
	switch(mode_type)
		if("revolution")
			src.text = ""
			src.build_rev(correct_person)
			return src.text
		if("gang")
			src.text = ""
			src.build_gang(correct_person)
			return src.text
		if("cult")
			src.text = ""
			src.build_cult(correct_person)
			return src.text
		if("wizard")
			src.text = ""
			src.build_wizard(correct_person)
			return src.text
		if("nuke")
			src.text = ""
			src.build_nuke(correct_person)
			return src.text
		if("traitor")
			src.text = ""
			src.build_traitor(correct_person)
			return src.text
		if("changeling","traitorchan")
			src.text = ""
			src.build_changeling(correct_person)
			return src.text
		if("shadowling")
			src.text = ""
			src.build_shadowling(correct_person)
			return src.text
		else
			return null

// NOTE: Commentted out was the code which showed the chance of someone being an antag. If you want to re-add it, just uncomment the code.

/*
/datum/intercept_text/proc/pick_mob()
	var/list/dudes = list()
	for(var/mob/living/carbon/human/man in player_list)
		if (!man.mind) continue
		if (man.mind.assigned_role=="MODE") continue
		dudes += man
	if(dudes.len==0)
		return null
	return pick(dudes)

/datum/intercept_text/proc/pick_fingerprints()
	var/mob/living/carbon/human/dude = src.pick_mob()
	//if (!dude) return pick_fingerprints() //who coded that is totally crasy or just a traitor. -- rastaf0
	if(dude)
		return num2text(md5(dude.dna.uni_identity))
	else
		return num2text(md5(num2text(rand(1,10000))))
*/

/datum/intercept_text/proc/build_traitor(datum/mind/correct_person)
	var/name_1 = pick(src.org_names_1)
	var/name_2 = pick(src.org_names_2)

	/*
	var/fingerprints
	var/traitor_name
	var/prob_right_dude = rand(prob_correct_person_lower, prob_correct_person_higher)
	if(prob(prob_right_dude) && ticker.mode == "traitor")
		if(correct_person:assigned_role=="MODE")
			traitor_name = pick_mob()
		else
			traitor_name = correct_person:current
	else if(prob(prob_right_dude))
		traitor_name = pick_mob()
	else
		fingerprints = pick_fingerprints()
	*/

	src.text += "

The [name_1] [name_2] implied an undercover operative was acting on their behalf on the station currently."
	src.text += "It would be in your best interests to suspect everybody, as these undercover operatives could have implants which trigger them to have their memories removed until they are needed. He, or she, could even be a high ranking officer."
	src.text += "

"
	/*
	src.text += "After some investigation, we "
	if(traitor_name)
		src.text += "are [prob_right_dude]% sure that [traitor_name] may have been involved, and should be closely observed."
		src.text += "
Note: This group are known to be untrustworthy, so do not act on this information without proper discourse."
	else
		src.text += "discovered the following set of fingerprints ([fingerprints]) on sensitive materials, and their owner should be closely observed."
		src.text += "However, these could also belong to a current Centcom employee, so do not act on this without reason."
	*/

/datum/intercept_text/proc/build_cult(datum/mind/correct_person)
	var/name_1 = pick(src.org_names_1)
	var/name_2 = pick(src.org_names_2)
	/*
	var/traitor_name
	var/traitor_job
	var/prob_right_dude = rand(prob_correct_person_lower, prob_correct_person_higher)
	var/prob_right_job = rand(prob_correct_job_lower, prob_correct_job_higher)
	if(prob(prob_right_job) && is_convertable_to_cult(correct_person))
		if (correct_person)
			if(correct_person:assigned_role=="MODE")
				traitor_job = pick(get_all_jobs())
			else
				traitor_job = correct_person:assigned_role
	else
		var/list/job_tmp = get_all_jobs()
		job_tmp.Remove("Captain", "Chaplain", "AI", "Cyborg", "Security Officer", "Detective", "Head Of Security", "Head of Personnel", "Chief Engineer", "Research Director", "Chief Medical Officer")
		traitor_job = pick(job_tmp)
	if(prob(prob_right_dude) && ticker.mode == "cult")
		if(correct_person:assigned_role=="MODE")
			traitor_name = src.pick_mob()
		else
			traitor_name = correct_person:current
	else
		traitor_name = pick_mob()
	*/
	src.text += "

It has been brought to our attention that the [name_1] [name_2] have stumbled upon some dark secrets. They apparently want to spread the dangerous knowledge onto as many stations as they can."
	src.text += "Watch out for the following: praying to an unfamilar god, preaching the word of \[REDACTED\], sacrifices, magical dark power, living constructs of evil and a portal to the dimension of the underworld."
	src.text += "

"
	/*
	src.text += "Based on our intelligence, we are [prob_right_job]% sure that if true, someone doing the job of [traitor_job] on your station may have been converted "
	src.text += "and instilled with the idea of the flimsiness of the real world, seeking to destroy it. "
	if(prob(prob_right_dude))
		src.text += "
 In addition, we are [prob_right_dude]% sure that [traitor_name] may have also some in to contact with this "
		src.text += "organisation."
	src.text += "
However, if this information is acted on without substantial evidence, those responsible will face severe repercussions."
	*/

/datum/intercept_text/proc/build_rev(datum/mind/correct_person)
	var/name_1 = pick(src.org_names_1)
	var/name_2 = pick(src.org_names_2)
	/*
	var/traitor_name
	var/traitor_job
	var/prob_right_dude = rand(prob_correct_person_lower, prob_correct_person_higher)
	var/prob_right_job = rand(prob_correct_job_lower, prob_correct_job_higher)
	if(prob(prob_right_job) && is_convertable_to_rev(correct_person))
		if (correct_person)
			if(correct_person.assigned_role=="MODE")
				traitor_job = pick(get_all_jobs())
			else
				traitor_job = correct_person.assigned_role
	else
		var/list/job_tmp = get_all_jobs()
		job_tmp-=nonhuman_positions
		job_tmp-=command_positions
		job_tmp.Remove("Security Officer", "Detective", "Warden", "MODE")
		traitor_job = pick(job_tmp)
	if(prob(prob_right_dude) && ticker.mode.config_tag == "revolution")
		if(correct_person.assigned_role=="MODE")
			traitor_name = src.pick_mob()
		else
			traitor_name = correct_person.current
	else
		traitor_name = src.pick_mob()
	*/
	src.text += "

It has been brought to our attention that the [name_1] [name_2] are attempting to stir unrest on one of our stations in your sector."
	src.text += "Watch out for suspicious activity among the crew and make sure that all heads of staff report in periodically."
	src.text += "

"
	/*
	src.text += "Based on our intelligence, we are [prob_right_job]% sure that if true, someone doing the job of [traitor_job] on your station may have been brainwashed "
	src.text += "at a recent conference, and their department should be closely monitored for signs of mutiny. "
	if(prob(prob_right_dude))
		src.text += "
 In addition, we are [prob_right_dude]% sure that [traitor_name] may have also some in to contact with this "
		src.text += "organisation."
	src.text += "
However, if this information is acted on without substantial evidence, those responsible will face severe repercussions."
	*/

/datum/intercept_text/proc/build_gang(datum/mind/correct_person)
	src.text += "

We have reports of criminal activity in close proximity to our operations within your sector."
	src.text += "Ensure law and order is maintained on the station and be on the lookout for territorial aggression within the crew."
	src.text += "In the event of a full-scale criminal takeover threat, sensitive research items are to be secured and the station evacuated ASAP."
	src.text += "

"

/datum/intercept_text/proc/build_wizard(datum/mind/correct_person)
	var/SWF_desc = pick(SWF_names)

	src.text += "

The evil Space Wizards Federation have recently broke their most feared wizard, known only as \"[SWF_desc]\" out of space jail. "
	src.text += "He is on the run, last spotted in a system near your present location. If anybody suspicious is located aboard, please "
	src.text += "approach with EXTREME caution. Centcom also recommends that it would be wise to not inform the crew of this, due to their fearful nature."
	src.text += "Known attributes include: Brown sandals, a large blue hat, a voluptous white beard, and an inclination to cast spells."
	src.text += "

"

/datum/intercept_text/proc/build_nuke(datum/mind/correct_person)
	src.text += "

Centcom recently received a report of a plot to destroy one of our stations in your area. We believe the Nuclear Authentication Disc "
	src.text += "that is standard issue aboard your vessel may be a target. We recommend removal of this object, and it's storage in a safe "
	src.text += "environment. As this may cause panic among the crew, all efforts should be made to keep this information a secret from all but "
	src.text += "the most trusted crew-members."
	src.text += "

"

/datum/intercept_text/proc/build_changeling(datum/mind/correct_person)
	var/cname = pick(src.changeling_names)
	var/orgname1 = pick(src.org_names_1)
	var/orgname2 = pick(src.org_names_2)
	/*
	var/changeling_name
	var/changeling_job
	var/prob_right_dude = rand(prob_correct_person_lower, prob_correct_person_higher)
	var/prob_right_job = rand(prob_correct_job_lower, prob_correct_job_higher)
	if(prob(prob_right_job))
		if(correct_person)
			if(correct_person:assigned_role=="MODE")
				changeling_job = pick(get_all_jobs())
			else
				changeling_job = correct_person:assigned_role
	else
		changeling_job = pick(get_all_jobs())
	if(prob(prob_right_dude) && ticker.mode == "changeling")
		if(correct_person:assigned_role=="MODE")
			changeling_name = correct_person:current
		else
			changeling_name = src.pick_mob()
	else
		changeling_name = src.pick_mob()
	*/

	src.text += "

We have received a report that a dangerous alien lifeform known only as \"[cname]\" may have infiltrated your crew.  "
	/*
	src.text += "Our intelligence suggests a [prob_right_job]% chance that a [changeling_job] on board your station has been replaced by the alien.  "
	src.text += "Additionally, the report indicates a [prob_right_dude]% chance that [changeling_name] may have been in contact with the lifeform at a recent social gathering.  "
	*/
	src.text += "These lifeforms are associated with the [orgname1] [orgname2] and may be attempting to acquire sensitive materials on their behalf.  "
	src.text += "Please take care not to alarm the crew, as [cname] may take advantage of a panic situation. Remember, they can be anybody, suspect everybody!"
	src.text += "

"

/datum/intercept_text/proc/build_shadowling(datum/mind/correct_person)
	src.text += "

Sightings of strange alien creatures have been observed in your area. These aliens supposedly possess the ability to enslave unwitting personnel and leech from their power. \
	Be wary of dark areas and ensure all lights are kept well-maintained. Closely monitor all crew for suspicious behavior and perform dethralling surgery if they have obvious tells. Investigate all \
	reports of odd or suspicious sightings in maintenance."
	src.text += "

"


code:
/datum/AI_Module
	var/uses = 0
	var/module_name
	var/mod_pick_name
	var/description = ""
	var/engaged = 0
	var/cost = 5
	var/one_time = 0

	var/power_type

/datum/AI_Module/large/
	uses = 1

/datum/AI_Module/small/
	uses = 5

//////DOOMSDAY DEVICE

/datum/AI_Module/large/nuke_station
	module_name = "Doomsday Device"
	mod_pick_name = "nukestation"
	description = "Activate a weapon that will disintegrate all organic life on the station after a 450 second delay."
	cost = 130
	one_time = 1

	power_type = /mob/living/silicon/ai/proc/nuke_station

/mob/living/silicon/ai/proc/nuke_station()
	set category = "Malfunction"
	set name = "Doomsday Device"

	for(var/N in nuke_tiles)
		var/turf/T = N
		T.icon_state = "rcircuitanim" //This causes all blue "circuit" tiles on the map to change to animated red icon state.

	src << "Nuclear device armed."
	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")
	SSshuttle.emergencyNoEscape = 1
	nuking = 1
	var/obj/machinery/doomsday_device/DOOM = new /obj/machinery/doomsday_device(src)
	doomsday_device = DOOM
	verbs -= /mob/living/silicon/ai/proc/nuke_station
	for(var/obj/item/weapon/pinpointer/point in pinpointer_list)
		for(var/mob/living/silicon/ai/A in ai_list)
			if((A.stat != DEAD) && A.nuking)
				point.the_disk = A //The pinpointer now tracks the AI core

/obj/machinery/doomsday_device
	icon = 'icons/obj/machines/nuke_terminal.dmi'
	name = "doomsday device"
	icon_state = "nuclearbomb_base"
	desc = "A weapon which disintegrates all organic life in a large area."
	anchored = 1
	density = 1
	verb_exclaim = "blares"
	var/timing = 1
	var/timer = 450

/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", 1)
		SSshuttle.emergencyNoEscape = 0
		if(SSshuttle.emergency.mode == SHUTTLE_STRANDED)
			SSshuttle.emergency.mode = SHUTTLE_DOCKED
			SSshuttle.emergency.timer = world.time
			priority_announce("Hostile environment resolved. You have 3 minutes to board the Emergency Shuttle.", null, 'sound/AI/shuttledock.ogg', "Priority")
		qdel(src)
	if(!timing)
		return
	if(timer <= 0)
		timing = 0
		detonate(T.z)
		qdel(src)
	else
		timer--
		if(!(timer%60))
			var/message = "[timer] SECONDS UNTIL DOOMSDAY DEVICE ACTIVATION!"
			minor_announce(message, "ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4", 1)

/obj/machinery/doomsday_device/proc/detonate(z_level = 1)
	for(var/mob/M in player_list)
		M << 'sound/machines/Alarm.ogg'
	sleep(100)
	for(var/mob/living/L in mob_list)
		var/turf/T = get_turf(L)
		if(T.z != z_level)
			continue
		if(issilicon(L))
			continue
		L << "The blast wave from the [src] tears you atom from atom!"
		L.dust()
	world << "The AI cleansed the station of life with the doomsday device!"
	ticker.force_ending = 1

/datum/AI_Module/large/fireproof_core
	module_name = "Core Upgrade"
	mod_pick_name = "coreup"
	description = "An upgrade to improve core resistance, making it immune to fire and heat. This effect is permanent."
	cost = 50
	one_time = 1

	power_type = /mob/living/silicon/ai/proc/fireproof_core

//////END DOOMSDAY DEVICE

/mob/living/silicon/ai/proc/fireproof_core()
	set category = "Malfunction"
	set name = "Fireproof Core"
	for(var/mob/living/silicon/ai/ai in player_list)
		ai.fire_res_on_core = 1
	src.verbs -= /mob/living/silicon/ai/proc/fireproof_core
	src << "Core fireproofed."

/datum/AI_Module/large/upgrade_turrets
	module_name = "AI Turret Upgrade"
	mod_pick_name = "turret"
	description = "Improves the power and health of all AI turrets. This effect is permanent."
	cost = 30
	one_time = 1

	power_type = /mob/living/silicon/ai/proc/upgrade_turrets

/mob/living/silicon/ai/proc/upgrade_turrets()
	set category = "Malfunction"
	set name = "Upgrade Turrets"

	if(!canUseTopic())
		return

	src.verbs -= /mob/living/silicon/ai/proc/upgrade_turrets
	//Upgrade AI turrets around the world
	for(var/obj/machinery/porta_turret/ai/turret in machines)
		turret.health += 30
		turret.eprojectile = /obj/item/projectile/beam/laser/heavylaser //Once you see it, you will know what it means to FEAR.
		turret.eshot_sound = 'sound/weapons/lasercannonfire.ogg'
	src << "Turrets upgraded."

/datum/AI_Module/large/lockdown
	module_name = "Hostile Station Lockdown"
	mod_pick_name = "lockdown"
	description = "Overload the airlock, blast door and fire control networks, locking them down. Caution! This command also electrifies all airlocks. The networks will automatically reset after 90 seconds."
	cost = 30
	one_time = 1

	power_type = /mob/living/silicon/ai/proc/lockdown

/mob/living/silicon/ai/proc/lockdown()
	set category = "Malfunction"
	set name = "Initiate Hostile Lockdown"

	if(!canUseTopic())
		return

	var/obj/machinery/door/airlock/AL
	for(var/obj/machinery/door/D in airlocks)
		if(D.z != ZLEVEL_STATION && D.z != ZLEVEL_MINING)
			continue
		spawn()
			if(istype(D, /obj/machinery/door/airlock))
				AL = D
				if(AL.canAIControl() && !AL.stat) //Must be powered and have working AI wire.
					AL.locked = 0 //For airlocks that were bolted open.
					AL.safe = 0 //DOOR CRUSH
					AL.close()
					AL.bolt() //Bolt it!
					AL.secondsElectrified = -1  //Shock it!
			else if(!D.stat) //So that only powered doors are closed.
				D.close() //Close ALL the doors!

	var/obj/machinery/computer/communications/C = locate() in machines
	if(C)
		C.post_status("alert", "lockdown")

	verbs -= /mob/living/silicon/ai/proc/lockdown
	minor_announce("Hostile runtime detected in door controllers. Isolation Lockdown protocols are now in effect. Please remain calm.","Network Alert:", 1)
	src << "Lockdown Initiated. Network reset in 90 seconds."
	spawn(900) //90 Seconds.
		disablelockdown() //Reset the lockdown after 90 seconds.

/mob/living/silicon/ai/proc/disablelockdown()
	set category = "Malfunction"
	set name = "Disable Lockdown"

	var/obj/machinery/door/airlock/AL
	for(var/obj/machinery/door/D in airlocks)
		spawn()
			if(istype(D, /obj/machinery/door/airlock))
				AL = D
				if(AL.canAIControl() && !AL.stat) //Must be powered and have working AI wire.
					AL.unbolt()
					AL.secondsElectrified = 0
					AL.open()
					AL.safe = 1
			else if(!D.stat) //Opens only powered doors.
				D.open() //Open everything!

	minor_announce("Automatic system reboot complete. Have a secure day.","Network reset:")

/datum/AI_Module/large/destroy_rcd
	module_name = "Destroy RCDs"
	mod_pick_name = "rcd"
	description = "Send a specialised pulse to detonate all hand-held and exosuit Rapid Cconstruction Devices on the station."
	cost = 25
	one_time = 1

	power_type = /mob/living/silicon/ai/proc/disable_rcd

/mob/living/silicon/ai/proc/disable_rcd()
	set category = "Malfunction"
	set name = "Destroy RCDs"
	set desc = "Detonate all RCDs on the station, while sparing onboard cyborg RCDs."

	if(!canUseTopic() || malf_cooldown)
		return

	for(var/obj/item/RCD in rcd_list)
		if(!istype(RCD, /obj/item/weapon/rcd/borg)) //Ensures that cyborg RCDs are spared.
			RCD.audible_message("[RCD] begins to vibrate and buzz loudly!","[RCD] begins vibrating violently!")
			spawn(50) //5 seconds to get rid of it!
				if(RCD) //Make sure it still exists (In case of chain-reaction)
					explosion(RCD, 0, 0, 3, 1, flame_range = 1)
					qdel(RCD)

	src << "RCD detonation pulse emitted."
	malf_cooldown = 1
	spawn(100)
		malf_cooldown = 0

/datum/AI_Module/large/mecha_domination
	module_name = "Viral Mech Domination"
	mod_pick_name = "mechjack"
	description = "Hack into a mech's onboard computer, shunting all processes into it and ejecting any occupants. Once uploaded to the mech, it is impossible to leave.\
	Do not allow the mech to leave the station's vicinity or allow it to be destroyed."
	cost = 30
	one_time = 1

	power_type = /mob/living/silicon/ai/proc/mech_takeover

/mob/living/silicon/ai/proc/mech_takeover()
	set name = "Compile Mecha Virus"
	set category = "Malfunction"
	set desc = "Target a mech by clicking it. Click the appropriate command when ready."
	if(stat)
		return
	can_dominate_mechs = 1 //Yep. This is all it does. Honk!
	src << "Virus package compiled. Select a target mech at any time. You must remain on the station at all times. Loss of signal will result in total system lockout."
	verbs -= /mob/living/silicon/ai/proc/mech_takeover

/datum/AI_Module/large/break_fire_alarms
	module_name = "Thermal Sensor Override"
	mod_pick_name = "burnpigs"
	description = "Gives you the ability to override the thermal sensors on all fire alarms. This will remove their ability to scan for fire and thus their ability to alert. \
	Anyone can check the fire alarm's interface and may be tipped off by its status."
	one_time = 1
	cost = 25

	power_type = /mob/living/silicon/ai/proc/break_fire_alarms

/mob/living/silicon/ai/proc/break_fire_alarms()
	set name = "Override Thermal Sensors"
	set category = "Malfunction"

	if(!canUseTopic())
		return

	for(var/obj/machinery/firealarm/F in machines)
		if(F.z != ZLEVEL_STATION)
			continue
		F.emagged = 1
	src << "All thermal sensors on the station have been disabled. Fire alerts will no longer be recognized."
	src.verbs -= /mob/living/silicon/ai/proc/break_fire_alarms

/datum/AI_Module/large/break_air_alarms
	module_name = "Air Alarm Safety Override"
	mod_pick_name = "allow_flooding"
	description = "Gives you the ability to disable safeties on all air alarms. This will allow you to use the environmental mode Flood, which disables scrubbers as well as pressure checks on vents. \
	Anyone can check the air alarm's interface and may be tipped off by their nonfunctionality."
	one_time = 1
	cost = 50

	power_type = /mob/living/silicon/ai/proc/break_air_alarms

/mob/living/silicon/ai/proc/break_air_alarms()
	set name = "Disable Air Alarm Safeties"
	set category = "Malfunction"

	if(!canUseTopic())
		return

	for(var/obj/machinery/airalarm/AA in machines)
		if(AA.z != ZLEVEL_STATION)
			continue
		AA.emagged = 1
	src << "All air alarm safeties on the station have been overriden. Air alarms may now use the Flood environmental mode."
	src.verbs -= /mob/living/silicon/ai/proc/break_air_alarms

/datum/AI_Module/small/overload_machine
	module_name = "Machine Overload"
	mod_pick_name = "overload"
	description = "Overloads an electrical machine, causing a small explosion. 2 uses."
	uses = 2
	cost = 20

	power_type = /mob/living/silicon/ai/proc/overload_machine

/mob/living/silicon/ai/proc/overload_machine(obj/machinery/M in machines)
	set name = "Overload Machine"
	set category = "Malfunction"

	if(!canUseTopic())
		return

	if (istype(M, /obj/machinery))
		for(var/datum/AI_Module/small/overload_machine/overload in current_modules)
			if(overload.uses > 0)
				overload.uses --
				audible_message("You hear a loud electrical buzzing sound!")
				src << "Overloading machine circuitry..."
				spawn(50)
					if(M)
						explosion(get_turf(M), 0,1,1,0)
						qdel(M)
			else src << "Out of uses."
	else src << "That's not a machine."

/datum/AI_Module/small/override_machine
	module_name = "Machine Override"
	mod_pick_name = "override"
	description = "Overrides a machine's programming, causing it to rise up and attack everyone except other machines. 4 uses."
	uses = 4
	cost = 30

	power_type = /mob/living/silicon/ai/proc/override_machine

/mob/living/silicon/ai/proc/override_machine(obj/machinery/M in machines)
	set name = "Override Machine"
	set category = "Malfunction"

	if(!canUseTopic())
		return

	if (istype(M, /obj/machinery))
		if(!M.can_be_overridden())
			src << "Can't override this device."
		for(var/datum/AI_Module/small/override_machine/override in current_modules)
			if(override.uses > 0)
				override.uses --
				audible_message("You hear a loud electrical buzzing sound!")
				src << "Reprogramming machine behaviour..."
				spawn(50)
					if(M && !qdeleted(M))
						new /mob/living/simple_animal/hostile/mimic/copy/machine(get_turf(M), M, src, 1)
			else src << "Out of uses."
	else src << "That's not a machine."

/datum/AI_Module/large/place_cyborg_transformer
	module_name = "Robotic Factory (Removes Shunting)"
	mod_pick_name = "cyborgtransformer"
	description = "Build a machine anywhere, using expensive nanomachines, that can convert a living human into a loyal cyborg slave when placed inside."
	cost = 100
	power_type = /mob/living/silicon/ai/proc/place_transformer
	var/list/turfOverlays = list()

/datum/AI_Module/large/place_cyborg_transformer/New()
	for(var/i=0;i<3;i++)
		var/image/I = image("icon"='icons/turf/overlays.dmi')
		turfOverlays += I
	..()

/mob/living/silicon/ai/proc/place_transformer()
	set name = "Place Robotic Factory"
	set category = "Malfunction"
	if(!canPlaceTransformer())
		return
	var/sure = alert(src, "Are you sure you want to place the machine here?", "Are you sure?", "Yes", "No")
	if(sure == "Yes")
		if(!canPlaceTransformer())
			return
		var/turf/T = get_turf(eyeobj)
		new /obj/machinery/transformer/conveyor(T)
		playsound(T, 'sound/effects/phasein.ogg', 100, 1)
		var/datum/AI_Module/large/place_cyborg_transformer/PCT = locate() in current_modules
		PCT.uses --
		can_shunt = 0
		src << "You cannot shunt anymore."

/mob/living/silicon/ai/proc/canPlaceTransformer()
	if(!eyeobj || !isturf(src.loc) || !canUseTopic())
		return
	var/datum/AI_Module/large/place_cyborg_transformer/PCT = locate() in current_modules
	if(!PCT || PCT.uses < 1)
		alert(src, "Out of uses.")
		return
	var/turf/middle = get_turf(eyeobj)
	var/list/turfs = list(middle, locate(middle.x - 1, middle.y, middle.z), locate(middle.x + 1, middle.y, middle.z))
	var/alert_msg = "There isn't enough room. Make sure you are placing the machine in a clear area and on a floor."
	var/success = 1
	if(turfs.len == 3)
		for(var/n=1;n<4,n++)
			var/fail
			var/turf/T = turfs[n]
			if(!istype(T, /turf/open/floor))
				fail = 1
			var/datum/camerachunk/C = cameranet.getCameraChunk(T.x, T.y, T.z)
			if(!C.visibleTurfs[T])
				alert_msg = "We cannot get camera vision of this location."
				fail = 1
			for(var/atom/movable/AM in T.contents)
				if(AM.density)
					fail = 1
			var/image/I = PCT.turfOverlays[n]
			I.loc = T
			client.images += I
			if(fail)
				success = 0
				I.icon_state = "redOverlay"
			else
				I.icon_state = "greenOverlay"
			spawn(30)
				if(client && (I.loc == T))
					client.images -= I
	if(success)
		return 1
	alert(src, alert_msg)
	return

/datum/AI_Module/small/blackout
	module_name = "Blackout"
	mod_pick_name = "blackout"
	description = "Attempts to overload the lighting circuits on the station, destroying some bulbs. 3 uses."
	uses = 3
	cost = 15

	power_type = /mob/living/silicon/ai/proc/blackout

/mob/living/silicon/ai/proc/blackout()
	set category = "Malfunction"
	set name = "Blackout"

	if(!canUseTopic())
		return

	for(var/datum/AI_Module/small/blackout/blackout in current_modules)
		if(blackout.uses > 0)
			blackout.uses --
			for(var/obj/machinery/power/apc/apc in machines)
				if(prob(30*apc.overload))
					apc.overload_lighting()
				else apc.overload++
			src << "Overcurrent applied to the powernet."
		else src << "Out of uses."

/datum/AI_Module/small/reactivate_cameras
	module_name = "Reactivate Camera Network"
	mod_pick_name = "recam"
	description = "Runs a network-wide diagnostic on the camera network, resetting focus and re-routing power to failed cameras. Can be used to repair up to 30 cameras."
	uses = 30
	cost = 10
	one_time = 1

	power_type = /mob/living/silicon/ai/proc/reactivate_cameras

/mob/living/silicon/ai/proc/reactivate_cameras()
	set name = "Reactivate Cameranet"
	set category = "Malfunction"

	if(!canUseTopic() || malf_cooldown)
		return
	var/fixedcams = 0 //Tells the AI how many cams it fixed. Stats are fun.

	for(var/datum/AI_Module/small/reactivate_cameras/camera in current_modules)
		for(var/obj/machinery/camera/C in cameranet.cameras)
			var/initial_range = initial(C.view_range) //To prevent calling the proc twice
			if(camera.uses > 0)
				if(!C.status)
					C.toggle_cam(src, 0) //Reactivates the camera based on status. Badly named proc.
					fixedcams++
					camera.uses--
				if(C.view_range != initial_range)
					C.view_range = initial_range //Fixes cameras with bad focus.
					camera.uses--
					fixedcams++
					//If a camera is both deactivated and has bad focus, it will cost two uses to fully fix!
			else
				src << "Out of uses."
				verbs -= /mob/living/silicon/ai/proc/reactivate_cameras //It is useless now, clean it up.
				break
	src << "Diagnostic complete! Operations completed: [fixedcams]."

	malf_cooldown = 1
	spawn(30) //Lag protection
		malf_cooldown = 0

/datum/AI_Module/large/upgrade_cameras
	module_name = "Upgrade Camera Network"
	mod_pick_name = "upgradecam"
	description = "Install broad-spectrum scanning and electrical redundancy firmware to the camera network, enabling EMP-Proofing and light-amplified X-ray vision." //I <3 pointless technobabble
	//This used to have motion sensing as well, but testing quickly revealed that giving it to the whole cameranet is PURE HORROR.
	one_time = 1
	cost = 35 //Decent price for omniscience!

	power_type = /mob/living/silicon/ai/proc/upgrade_cameras

/mob/living/silicon/ai/proc/upgrade_cameras()
	set name = "Upgrade Cameranet"
	set category = "Malfunction"

	if(!canUseTopic())
		return

	var/upgradedcams = 0
	see_override = SEE_INVISIBLE_MINIMUM //Night-vision, without which X-ray would be very limited in power.
	update_sight()

	for(var/obj/machinery/camera/C in cameranet.cameras)
		if(C.assembly)
			var/upgraded = 0

			if(!C.isXRay())
				C.upgradeXRay()
				//Update what it can see.
				cameranet.updateVisibility(C, 0)
				upgraded = 1

			if(!C.isEmpProof())
				C.upgradeEmpProof()
				upgraded = 1

			if(upgraded)
				upgradedcams++

	src << "OTA firmware distribution complete! Cameras upgraded: [upgradedcams]. Light amplification system online."
	verbs -= /mob/living/silicon/ai/proc/upgrade_cameras

/datum/module_picker
	var/temp = null
	var/processing_time = 50
	var/list/possible_modules = list()

/datum/module_picker/New()
	for(var/type in typesof(/datum/AI_Module))
		var/datum/AI_Module/AM = new type
		if(AM.power_type != null)
			src.possible_modules += AM

/datum/module_picker/proc/remove_verbs(mob/living/silicon/ai/A)

	for(var/datum/AI_Module/AM in possible_modules)
		A.verbs.Remove(AM.power_type)

/datum/module_picker/proc/use(mob/user)
	var/dat
	dat = "Select use of processing time: (currently #[src.processing_time] left.)
"
	dat += "
"
	dat += "Install Module:
"
	dat += "The number afterwards is the amount of processing time it consumes.
"
	for(var/datum/AI_Module/large/module in src.possible_modules)
		dat += "[module.module_name]\[?\] ([module.cost])
"
	for(var/datum/AI_Module/small/module in src.possible_modules)
		dat += "[module.module_name]\[?\] ([module.cost])
"
	dat += "
"
	if (src.temp)
		dat += "[src.temp]"
	var/datum/browser/popup = new(user, "modpicker", "Malf Module Menu")
	popup.set_content(dat)
	popup.open()
	return

/datum/module_picker/Topic(href, href_list)
	..()

	if(!isAI(usr))
		return
	var/mob/living/silicon/ai/A = usr

	if(A.stat == DEAD)
		A <<"You are already dead!" //Omae Wa Mou Shindeiru
		return

	for(var/datum/AI_Module/AM in possible_modules)
		if (href_list[AM.mod_pick_name])

			// Cost check
			if(AM.cost > src.processing_time)
				temp = "You cannot afford this module."
				break

			// Add new uses if we can, and it is allowed.
			var/datum/AI_Module/already_AM = locate(AM.type) in A.current_modules
			if(already_AM)
				if(!AM.one_time)
					already_AM.uses += AM.uses
					src.processing_time -= AM.cost
					temp = "Additional use added to [already_AM.module_name]"
					break
				else
					temp = "This module is only needed once."
					break

			// Give the power and take away the money.
			A.view_core() //A BYOND bug requires you to be viewing your core before your verbs update
			A.verbs += AM.power_type
			A.current_modules += new AM.type
			temp = AM.description
			src.processing_time -= AM.cost

		if(href_list["showdesc"])
			if(AM.mod_pick_name == href_list["showdesc"])
				temp = AM.description
	src.use(usr)
	return

/datum/AI_Module/large/eavesdrop
	module_name = "Enhanced Surveillance"
	mod_pick_name = "eavesdrop"
	description = "Via a combination of hidden microphones and lip reading software, you are able to use your cameras to listen in on conversations."
	cost = 30
	one_time = 1

	power_type = /mob/living/silicon/ai/proc/surveillance

/mob/living/silicon/ai/proc/surveillance()
	set category = "Malfunction"
	set name = "Enhanced Surveillance"

	if(eyeobj)
		eyeobj.relay_speech = TRUE
	src << "OTA firmware distribution complete! Cameras upgraded: Enhanced surveillance package online."
	verbs -= /mob/living/silicon/ai/proc/surveillance


code:
/datum/game_mode/meteor
	name = "meteor"
	config_tag = "meteor"
	var/meteordelay = 2000
	var/nometeors = 0
	var/rampupdelta = 5
	required_players = 0

/datum/game_mode/meteor/announce()
	world << "The current game mode is - Meteor!"
	world << "The space station has been stuck in a major meteor shower. You must escape from the station or at least live."

/datum/game_mode/meteor/process()
	if(nometeors || meteordelay > world.time - round_start_time)
		return

	var/list/wavetype = meteors_normal
	var/meteorminutes = (world.time - round_start_time - meteordelay) / 10 / 60

	if (prob(meteorminutes))
		wavetype = meteors_threatening

	if (prob(meteorminutes/2))
		wavetype = meteors_catastrophic

	var/ramp_up_final = Clamp(round(meteorminutes/rampupdelta), 1, 10)

	spawn_meteors(ramp_up_final, wavetype)

/datum/game_mode/meteor/declare_completion()
	var/text
	var/survivors = 0

	for(var/mob/living/player in player_list)
		if(player.stat != DEAD)
			++survivors

			if(player.onCentcom())
				text += "
[player.real_name] escaped to the safety of Centcom."
			else if(player.onSyndieBase())
				text += "
[player.real_name] escaped to the (relative) safety of Syndicate Space."
			else
				text += "
[player.real_name] survived but is stranded without any hope of rescue."

	if(survivors)
		world << "The following survived the meteor storm:[text]"
	else
		world << "Nobody survived the meteor storm!"

	feedback_set_details("round_end_result","end - evacuation")
	feedback_set("round_end_result",survivors)

	..()
	return 1


code:
/var/const/meteor_wave_delay = 625 //minimum wait between waves in tenths of seconds
//set to at least 100 unless you want evarr ruining every round

//Meteors probability of spawning during a given wave
/var/list/meteors_normal = list(/obj/effect/meteor/dust=3, /obj/effect/meteor/medium=8, /obj/effect/meteor/big=3, \
						  /obj/effect/meteor/flaming=1, /obj/effect/meteor/irradiated=3) //for normal meteor event

/var/list/meteors_threatening = list(/obj/effect/meteor/medium=4, /obj/effect/meteor/big=8, \
						  /obj/effect/meteor/flaming=3, /obj/effect/meteor/irradiated=3) //for threatening meteor event

/var/list/meteors_catastrophic = list(/obj/effect/meteor/medium=5, /obj/effect/meteor/big=75, \
						  /obj/effect/meteor/flaming=10, /obj/effect/meteor/irradiated=10, /obj/effect/meteor/tunguska = 1) //for catastrophic meteor event

/var/list/meteorsB = list(/obj/effect/meteor/meaty=5, /obj/effect/meteor/meaty/xeno=1) //for meaty ore event

/var/list/meteorsC = list(/obj/effect/meteor/dust) //for space dust event

///////////////////////////////
//Meteor spawning global procs
///////////////////////////////

/proc/spawn_meteors(number = 10, list/meteortypes)
	for(var/i = 0; i < number; i++)
		spawn_meteor(meteortypes)

/proc/spawn_meteor(list/meteortypes)
	var/turf/pickedstart
	var/turf/pickedgoal
	var/max_i = 10//number of tries to spawn meteor.
	while (!istype(pickedstart, /turf/open/space))
		var/startSide = pick(cardinal)
		pickedstart = spaceDebrisStartLoc(startSide, 1)
		pickedgoal = spaceDebrisFinishLoc(startSide, 1)
		max_i--
		if(max_i<=0)
			return
	var/Me = pickweight(meteortypes)
	var/obj/effect/meteor/M = new Me(pickedstart)
	M.dest = pickedgoal
	M.z_original = 1
	spawn(0)
		walk_towards(M, M.dest, 1)
	return

/proc/spaceDebrisStartLoc(startSide, Z)
	var/starty
	var/startx
	switch(startSide)
		if(1) //NORTH
			starty = world.maxy-(TRANSITIONEDGE+1)
			startx = rand((TRANSITIONEDGE+1), world.maxx-(TRANSITIONEDGE+1))
		if(2) //EAST
			starty = rand((TRANSITIONEDGE+1),world.maxy-(TRANSITIONEDGE+1))
			startx = world.maxx-(TRANSITIONEDGE+1)
		if(3) //SOUTH
			starty = (TRANSITIONEDGE+1)
			startx = rand((TRANSITIONEDGE+1), world.maxx-(TRANSITIONEDGE+1))
		if(4) //WEST
			starty = rand((TRANSITIONEDGE+1), world.maxy-(TRANSITIONEDGE+1))
			startx = (TRANSITIONEDGE+1)
	var/turf/T = locate(startx, starty, Z)
	return T

/proc/spaceDebrisFinishLoc(startSide, Z)
	var/endy
	var/endx
	switch(startSide)
		if(1) //NORTH
			endy = TRANSITIONEDGE
			endx = rand(TRANSITIONEDGE, world.maxx-TRANSITIONEDGE)
		if(2) //EAST
			endy = rand(TRANSITIONEDGE, world.maxy-TRANSITIONEDGE)
			endx = TRANSITIONEDGE
		if(3) //SOUTH
			endy = world.maxy-TRANSITIONEDGE
			endx = rand(TRANSITIONEDGE, world.maxx-TRANSITIONEDGE)
		if(4) //WEST
			endy = rand(TRANSITIONEDGE,world.maxy-TRANSITIONEDGE)
			endx = world.maxx-TRANSITIONEDGE
	var/turf/T = locate(endx, endy, Z)
	return T

///////////////////////
//The meteor effect
//////////////////////

/obj/effect/meteor
	name = "the concept of meteor"
	desc = "You should probably run instead of gawking at this."
	icon = 'icons/obj/meteor.dmi'
	icon_state = "small"
	density = 1
	anchored = 1
	var/hits = 4
	var/hitpwr = 2 //Level of ex_act to be called on hit.
	var/dest
	pass_flags = PASSTABLE
	var/heavy = 0
	var/meteorsound = 'sound/effects/meteorimpact.ogg'
	var/z_original = 1

	var/meteordrop = /obj/item/weapon/ore/iron
	var/dropamt = 2

/obj/effect/meteor/Move()
	if(z != z_original || loc == dest)
		qdel(src)
		return

	. = ..() //process movement...

	if(.)//.. if did move, ram the turf we get in
		var/turf/T = get_turf(loc)
		ram_turf(T)

		if(prob(10) && !istype(T, /turf/open/space))//randomly takes a 'hit' from ramming
			get_hit()

	return .

/obj/effect/meteor/Destroy()
	walk(src,0) //this cancels the walk_towards() proc
	return ..()

/obj/effect/meteor/New()
	..()
	SpinAnimation()

/obj/effect/meteor/Bump(atom/A)
	if(A)
		ram_turf(get_turf(A))
		playsound(src.loc, meteorsound, 40, 1)
		get_hit()

/obj/effect/meteor/proc/ram_turf(turf/T)
	//first bust whatever is in the turf
	for(var/atom/A in T)
		if(A != src)
			A.ex_act(hitpwr)

	//then, ram the turf if it still exists
	if(T)
		T.ex_act(hitpwr)

//process getting 'hit' by colliding with a dense object
//or randomly when ramming turfs
/obj/effect/meteor/proc/get_hit()
	hits--
	if(hits <= 0)
		make_debris()
		meteor_effect(heavy)
		qdel(src)

/obj/effect/meteor/ex_act()
	return

/obj/effect/meteor/attackby(obj/item/weapon/W, mob/user, params)
	if(istype(W, /obj/item/weapon/pickaxe))
		qdel(src)
		return
	..()

/obj/effect/meteor/proc/make_debris()
	for(var/throws = dropamt, throws > 0, throws--)
		new meteordrop(get_turf(src))

/obj/effect/meteor/proc/meteor_effect(sound=1)
	if(sound)
		for(var/mob/M in player_list)
			var/turf/T = get_turf(M)
			if(!T || T.z != src.z)
				continue
			var/dist = get_dist(M.loc, src.loc)
			shake_camera(M, dist > 20 ? 2 : 4, dist > 20 ? 1 : 3)
			M.playsound_local(src.loc, meteorsound, 50, 1, get_rand_frequency(), 10)

///////////////////////
//Meteor types
///////////////////////

//Dust
/obj/effect/meteor/dust
	name = "space dust"
	icon_state = "dust"
	pass_flags = PASSTABLE | PASSGRILLE
	hits = 1
	hitpwr = 3
	meteorsound = 'sound/weapons/throwtap.ogg'
	meteordrop = /obj/item/weapon/ore/glass

//Medium-sized
/obj/effect/meteor/medium
	name = "meteor"
	dropamt = 3

/obj/effect/meteor/medium/meteor_effect()
	..(heavy)
	explosion(src.loc, 0, 1, 2, 3, 0)

//Large-sized
/obj/effect/meteor/big
	name = "big meteor"
	icon_state = "large"
	hits = 6
	heavy = 1
	dropamt = 4

/obj/effect/meteor/big/meteor_effect()
	..(heavy)
	explosion(src.loc, 1, 2, 3, 4, 0)

//Flaming meteor
/obj/effect/meteor/flaming
	name = "flaming meteor"
	icon_state = "flaming"
	hits = 5
	heavy = 1
	meteorsound = 'sound/effects/bamf.ogg'
	meteordrop = /obj/item/weapon/ore/plasma

/obj/effect/meteor/flaming/meteor_effect()
	..(heavy)
	explosion(src.loc, 1, 2, 3, 4, 0, 0, 5)

//Radiation meteor
/obj/effect/meteor/irradiated
	name = "glowing meteor"
	icon_state = "glowing"
	heavy = 1
	meteordrop = /obj/item/weapon/ore/uranium

/obj/effect/meteor/irradiated/meteor_effect()
	..(heavy)
	explosion(src.loc, 0, 0, 4, 3, 0)
	new /obj/effect/decal/cleanable/greenglow(get_turf(src))
	radiation_pulse(get_turf(src), 2, 5, 50, 1)

//Meaty Ore
/obj/effect/meteor/meaty
	name = "meaty ore"
	icon_state = "meateor"
	desc = "Just... don't think too hard about where this thing came from."
	hits = 2
	heavy = 1
	meteorsound = 'sound/effects/blobattack.ogg'
	meteordrop = /obj/item/weapon/reagent_containers/food/snacks/meat
	var/meteorgibs = /obj/effect/gibspawner/generic

/obj/effect/meteor/meaty/make_debris()
	..()
	new meteorgibs(get_turf(src))

/obj/effect/meteor/meaty/ram_turf(turf/T)
	if(!istype(T, /turf/open/space))
		new /obj/effect/decal/cleanable/blood (T)

/obj/effect/meteor/meaty/Bump(atom/A)
	A.ex_act(hitpwr)
	get_hit()

//Meaty Ore Xeno edition
/obj/effect/meteor/meaty/xeno
	color = "#5EFF00"
	meteordrop = /obj/item/weapon/reagent_containers/food/snacks/meat/slab/xeno
	meteorgibs = /obj/effect/gibspawner/xeno

/obj/effect/meteor/meaty/xeno/ram_turf(turf/T)
	if(!istype(T, /turf/open/space))
		new /obj/effect/decal/cleanable/xenoblood (T)

//Station buster Tunguska
/obj/effect/meteor/tunguska
	name = "tunguska meteor"
	icon_state = "flaming"
	desc = "Your life briefly passes before your eyes the moment you lay them on this monstruosity"
	hits = 30
	hitpwr = 1
	heavy = 1
	meteorsound = 'sound/effects/bamf.ogg'
	meteordrop = /obj/item/weapon/ore/plasma

/obj/effect/meteor/tunguska/meteor_effect()
	..(heavy)
	explosion(src.loc, 5, 10, 15, 20, 0)

/obj/effect/meteor/tunguska/Bump()
	..()
	if(prob(20))
		explosion(src.loc,2,4,6,8)

//////////////////////////
//Spookoween meteors
/////////////////////////

/var/list/meteorsSPOOKY = list(/obj/effect/meteor/pumpkin)

/obj/effect/meteor/pumpkin
	name = "PUMPKING"
	desc = "THE PUMPKING'S COMING!"
	icon = 'icons/obj/meteor_spooky.dmi'
	icon_state = "pumpkin"
	hits = 10
	heavy = 1
	dropamt = 1

/obj/effect/meteor/pumpkin/New()
	..()
	meteordrop = pick(/obj/item/clothing/head/hardhat/pumpkinhead, /obj/item/weapon/reagent_containers/food/snacks/grown/pumpkin)
	meteorsound = pick('sound/hallucinations/im_here1.ogg','sound/hallucinations/im_here2.ogg')
//////////////////////////


code:
/datum/game_mode
	var/abductor_teams = 0
	var/list/datum/mind/abductors = list()
	var/list/datum/mind/abductees = list()

/datum/game_mode/abduction
	name = "abduction"
	config_tag = "abduction"
	antag_flag = ROLE_ABDUCTOR
	recommended_enemies = 2
	required_players = 15
	var/max_teams = 4
	abductor_teams = 1
	var/list/datum/mind/scientists = list()
	var/list/datum/mind/agents = list()
	var/list/datum/objective/team_objectives = list()
	var/list/team_names = list()
	var/finished = 0

/datum/game_mode/abduction/announce()
	world << "The current game mode is - Abduction!"
	world << "There are alien abductors sent to [world.name] to perform nefarious experiments!"
	world << "Abductors - kidnap the crew and replace their organs with experimental ones."
	world << "Crew - don't get abducted and stop the abductors."

/datum/game_mode/abduction/pre_setup()
	abductor_teams = max(1, min(max_teams,round(num_players()/config.abductor_scaling_coeff)))
	var/possible_teams = max(1,round(antag_candidates.len / 2))
	abductor_teams = min(abductor_teams,possible_teams)

	abductors.len = 2*abductor_teams
	scientists.len = abductor_teams
	agents.len = abductor_teams
	team_objectives.len = abductor_teams
	team_names.len = abductor_teams

	for(var/i=1,i<=abductor_teams,i++)
		if(!make_abductor_team(i))
			return 0

	return 1

/datum/game_mode/abduction/proc/make_abductor_team(team_number,preset_agent=null,preset_scientist=null)
	//Team Name
	team_names[team_number] = "Mothership [pick(possible_changeling_IDs)]" //TODO Ensure unique and actual alieny names
	//Team Objective
	var/datum/objective/experiment/team_objective = new
	team_objective.team = team_number
	team_objectives[team_number] = team_objective
	//Team Members

	if(!preset_agent || !preset_scientist)
		if(antag_candidates.len <=2)
			return 0

	var/datum/mind/scientist
	var/datum/mind/agent

	if(!preset_scientist)
		scientist = pick(antag_candidates)
		antag_candidates -= scientist
	else
		scientist = preset_scientist

	if(!preset_agent)
		agent = pick(antag_candidates)
		antag_candidates -= agent
	else
		agent = preset_agent

	scientist.assigned_role = "abductor scientist"
	scientist.special_role = "abductor scientist"
	log_game("[scientist.key] (ckey) has been selected as an abductor team [team_number] scientist.")

	agent.assigned_role = "abductor agent"
	agent.special_role = "abductor agent"
	log_game("[agent.key] (ckey) has been selected as an abductor team [team_number] agent.")

	abductors |= agent
	abductors |= scientist
	scientists[team_number] = scientist
	agents[team_number] = agent
	return 1

/datum/game_mode/abduction/post_setup()
	//Spawn Team
	var/list/obj/effect/landmark/abductor/agent_landmarks = new
	var/list/obj/effect/landmark/abductor/scientist_landmarks = new
	agent_landmarks.len = max_teams
	scientist_landmarks.len = max_teams
	for(var/obj/effect/landmark/abductor/A in landmarks_list)
		if(istype(A,/obj/effect/landmark/abductor/agent))
			agent_landmarks[text2num(A.team)] = A
		else if(istype(A,/obj/effect/landmark/abductor/scientist))
			scientist_landmarks[text2num(A.team)] = A

	var/datum/mind/agent
	var/obj/effect/landmark/L
	var/datum/mind/scientist
	var/team_name
	var/mob/living/carbon/human/H
	var/datum/species/abductor/S
	for(var/team_number=1,team_number<=abductor_teams,team_number++)
		team_name = team_names[team_number]
		agent = agents[team_number]
		H = agent.current
		L = agent_landmarks[team_number]
		H.loc = L.loc
		H.set_species(/datum/species/abductor)
		S = H.dna.species
		S.agent = 1
		S.team = team_number
		H.real_name = team_name + " Agent"
		equip_common(H,team_number)
		equip_agent(H,team_number)
		greet_agent(agent,team_number)

		scientist = scientists[team_number]
		H = scientist.current
		L = scientist_landmarks[team_number]
		H.loc = L.loc
		H.set_species(/datum/species/abductor)
		S = H.dna.species
		S.scientist = 1
		S.team = team_number
		H.real_name = team_name + " Scientist"
		equip_common(H,team_number)
		equip_scientist(H,team_number)
		greet_scientist(scientist,team_number)
	return ..()

//Used for create antag buttons
/datum/game_mode/abduction/proc/post_setup_team(team_number)
	var/list/obj/effect/landmark/abductor/agent_landmarks = new
	var/list/obj/effect/landmark/abductor/scientist_landmarks = new
	agent_landmarks.len = max_teams
	scientist_landmarks.len = max_teams
	for(var/obj/effect/landmark/abductor/A in landmarks_list)
		if(istype(A,/obj/effect/landmark/abductor/agent))
			agent_landmarks[text2num(A.team)] = A
		else if(istype(A,/obj/effect/landmark/abductor/scientist))
			scientist_landmarks[text2num(A.team)] = A

	var/datum/mind/agent
	var/obj/effect/landmark/L
	var/datum/mind/scientist
	var/team_name
	var/mob/living/carbon/human/H
	var/datum/species/abductor/S

	team_name = team_names[team_number]
	agent = agents[team_number]
	H = agent.current
	L = agent_landmarks[team_number]
	H.loc = L.loc
	H.set_species(/datum/species/abductor)
	S = H.dna.species
	S.agent = 1
	S.team = team_number
	H.real_name = team_name + " Agent"
	equip_common(H,team_number)
	equip_agent(H,team_number)
	greet_agent(agent,team_number)

	scientist = scientists[team_number]
	H = scientist.current
	L = scientist_landmarks[team_number]
	H.loc = L.loc
	H.set_species(/datum/species/abductor)
	S = H.dna.species
	S.scientist = 1
	S.team = team_number
	H.real_name = team_name + " Scientist"
	equip_common(H,team_number)
	equip_scientist(H,team_number)
	greet_scientist(scientist,team_number)

/datum/game_mode/abduction/proc/greet_agent(datum/mind/abductor,team_number)
	abductor.objectives += team_objectives[team_number]
	var/team_name = team_names[team_number]

	abductor.current << "You are an agent of [team_name]!"
	abductor.current << "With the help of your teammate, kidnap and experiment on station crew members!"
	abductor.current << "Use your stealth technology and equipment to incapacitate humans for your scientist to retrieve."

	var/obj_count = 1
	for(var/datum/objective/objective in abductor.objectives)
		abductor.current << "Objective #[obj_count]: [objective.explanation_text]"
		obj_count++
	return

/datum/game_mode/abduction/proc/greet_scientist(datum/mind/abductor,team_number)
	abductor.objectives += team_objectives[team_number]
	var/team_name = team_names[team_number]

	abductor.current << "You are a scientist of [team_name]!"
	abductor.current << "With the help of your teammate, kidnap and experiment on station crew members!"
	abductor.current << "Use your tool and ship consoles to support the agent and retrieve human specimens."

	var/obj_count = 1
	for(var/datum/objective/objective in abductor.objectives)
		abductor.current << "Objective #[obj_count]: [objective.explanation_text]"
		obj_count++
	return

/datum/game_mode/abduction/proc/equip_common(mob/living/carbon/human/agent,team_number)
	var/radio_freq = SYND_FREQ

	var/obj/item/device/radio/R = new /obj/item/device/radio/headset/syndicate/alt(agent)
	R.set_frequency(radio_freq)
	agent.equip_to_slot_or_del(R, slot_ears)
	agent.equip_to_slot_or_del(new /obj/item/clothing/shoes/combat(agent), slot_shoes)
	agent.equip_to_slot_or_del(new /obj/item/clothing/under/color/grey(agent), slot_w_uniform) //they're greys gettit
	agent.equip_to_slot_or_del(new /obj/item/weapon/storage/backpack(agent), slot_back)

/datum/game_mode/abduction/proc/get_team_console(team)
	var/obj/machinery/abductor/console/console
	for(var/obj/machinery/abductor/console/c in machines)
		if(c.team == team)
			console = c
			break
	return console

/datum/game_mode/abduction/proc/equip_agent(mob/living/carbon/human/agent,team_number)
	if(!team_number)
		var/datum/species/abductor/S = agent.dna.species
		team_number = S.team

	var/obj/machinery/abductor/console/console = get_team_console(team_number)
	var/obj/item/clothing/suit/armor/abductor/vest/V = new /obj/item/clothing/suit/armor/abductor/vest(agent)
	if(console!=null)
		console.vest = V
		V.flags |= NODROP
	agent.equip_to_slot_or_del(V, slot_wear_suit)
	agent.equip_to_slot_or_del(new /obj/item/weapon/abductor_baton(agent), slot_in_backpack)
	agent.equip_to_slot_or_del(new /obj/item/weapon/gun/energy/alien(agent), slot_belt)
	agent.equip_to_slot_or_del(new /obj/item/device/abductor/silencer(agent), slot_in_backpack)
	agent.equip_to_slot_or_del(new /obj/item/clothing/head/helmet/abductor(agent), slot_head)

/datum/game_mode/abduction/proc/equip_scientist(var/mob/living/carbon/human/scientist,var/team_number)
	if(!team_number)
		var/datum/species/abductor/S = scientist.dna.species
		team_number = S.team

	var/obj/machinery/abductor/console/console = get_team_console(team_number)
	var/obj/item/device/abductor/gizmo/G = new /obj/item/device/abductor/gizmo(scientist)
	if(console!=null)
		console.gizmo = G
		G.console = console
	scientist.equip_to_slot_or_del(G, slot_in_backpack)

	var/obj/item/weapon/implant/abductor/beamplant = new /obj/item/weapon/implant/abductor(scientist)
	beamplant.implant(scientist)

/datum/game_mode/abduction/check_finished()
	if(!finished)
		for(var/team_number=1,team_number<=abductor_teams,team_number++)
			var/obj/machinery/abductor/console/con = get_team_console(team_number)
			var/datum/objective/objective = team_objectives[team_number]
			if (con.experiment.points >= objective.target_amount)
				SSshuttle.emergency.request(null, 0.5)
				finished = 1
				return ..()
	return ..()

/datum/game_mode/abduction/declare_completion()
	for(var/team_number=1,team_number<=abductor_teams,team_number++)
		var/obj/machinery/abductor/console/console = get_team_console(team_number)
		var/datum/objective/objective = team_objectives[team_number]
		var/team_name = team_names[team_number]
		if(console.experiment.points >= objective.target_amount)
			world << "[team_name] team fullfilled its mission!"
		else
			world << "[team_name] team failed its mission."
	..()
	return 1

/datum/game_mode/proc/auto_declare_completion_abduction()
	var/text = ""
	if(abductors.len)
		text += "
The abductors were:"
		for(var/datum/mind/abductor_mind in abductors)
			text += printplayer(abductor_mind)
			text += printobjectives(abductor_mind)
		text += "
"
		if(abductees.len)
			text += "
The abductees were:"
			for(var/datum/mind/abductee_mind in abductees)
				text += printplayer(abductee_mind)
				text += printobjectives(abductee_mind)
	text += "
"
	world << text

//Landmarks
// TODO: Split into seperate landmarks for prettier ships
/obj/effect/landmark/abductor
	var/team = 1

/obj/effect/landmark/abductor/console/New()
	var/obj/machinery/abductor/console/c = new /obj/machinery/abductor/console(src.loc)
	c.team = team

	spawn(5) // I'd do this properly when i got some time, temporary hack for mappers
		c.Initialize()
	qdel(src)

/obj/effect/landmark/abductor/agent
/obj/effect/landmark/abductor/scientist

// OBJECTIVES
/datum/objective/experiment
	dangerrating = 10
	target_amount = 6
	var/team

/datum/objective/experiment/New()
	explanation_text = "Experiment on [target_amount] humans."

/datum/objective/experiment/check_completion()
	var/ab_team = team
	if(owner)
		if(!owner.current || !ishuman(owner.current))
			return 0
		var/mob/living/carbon/human/H = owner.current
		if(H.dna.species.id != "abductor")
			return 0
		var/datum/species/abductor/S = H.dna.species
		ab_team = S.team
	for(var/obj/machinery/abductor/experiment/E in machines)
		if(E.team == ab_team)
			if(E.points >= target_amount)
				return 1
			else
				return 0
	return 0

/datum/game_mode/proc/update_abductor_icons_added(datum/mind/alien_mind)
	var/datum/atom_hud/antag/hud = huds[ANTAG_HUD_ABDUCTOR]
	hud.join_hud(alien_mind.current)
	set_antag_hud(alien_mind.current, ((alien_mind in abductors) ? "abductor" : "abductee"))

/datum/game_mode/proc/update_abductor_icons_removed(datum/mind/alien_mind)
	var/datum/atom_hud/antag/hud = huds[ANTAG_HUD_ABDUCTOR]
	hud.leave_hud(alien_mind.current)
	set_antag_hud(alien_mind.current, null)

/datum/objective/abductee
	dangerrating = 5
	completed = 1

/datum/objective/abductee/steal
	explanation_text = "Steal all"

/datum/objective/abductee/steal/New()
	var/target = pick(list("pets","lights","monkeys","fruits","shoes","bars of soap"))
	explanation_text+=" [target]."

/datum/objective/abductee/capture
	explanation_text = "Capture"

/datum/objective/abductee/capture/New()
	var/list/jobs = SSjob.occupations.Copy()
	for(var/datum/job/J in jobs)
		if(J.current_positions < 1)
			jobs -= J
	if(jobs.len > 0)
		var/datum/job/target = pick(jobs)
		explanation_text += " a [target.title]."
	else
		explanation_text += " someone."

/datum/objective/abductee/shuttle
	explanation_text = "You must escape the station! Get the shuttle called!"

/datum/objective/abductee/noclone
	explanation_text = "Don't allow anyone to be cloned."

/datum/objective/abductee/oxygen
	explanation_text = "The oxygen is killing them all and they don't even know it. Make sure no oxygen is on the station."

/datum/objective/abductee/blazeit
	explanation_text = "Your body must be improved. Ingest as many drugs as you can."

/datum/objective/abductee/yumyum
	explanation_text = "You are hungry. Eat as much food as you can find."

/datum/objective/abductee/insane
	explanation_text = "You see you see what they cannot you see the open door you seeE you SEeEe you SEe yOU seEee SHOW THEM ALL"

/datum/objective/abductee/cannotmove
	explanation_text = "Convince the crew that you are a paraplegic."

/datum/objective/abductee/deadbodies
	explanation_text = "Start a collection of corpses. Don't kill people to get these corpses."

/datum/objective/abductee/floors
	explanation_text = "Replace all the floor tiles with carpeting, wooden boards, or grass."

/datum/objective/abductee/POWERUNLIMITED
	explanation_text = "Flood the station's powernet with as much electricity as you can."

/datum/objective/abductee/pristine
	explanation_text = "Ensure the station is in absolutely pristine condition."

/datum/objective/abductee/window
	explanation_text = "Replace all normal windows with reinforced windows."

/datum/objective/abductee/nations
	explanation_text = "Ensure your department prospers over all else."

/datum/objective/abductee/abductception
	explanation_text = "You have been changed forever. Find the ones that did this to you and give them a taste of their own medicine."

/datum/objective/abductee/ghosts
	explanation_text = "Conduct a seance with the spirits of the afterlife."

/datum/objective/abductee/summon
	explanation_text = "Conduct a ritual to summon an elder god."

/datum/objective/abductee/machine
	explanation_text = "You are secretly an android. Interface with as many machines as you can to boost your own power."

/datum/objective/abductee/prevent
	explanation_text = "You have been enlightened. This knowledge must not escape. Ensure nobody else can become enlightened."

/datum/objective/abductee/calling
	explanation_text = "Call forth a spirit from the other side."

/datum/objective/abductee/calling/New()
	var/mob/dead/D = pick(dead_mob_list)
	if(D)
		explanation_text = "You know that [D] has perished. Call them from the spirit realm."

/datum/objective/abductee/social_experiment
	explanation_text = "This is a secret social experiment conducted by Nanotrasen. Convince the crew that this is the truth."

/datum/objective/abductee/vr
	explanation_text = "It's all an entirely virtual simulation within an underground vault. Convince the crew to escape the shackles of VR."

/datum/objective/abductee/pets
	explanation_text = "Nanotrasen is abusing the animals! Save as many as you can!"

/datum/objective/abductee/defect
	explanation_text = "Defect from your employer."

/datum/objective/abductee/promote
	explanation_text = "Climb the corporate ladder all the way to the top!"

/datum/objective/abductee/science
	explanation_text = "So much lies undiscovered. Look deeper into the machinations of the universe."

/datum/objective/abductee/build
	explanation_text = "Expand the station."

/datum/objective/abductee/pragnant
	explanation_text = "You are pregnant and soon due. Find a safe place to deliver your baby."