Game folder

This commit is contained in:
Poojawa
2018-09-11 04:06:45 -05:00
parent b6430559e9
commit 8b9ef1e400
270 changed files with 3120 additions and 2523 deletions
+152
View File
@@ -0,0 +1,152 @@
// This is a point based objective. You can only lose if you fail to even handle one single command personnel, else you win. But, if you win, you're given a certain number of points,
// based on the role of the head (Captain, HoP/HoS, other heads, warden, security officers) and whether you converted them, exiled or just killed (applying a modifier of 1.5, 1 and 0.5 respectively)
// because this is meant for the overthrow gamemode, which is a bloodless coup, unlike revs.
// Point system:
// Base points for each role:
// AI, Captain = 5;
// Head of Personnel, Head of Security, target = 4;
// Chief Engineer, Chief Medical Officer, Research Director = 3;
// Modifiers:
// Converting: 1.5 for the converting team, 1 for all the other ones;
// Exiling: 1;
// Killing: 0.5
#define CAPPTS 5
#define AIPTS 5
#define HOPPTS 4
#define HOSPTS 4
#define TARGETPTS 4
#define CEPTS 3
#define CMOPTS 3
#define RDPTS 3
#define CONVERTED_OURS 1.5
#define CONVERTED 1
#define EXILED 1
#define KILLED 0.5
// Parent type holding the get_points proc used for round end log.
/datum/objective/overthrow
/datum/objective/overthrow/check_completion()
return get_points() ? TRUE : FALSE
/datum/objective/overthrow/proc/get_points()
return 0 // int, not bool
/datum/objective/overthrow/proc/result_points(datum/mind/the_dude, base_points) // App
var/initial_points = base_points
if(the_dude)
var/datum/antagonist/overthrow/O = the_dude.has_antag_datum(/datum/antagonist/overthrow)
if(!the_dude.current || the_dude.current.stat == DEAD)
initial_points *= KILLED
else if(!is_station_level(the_dude.current.z) && !is_centcom_level(the_dude.current.z)) // exiled.
initial_points *= EXILED
else if(O)
initial_points *= CONVERTED
if(team == O.team)
initial_points *= CONVERTED_OURS
else
initial_points = 0
else
initial_points = 0
return initial_points
// Heads overthrow objective. This targets the heads only, assigning points based on the rank of the head, captain being the highest target.
/datum/objective/overthrow/heads
var/list/targets = list() // We want one objective for all the heads, instead of 1 objective per head like how it's done for revs, because you don't lose if you get atleast one head.
// Also, this is an associative list, target = role. Modifiers (defines) are applied on points calculation at round end.
/datum/objective/overthrow/heads/proc/find_targets()
var/list/datum/mind/owners = get_owners()
for(var/datum/mind/possible_target in get_crewmember_minds()) // i would use SSjob.get_all_heads() but jesus christ that proc's shit, i ain't using it
if(!(possible_target in owners) && ishuman(possible_target.current))
if(possible_target.assigned_role in GLOB.command_positions)
targets[possible_target] = possible_target.assigned_role
update_explanation_text()
/datum/objective/overthrow/heads/update_explanation_text()
if(targets.len)
explanation_text = "Work with your team to convert, exile or kill "
explanation_text += english_list(targets)
explanation_text += ". Converting to your team will give you more points, whereas killing will give you the least. Syndicates don't want to stir up too many troubles."
else
explanation_text = "Wait until any heads arrive. Once that happens, check your objectives again to see the updated objective. It may require around [OBJECTIVE_UPDATING_TIME] seconds to update."
/datum/objective/overthrow/heads/check_completion()
if(!targets.len)
return TRUE
. = ..()
// Amount of points = foreach head, result += head basepoints * modifier.
/datum/objective/overthrow/heads/get_points()
var/base_points = 0
for(var/i in targets)
var/datum/mind/M = i
if(M)
var/target_points
var/role = targets[M]
switch(role)
if("Captain")
target_points = CAPPTS
if("Head of Personnel")
target_points = HOPPTS
if("Head of Security")
target_points = HOSPTS
if("Chief Engineer")
target_points = CEPTS
if("Research Director")
target_points = RDPTS
if("Chief Medical Officer")
target_points = CMOPTS
base_points += result_points(M, target_points)
return base_points
// AI converting objective. The team who managed to convert the AI with the overthrow module gets the normal 1.5x boost.
/datum/objective/overthrow/AI
explanation_text = "Enslave the AIs to your team using the special AI module board in your storage implant. It is required you use said module."
/datum/objective/overthrow/AI/get_points() // If you simply kill the Ai you get nothing, you need it to overthrow the heads.
. = 0 // Support for multiple AIs. More AIs means more control over the station.
for(var/i in GLOB.ai_list)
var/mob/living/silicon/ai/AI = i
if(AI.mind)
var/datum/mind/M = AI.mind
var/datum/antagonist/overthrow/O = M.has_antag_datum(/datum/antagonist/overthrow)
if(M)
. += (O.team == team) ? AIPTS*CONVERTED_OURS : AIPTS
/datum/objective/overthrow/AI/update_explanation_text()
if(!GLOB.ai_list.len)
explanation_text = "Nothing."
else
explanation_text = "Enslave the AIs to your team using the special AI module board in your storage implant. It is required you use said module."
/datum/objective/overthrow/AI/check_completion()
if(!GLOB.ai_list.len)
return TRUE
. = ..()
// Overthrow target objective. A crewmember in particular has a certain bond with some centcom officials, and the Syndicate want you to target him in particular, even though he's not a head.
/datum/objective/overthrow/target
/datum/objective/overthrow/target/update_explanation_text()
if(target)
explanation_text = "Work with your team to convert, exile or kill [target.name], the [target.assigned_role]. Converting to your team will give you more points, whereas killing will give you the least. Syndicates don't want to stir up too many troubles."
else
explanation_text = "Nothing."
/datum/objective/overthrow/target/is_unique_objective(datum/mind/possible_target)
if(possible_target.assigned_role in GLOB.command_positions)
return FALSE
return TRUE
/datum/objective/overthrow/target/check_completion()
if(!target)
return TRUE
. = ..()
/datum/objective/overthrow/target/get_points()
return result_points(target, TARGETPTS)
@@ -0,0 +1,76 @@
// Overthrow gamemode, based on the sleeping agent antagonist.
/datum/game_mode/overthrow
name = "overthrow"
config_tag = "overthrow"
antag_flag = ROLE_OVERTHROW
restricted_jobs = list("Security Officer", "Warden", "Detective", "AI", "Cyborg","Captain", "Head of Personnel", "Head of Security", "Chief Engineer", "Research Director", "Chief Medical Officer")
required_players = 20 // the core idea is of a swift, bloodless coup, so it shouldn't be as chaotic as revs.
required_enemies = 2 // minimum two teams, otherwise it's just nerfed revs.
recommended_enemies = 4
announce_span = "danger"
announce_text = "There are sleeping Syndicate agents on the station who are trying to stage a coup!\n\
<span class='danger'>Agents</span>: Accomplish your objectives, convert heads and targets, take control of the AI.\n\
<span class='notice'>Crew</span>: Do not let the agents succeed!"
var/list/initial_agents = list() // Why doesn't this exist at /game_mode level? Literally every gamemode has some sort of version for this, what the fuck
/datum/game_mode/overthrow/pre_setup()
if(CONFIG_GET(flag/protect_roles_from_antagonist))
restricted_jobs += protected_jobs
if(CONFIG_GET(flag/protect_assistant_from_antagonist))
restricted_jobs += "Assistant"
var/sleeping_agents = required_enemies + round(num_players()*0.05) // At 100 players, it'd be 2 + 5 = 7 teams existing.
for (var/i in 1 to sleeping_agents)
if (!antag_candidates.len)
break
var/datum/mind/sleeping_agent = antag_pick(antag_candidates)
antag_candidates -= sleeping_agent
initial_agents += sleeping_agent
sleeping_agent.restricted_roles = restricted_jobs
sleeping_agent.special_role = ROLE_OVERTHROW
if(initial_agents.len < required_enemies)
setup_error = "Not enough initial sleeping agents candidates"
return FALSE
return TRUE
/datum/game_mode/overthrow/post_setup()
for(var/i in initial_agents) // each agent will have its own team.
var/datum/mind/agent = i
var/datum/antagonist/overthrow/O = agent.add_antag_datum(/datum/antagonist/overthrow) // create_team called on_gain will create the team
O.equip_initial_overthrow_agent()
return ..()
/datum/game_mode/overthrow/generate_report()
return "Some sleeping agents have managed to get aboard. Their objective is to stage a coup and take over the station stealthly."
// Calculates points for each team and displays the winners.
/datum/game_mode/overthrow/special_report() // so many for loops, I am deeply sorry
var/list/teams = list()
for(var/datum/antagonist/overthrow/I in GLOB.antagonists)
var/datum/team/overthrow/Oteam = I.team
if(istype(Oteam)) // same
teams |= Oteam
var/max_points = 0 // the maximum amount of points reached
for(var/j in teams)
var/datum/team/T = j
var/points = 0 // Sum of points of all the objectives done
for(var/k in T.objectives)
var/datum/objective/overthrow/obj = k
if(istype(obj))
points += obj.get_points()
if(max_points < points)
max_points = points
teams[T] = points
// Now we will have a list of team=points and a max_points var. Let's fetch all the teams with points=maxpoints and display them as winner. This code allows multiple teams to win if they both achieved
// the same amount of points and they got the most points out of all the teams.
var/list/winners = list()
for(var/l in teams)
var/datum/team/Tagain = l
if(teams[Tagain] == max_points)
winners += Tagain.name
return "<span class='greentext big'>The [english_list(winners)] team[winners.len > 1 ? "s tied" : " won"] with [max_points] points!</span>"