Skip to content

Commit

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

* A victory for revolutionaries will no longer end the round on dynamic, instead no new security and command will be allowed to join (tg#55956) (#3966)

* initial

* policy need not apply

* call it in

* A victory for revolutionaries will no longer end the round on dynamic, instead no new security and command will be allowed to join (tg#55956)

Co-authored-by: Cenrus <31044876+Cenrus@users.noreply.github.com>
  • Loading branch information
AustationBot and Cenrus committed May 5, 2021
1 parent c4559c9 commit 3b30d36
Show file tree
Hide file tree
Showing 12 changed files with 184 additions and 123 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/role_preferences.dm
Expand Up @@ -15,6 +15,7 @@
#define ROLE_INCURSION "Incursion Team"
#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
1 change: 1 addition & 0 deletions code/__HELPERS/_lists.dm
Expand Up @@ -11,6 +11,7 @@

#define LAZYINITLIST(L) if (!L) L = list()
#define UNSETEMPTY(L) if (L && !length(L)) L = null
#define LAZYCOPY(L) (L ? L.Copy() : list() )
#define LAZYREMOVE(L, I) if(L) { L -= I; if(!length(L)) { L = null; } }
#define LAZYADD(L, I) if(!L) { L = list(); } L += I;
#define LAZYOR(L, I) if(!L) { L = list(); } L |= I;
Expand Down
2 changes: 2 additions & 0 deletions code/controllers/subsystem/job.dm
Expand Up @@ -43,11 +43,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 @@ -71,6 +71,9 @@
var/list/learned_recipes //List of learned recipe TYPES.
var/list/crew_objectives = list()

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

/datum/mind/New(var/key)
src.key = key
soulOwner = src
Expand Down
5 changes: 0 additions & 5 deletions code/game/gamemodes/dynamic/dynamic_rulesets.dm
Expand Up @@ -183,11 +183,6 @@
/// Only called if ruleset is flagged as HIGH_IMPACT_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 HIGH_IMPACT_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 @@ -91,6 +91,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 @@ -117,37 +119,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(var/datum/mind/M)
Expand All @@ -156,33 +141,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) || ismonkey(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
59 changes: 9 additions & 50 deletions code/game/gamemodes/dynamic/dynamic_rulesets_roundstart.dm
Expand Up @@ -371,6 +371,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 @@ -401,7 +403,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 @@ -411,30 +413,12 @@
..()

/datum/dynamic_ruleset/roundstart/revs/rule_process()
if(!revolution)
log_game("DYNAMIC: Something went horrifically wrong with [name] - and the antag datum could not be created. Notify coders.")
var/winner = revolution.process_victory(revs_win_threat_injection)
if (isnull(winner))
return
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

finished = winner
return RULESET_STOP_PROCESSING

/// Checks for revhead loss conditions and other antag datums.
/datum/dynamic_ruleset/roundstart/revs/proc/check_eligible(var/datum/mind/M)
Expand All @@ -443,33 +427,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) || ismonkey(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)

// Admin only rulesets. The threat requirement is 101 so it is not possible to roll them.

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 3b30d36

Please sign in to comment.