* outside code stuff * defines, helpers, etc * everything not module * modules * compiled fixes + missing sounds
103 lines
3.1 KiB
Plaintext
103 lines
3.1 KiB
Plaintext
/datum/game_mode/traitor/double_agents
|
|
name = "double agents"
|
|
config_tag = "double_agents"
|
|
required_players = 25
|
|
required_enemies = 5
|
|
recommended_enemies = 8
|
|
reroll_friendly = 0
|
|
|
|
traitors_possible = 10 //hard limit on traitors if scaling is turned off
|
|
num_modifier = 4 // Four additional traitors
|
|
|
|
announce_text = "There are double agents trying to kill each other!\n\
|
|
<span class='danger'>Traitors</span>: Eliminate your targets and protect yourself!\n\
|
|
<span class='notice'>Crew</span>: Stop the double agents before they can cause too much mayhem."
|
|
|
|
var/list/target_list = list()
|
|
var/list/late_joining_list = list()
|
|
|
|
/datum/game_mode/traitor/double_agents/post_setup()
|
|
var/i = 0
|
|
for(var/datum/mind/traitor in traitors)
|
|
i++
|
|
if(i + 1 > traitors.len)
|
|
i = 0
|
|
target_list[traitor] = traitors[i + 1]
|
|
..()
|
|
|
|
/datum/game_mode/traitor/double_agents/forge_traitor_objectives(datum/mind/traitor)
|
|
|
|
if(target_list.len && target_list[traitor]) // Is a double agent
|
|
|
|
// Assassinate
|
|
var/datum/mind/target_mind = target_list[traitor]
|
|
if(issilicon(target_mind.current))
|
|
var/datum/objective/destroy/destroy_objective = new
|
|
destroy_objective.owner = traitor
|
|
destroy_objective.target = target_mind
|
|
destroy_objective.update_explanation_text()
|
|
traitor.objectives += destroy_objective
|
|
else
|
|
var/datum/objective/assassinate/kill_objective = new
|
|
kill_objective.owner = traitor
|
|
kill_objective.target = target_mind
|
|
kill_objective.update_explanation_text()
|
|
traitor.objectives += kill_objective
|
|
|
|
// Escape
|
|
if(issilicon(traitor.current))
|
|
var/datum/objective/survive/survive_objective = new
|
|
survive_objective.owner = traitor
|
|
traitor.objectives += survive_objective
|
|
else
|
|
var/datum/objective/escape/escape_objective = new
|
|
escape_objective.owner = traitor
|
|
traitor.objectives += escape_objective
|
|
|
|
else
|
|
..() // Give them standard objectives.
|
|
return
|
|
|
|
/datum/game_mode/traitor/double_agents/add_latejoin_traitor(datum/mind/character)
|
|
|
|
check_potential_agents()
|
|
|
|
// As soon as we get 3 or 4 extra latejoin traitors, make them traitors and kill each other.
|
|
if(late_joining_list.len >= rand(3, 4))
|
|
// True randomness
|
|
shuffle_inplace(late_joining_list)
|
|
// Reset the target_list, it'll be used again in force_traitor_objectives
|
|
target_list = list()
|
|
|
|
// Basically setting the target_list for who is killing who
|
|
var/i = 0
|
|
for(var/datum/mind/traitor in late_joining_list)
|
|
i++
|
|
if(i + 1 > late_joining_list.len)
|
|
i = 0
|
|
target_list[traitor] = late_joining_list[i + 1]
|
|
traitor.special_role = traitor_name
|
|
|
|
// Now, give them their targets
|
|
for(var/datum/mind/traitor in target_list)
|
|
..(traitor)
|
|
|
|
late_joining_list = list()
|
|
else
|
|
late_joining_list += character
|
|
return
|
|
|
|
/datum/game_mode/traitor/double_agents/proc/check_potential_agents()
|
|
|
|
for(var/M in late_joining_list)
|
|
if(istype(M, /datum/mind))
|
|
var/datum/mind/agent_mind = M
|
|
if(ishuman(agent_mind.current))
|
|
var/mob/living/carbon/human/H = agent_mind.current
|
|
if(H.stat != DEAD)
|
|
if(H.client)
|
|
continue // It all checks out.
|
|
|
|
// If any check fails, remove them from our list
|
|
late_joining_list -= M
|