Skip to content

Commit

Permalink
[READY] A victory for revolutionaries will no longer end the round on…
Browse files Browse the repository at this point in the history
… dynamic, instead no new security and command will be allowed to join (#55956)

Currently, a victory for revoutionaries leads to the round abruptly ending on dynamic. This has been replaced by all revolutionaries being deconverted, and no new security or command positions being available.

Also attempts to unionize (pun intended) copy and paste code in the round start and late join revolutionary rulesets into being handled under the revolutionary team instead.
  • Loading branch information
Mothblocks committed Jan 12, 2021
1 parent fa3cda7 commit a4c61a3
Show file tree
Hide file tree
Showing 13 changed files with 186 additions and 128 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/role_preferences.dm
Expand Up @@ -14,6 +14,7 @@
#define ROLE_MALF "Malf AI"
#define ROLE_REV "Revolutionary"
#define ROLE_REV_HEAD "Head Revolutionary"
#define ROLE_REV_SUCCESSFUL "Victorious Revolutionary"
#define ROLE_ALIEN "Xenomorph"
#define ROLE_PAI "pAI"
#define ROLE_CULTIST "Cultist"
Expand Down
2 changes: 2 additions & 0 deletions code/controllers/subsystem/job.dm
Expand Up @@ -30,11 +30,13 @@ SUBSYSTEM_DEF(job)
var/datum/job/new_overflow = GetJob(new_overflow_role)
var/cap = CONFIG_GET(number/overflow_cap)

new_overflow.allow_bureaucratic_error = FALSE
new_overflow.spawn_positions = cap
new_overflow.total_positions = cap

if(new_overflow_role != overflow_role)
var/datum/job/old_overflow = GetJob(overflow_role)
old_overflow.allow_bureaucratic_error = initial(old_overflow.allow_bureaucratic_error)
old_overflow.spawn_positions = initial(old_overflow.spawn_positions)
old_overflow.total_positions = initial(old_overflow.total_positions)
overflow_role = new_overflow_role
Expand Down
3 changes: 3 additions & 0 deletions code/datums/mind.dm
Expand Up @@ -80,6 +80,9 @@
///Skill multiplier list, just slap your multiplier change onto this with the type it is coming from as key.
var/list/experience_multiplier_reasons = list()

/// A lazy list of statuses to add next to this mind in the traitor panel
var/list/special_statuses

/datum/mind/New(_key)
key = _key
martial_art = default_martial_art
Expand Down
7 changes: 0 additions & 7 deletions code/game/gamemodes/dynamic/dynamic.dm
Expand Up @@ -190,10 +190,6 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)

// Checks if there are HIGHLANDER_RULESETs and calls the rule's round_result() proc
/datum/game_mode/dynamic/set_round_result()
for(var/datum/dynamic_ruleset/rule in executed_rules)
if(rule.flags & HIGHLANDER_RULESET)
if(rule.check_finished()) // Only the rule that actually finished the round sets round result.
return rule.round_result()
// If it got to this part, just pick one highlander if it exists
for(var/datum/dynamic_ruleset/rule in executed_rules)
if(rule.flags & HIGHLANDER_RULESET)
Expand Down Expand Up @@ -250,9 +246,6 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1)
return TRUE
if(force_ending)
return TRUE
for(var/datum/dynamic_ruleset/rule in executed_rules)
if(rule.flags & HIGHLANDER_RULESET)
return rule.check_finished()

/datum/game_mode/dynamic/proc/show_threatlog(mob/admin)
if(!SSticker.HasRoundStarted())
Expand Down
5 changes: 0 additions & 5 deletions code/game/gamemodes/dynamic/dynamic_rulesets.dm
Expand Up @@ -182,11 +182,6 @@
/// Only called if ruleset is flagged as HIGHLANDER_RULESET
/datum/dynamic_ruleset/proc/round_result()

/// Checks if round is finished, return true to end the round.
/// Only called if ruleset is flagged as HIGHLANDER_RULESET
/datum/dynamic_ruleset/proc/check_finished()
return FALSE

//////////////////////////////////////////////
// //
// ROUNDSTART RULESETS //
Expand Down
58 changes: 9 additions & 49 deletions code/game/gamemodes/dynamic/dynamic_rulesets_latejoin.dm
Expand Up @@ -86,6 +86,8 @@
blocking_rules = list(/datum/dynamic_ruleset/roundstart/revs)
var/required_heads_of_staff = 3
var/finished = FALSE
/// How much threat should be injected when the revolution wins?
var/revs_win_threat_injection = 20
var/datum/team/revolution/revolution

/datum/dynamic_ruleset/latejoin/provocateur/ready(forced=FALSE)
Expand All @@ -112,37 +114,20 @@
new_head = M.mind.add_antag_datum(new_head, revolution)
revolution.update_objectives()
revolution.update_heads()
SSshuttle.registerHostileEnvironment(src)
SSshuttle.registerHostileEnvironment(revolution)
return TRUE
else
log_game("DYNAMIC: [ruletype] [name] discarded [M.name] from head revolutionary due to ineligibility.")
log_game("DYNAMIC: [ruletype] [name] failed to get any eligible headrevs. Refunding [cost] threat.")
return FALSE

/datum/dynamic_ruleset/latejoin/provocateur/rule_process()
if(check_rev_victory())
finished = REVOLUTION_VICTORY
return RULESET_STOP_PROCESSING
else if (check_heads_victory())
finished = STATION_VICTORY
SSshuttle.clearHostileEnvironment(src)
revolution.save_members()
for(var/datum/mind/M in revolution.members) // Remove antag datums and prevents podcloned or exiled headrevs restarting rebellions.
if(M.has_antag_datum(/datum/antagonist/rev/head))
var/datum/antagonist/rev/head/R = M.has_antag_datum(/datum/antagonist/rev/head)
R.remove_revolutionary(FALSE, "gamemode")
if(M.current)
var/mob/living/carbon/C = M.current
if(istype(C) && C.stat == DEAD)
C.makeUncloneable()
if(M.has_antag_datum(/datum/antagonist/rev))
var/datum/antagonist/rev/R = M.has_antag_datum(/datum/antagonist/rev)
R.remove_revolutionary(FALSE, "gamemode")
priority_announce("It appears the mutiny has been quelled. Please return yourself and your incapacitated colleagues to work. \
We have remotely blacklisted the head revolutionaries in your medical records to prevent accidental revival.", null, 'sound/ai/attention.ogg', null, "Central Command Loyalty Monitoring Division")
return RULESET_STOP_PROCESSING

var/winner = revolution.process_victory(revs_win_threat_injection)
if (isnull(winner))
return

finished = winner
return RULESET_STOP_PROCESSING

/// Checks for revhead loss conditions and other antag datums.
/datum/dynamic_ruleset/latejoin/provocateur/proc/check_eligible(datum/mind/M)
Expand All @@ -151,33 +136,8 @@
return TRUE
return FALSE

/datum/dynamic_ruleset/latejoin/provocateur/check_finished()
if(finished == REVOLUTION_VICTORY)
return TRUE
else
return ..()

/datum/dynamic_ruleset/latejoin/provocateur/proc/check_rev_victory()
for(var/datum/objective/mutiny/objective in revolution.objectives)
if(!(objective.check_completion()))
return FALSE
return TRUE

/datum/dynamic_ruleset/latejoin/provocateur/proc/check_heads_victory()
for(var/datum/mind/rev_mind in revolution.head_revolutionaries())
var/turf/T = get_turf(rev_mind.current)
if(!considered_afk(rev_mind) && considered_alive(rev_mind) && is_station_level(T.z))
if(ishuman(rev_mind.current))
return FALSE
return TRUE

/datum/dynamic_ruleset/latejoin/provocateur/round_result()
if(finished == REVOLUTION_VICTORY)
SSticker.mode_result = "win - heads killed"
SSticker.news_report = REVS_WIN
else if(finished == STATION_VICTORY)
SSticker.mode_result = "loss - rev heads killed"
SSticker.news_report = REVS_LOSE
revolution.round_result(finished)

//////////////////////////////////////////////
// //
Expand Down
58 changes: 10 additions & 48 deletions code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm
Expand Up @@ -380,6 +380,8 @@
blocking_rules = list(/datum/dynamic_ruleset/latejoin/provocateur)
// I give up, just there should be enough heads with 35 players...
minimum_players = 35
/// How much threat should be injected when the revolution wins?
var/revs_win_threat_injection = 20
var/datum/team/revolution/revolution
var/finished = FALSE

Expand Down Expand Up @@ -412,7 +414,7 @@
if(revolution.members.len)
revolution.update_objectives()
revolution.update_heads()
SSshuttle.registerHostileEnvironment(src)
SSshuttle.registerHostileEnvironment(revolution)
return TRUE
log_game("DYNAMIC: [ruletype] [name] failed to get any eligible headrevs. Refunding [cost] threat.")
return FALSE
Expand All @@ -422,27 +424,12 @@
..()

/datum/dynamic_ruleset/roundstart/revs/rule_process()
if(check_rev_victory())
finished = REVOLUTION_VICTORY
return RULESET_STOP_PROCESSING
else if (check_heads_victory())
finished = STATION_VICTORY
SSshuttle.clearHostileEnvironment(src)
revolution.save_members()
for(var/datum/mind/M in revolution.members) // Remove antag datums and prevents podcloned or exiled headrevs restarting rebellions.
if(M.has_antag_datum(/datum/antagonist/rev/head))
var/datum/antagonist/rev/head/R = M.has_antag_datum(/datum/antagonist/rev/head)
R.remove_revolutionary(FALSE, "gamemode")
if(M.current)
var/mob/living/carbon/C = M.current
if(istype(C) && C.stat == DEAD)
C.makeUncloneable()
if(M.has_antag_datum(/datum/antagonist/rev))
var/datum/antagonist/rev/R = M.has_antag_datum(/datum/antagonist/rev)
R.remove_revolutionary(FALSE, "gamemode")
priority_announce("It appears the mutiny has been quelled. Please return yourself and your incapacitated colleagues to work. \
We have remotely blacklisted the head revolutionaries in your medical records to prevent accidental revival.", null, 'sound/ai/attention.ogg', null, "Central Command Loyalty Monitoring Division")
return RULESET_STOP_PROCESSING
var/winner = revolution.process_victory(revs_win_threat_injection)
if (isnull(winner))
return

finished = winner
return RULESET_STOP_PROCESSING

/// Checks for revhead loss conditions and other antag datums.
/datum/dynamic_ruleset/roundstart/revs/proc/check_eligible(datum/mind/M)
Expand All @@ -451,33 +438,8 @@
return TRUE
return FALSE

/datum/dynamic_ruleset/roundstart/revs/check_finished()
if(finished == REVOLUTION_VICTORY)
return TRUE
else
return ..()

/datum/dynamic_ruleset/roundstart/revs/proc/check_rev_victory()
for(var/datum/objective/mutiny/objective in revolution.objectives)
if(!(objective.check_completion()))
return FALSE
return TRUE

/datum/dynamic_ruleset/roundstart/revs/proc/check_heads_victory()
for(var/datum/mind/rev_mind in revolution.head_revolutionaries())
var/turf/T = get_turf(rev_mind.current)
if(!considered_afk(rev_mind) && considered_alive(rev_mind) && is_station_level(T.z))
if(ishuman(rev_mind.current))
return FALSE
return TRUE

/datum/dynamic_ruleset/roundstart/revs/round_result()
if(finished == REVOLUTION_VICTORY)
SSticker.mode_result = "win - heads killed"
SSticker.news_report = REVS_WIN
else if(finished == STATION_VICTORY)
SSticker.mode_result = "loss - rev heads killed"
SSticker.news_report = REVS_LOSE
revolution.round_result(finished)

//////////////////////////////////////////////
// //
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/antag_panel.dm
Expand Up @@ -77,7 +77,7 @@ GLOBAL_VAR(antag_prototypes)
return common_commands

/datum/mind/proc/get_special_statuses()
var/list/result = list()
var/list/result = LAZYCOPY(special_statuses)
if(!current)
result += "<span class='bad'>No body!</span>"
if(current && HAS_TRAIT(current, TRAIT_MINDSHIELD))
Expand Down

0 comments on commit a4c61a3

Please sign in to comment.