//[00:45] AngriestIBM Let me generate a round backstory in 5 seconds: This is how the syndicate determines who gets higher ranking positions -- by handing the candidates quad-injectors of mindslaves and having them fight to the death
// Idea: each leader gets a unique goofy experimental piece of equipment, traitor gear that needs field testing (Or worse)
// ex: bottle of corrosive fermid oil, OmegaFlash (field effect turboflash), etc
// like the R&D stuff in paranoia
/datum/game_mode/spy
name = "conspiracy"
config_tag = "spy"
var/list/leaders = list()
var/list/spies = list()
var/const/setup_min_teams = 4
var/const/setup_max_teams = 6
var/const/waittime_l = 600 //lower bound on time before intercept arrives (in tenths of seconds)
var/const/waittime_h = 1800 //upper bound on time before intercept arrives (in tenths of seconds)
/datum/game_mode/spy/announce()
boutput(world, "The current game mode is - Conspiracy!")
boutput(world, "The Syndicate is using the station as a battleground to train elite operatives!")
/datum/game_mode/spy/pre_setup()
var/list/leaders_possible = get_possible_leaders()
if (!leaders_possible.len)
return 0
var/num_players = 0
for(var/mob/new_player/player in mobs)
if(player.client && player.ready) num_players++
var/i = rand(5)
var/num_teams = max(setup_min_teams, min(round((num_players + i) / 7), setup_max_teams))
if (num_teams > leaders_possible.len)
num_teams = leaders_possible.len
for(var/j = 0, j < num_teams, j++)
var/datum/mind/leader = pick(leaders_possible)
leaders += leader
leaders_possible.Remove(leader)
leader.special_role = "Spy"
return 1
/datum/game_mode/spy/post_setup()
for (var/datum/mind/leaderMind in leaders)
if (!leaderMind.current)
continue
var/datum/objective/specialist/conspiracy/spyObjective = bestow_objective(leaderMind,/datum/objective/specialist/conspiracy)
spyObjective = bestow_objective(leaderMind, pick(/datum/objective/escape, /datum/objective/escape/survive)) // They have to stay alive, dunno why dying a glorious death was a possible objective.
switch(rand(1, ((leaderMind.assigned_role in list("Captain","Head of Personnel","Head of Security","Chief Engineer","Research Director")) ? 3 : 4) ))
if (1)
spyObjective = bestow_objective(leaderMind,/datum/objective/regular/assassinate)
if (2)
spyObjective = bestow_objective(leaderMind,/datum/objective/regular/aikill)
if (3)
spyObjective = bestow_objective(leaderMind,/datum/objective/regular/borgdeath)
if (4)
spyObjective = bestow_objective(leaderMind,/datum/objective/regular/steal)
leaderMind.current << browse(grabResource("html/traitorTips/spyTips.html"),"window=antagTips;titlebar=1;size=600x400;can_minimize=0;can_resize=0")
boutput(leaderMind.current, "Oh yes, and one more thing: [spyObjective.explanation_text] That is, if you really want that new position.")
equip_leader(leaderMind.current)
spawn (rand(waittime_l, waittime_h))
send_intercept()
/datum/game_mode/spy/send_intercept()
var/intercepttext = "Cent. Com. Update Requested staus information:
"
intercepttext += " Cent. Com has recently been contacted by the following syndicate affiliated organisations in your area, please investigate any information you may have:"
var/list/possible_modes = list("revolution", "wizard", "nuke", "traitor", "changeling")
var/number = pick(2, 3)
var/i = 0
for(i = 0, i < number, i++)
possible_modes.Remove(pick(possible_modes))
possible_modes.Insert(rand(possible_modes.len), "[ticker.mode]")
var/datum/intercept_text/i_text = new /datum/intercept_text
for(var/A in possible_modes)
intercepttext += i_text.build(A, pick(leaders))
for (var/obj/machinery/communications_dish/C in machines)
C.add_centcom_report("Cent. Com. Status Summary", intercepttext)
command_alert("Summary downloaded and printed out at all communications consoles.", "Enemy communication intercept. Security Level Elevated.")
/datum/game_mode/spy/proc/equip_leader(mob/living/carbon/human/leader)
if (!istype(leader))
return
//equip_traitor(leader) <- Quad mindslaves and the starter gear are more than sufficient. Spies really don't need a traitor uplink on top of that.
var/the_slot = null
if (istype(leader.back, /obj/item/storage/) && leader.back.contents.len < 7)
leader.equip_if_possible(new /obj/item/storage/box/spykit(leader), leader.slot_in_backpack)
the_slot = "backpack"
else
var/obj/K2 = new /obj/item/storage/box/spykit(get_turf(leader))
leader.put_in_hand_or_drop(K2)
the_slot = "hand"
boutput(leader, "You've been supplied with a special quad-use implanter in the spy starter kit in your [!isnull(the_slot) ? "[the_slot]" : "UNKNOWN"]. Use it to recruit some mindslaved henchmen!")
return
/datum/game_mode/spy/proc/add_spy(mob/living/new_spy, mob/living/leader)
if (!new_spy || !leader || !new_spy.mind || !leader.mind)
return 0
var/datum/mind/spymind = new_spy.mind
var/datum/mind/leadermind = leader.mind
if (spymind in src.spies)
if (leadermind != src.spies[spymind])
src.spies[spymind] = leadermind
return 1
return 0
src.spies.Add(spymind)
src.spies[spymind] = leadermind
spymind.special_role = "spyslave"
spymind.master = leader.ckey
return 1
/datum/game_mode/spy/proc/remove_spy(mob/living/spy)
src.spies.Remove(spy)
spy.mind.special_role = null
spy.mind.master = null
return 1
/datum/game_mode/spy/proc/get_possible_leaders()
var/list/candidates = list()
for(var/mob/new_player/player in mobs)
if (ishellbanned(player)) continue //No treason for you
if ((player.client) && (player.ready) && !(player.mind in leaders) && !(player.mind in token_players) && !candidates.Find(player.mind))
if(player.client.preferences.be_spy)
candidates += player.mind
if(candidates.len < 1)
logTheThing("debug", null, null, "Enemy Assignment: Not enough players with be_spy set to yes, so we're adding players who don't want to be spy leaders to the pool.")
for(var/mob/new_player/player in mobs)
if (ishellbanned(player)) continue //No treason for you
if ((player.client) && (player.ready) && !(player.mind in leaders) && !(player.mind in token_players) && !candidates.Find(player.mind))
candidates += player.mind
if(candidates.len < 1)
return list()
else
return candidates
/datum/game_mode/spy/declare_completion()
var/text = ""
boutput(world, "The infiltrators were: ")
var/datum/mind/potential_winner = null
var/survived_count = 0
for(var/datum/mind/leader_mind in leaders)
text = ""
if(leader_mind.current)
text += "[leader_mind.current.real_name]"
var/turf/T = get_turf_loc(leader_mind.current)
if(leader_mind.current.stat == 2)
text += " (Dead)"
else
text += " (Survived!)"
survived_count++
if (T.z == 2)
var/all_complete = 1
for (var/datum/objective/O in leader_mind.objectives)
if (istype(O, /datum/objective/specialist/conspiracy))
continue
if (O.check_completion() != 1)
all_complete = 0
break
if (isnull(potential_winner) && all_complete)
potential_winner = leader_mind
else
text += "[leader_mind.key] (character destroyed)"
boutput(world, text)
if (istype(potential_winner) && potential_winner.current && (survived_count == 1))
boutput(world, "