Skip to content

Commit

Permalink
[MIRROR] Fixes banned/days remaining preferences display for non-dyna…
Browse files Browse the repository at this point in the history
…mic ruleset antagonists. (#1860)

* Fixes banned/days remaining preferences display for non-dynamic ruleset antagonists.

* Update antags.dm

* Update antags.dm

---------

Co-authored-by: AnturK <[email protected]>
Co-authored-by: Bloop <[email protected]>
  • Loading branch information
3 people authored and StealsThePRs committed Apr 8, 2024
1 parent 003fc5a commit 6a7f7ce
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions code/modules/client/preferences/middleware/antags.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
// Antagonists that don't have a dynamic ruleset, but do have a preference
GLOBAL_LIST_INIT(non_ruleset_antagonists, list(
ROLE_GLITCH = /datum/antagonist/bitrunning_glitch,
ROLE_FUGITIVE = /datum/antagonist/fugitive,
ROLE_LONE_OPERATIVE = /datum/antagonist/nukeop/lone,
ROLE_SENTIENCE = /datum/antagonist/sentient_creature,
ROLE_DRIFTING_CONTRACTOR = /datum/antagonist/contractor, // NOVA EDIT ADDITION
))

/datum/preference_middleware/antags
action_delegations = list(
"set_antags" = PROC_REF(set_antags),
Expand Down Expand Up @@ -69,6 +78,12 @@
if (is_banned_from(preferences.parent.ckey, list(antag_flag_override || antag_flag, ROLE_SYNDICATE)))
antag_bans += serialize_antag_name(antag_flag)

for(var/antag_key in GLOB.non_ruleset_antagonists)
var/datum/antagonist/antag = GLOB.non_ruleset_antagonists[antag_key]
var/antag_flag = initial(antag.job_rank)
if(is_banned_from(preferences.parent.ckey, list(antag_flag, ROLE_SYNDICATE)))
antag_bans += serialize_antag_name(antag_flag)

return antag_bans

/datum/preference_middleware/antags/proc/get_antag_days_left()
Expand All @@ -91,6 +106,17 @@
if (days_needed > 0)
antag_days_left[serialize_antag_name(antag_flag)] = days_needed

for(var/antag_key in GLOB.non_ruleset_antagonists)
var/datum/antagonist/antag = GLOB.non_ruleset_antagonists[antag_key]
var/antag_flag = initial(antag.job_rank)

var/days_needed = preferences.parent?.get_remaining_days(
GLOB.special_roles[antag_flag]
)

if (days_needed > 0)
antag_days_left[serialize_antag_name(antag_flag)] = days_needed

return antag_days_left

/datum/preference_middleware/antags/proc/get_serialized_antags()
Expand All @@ -113,16 +139,7 @@
var/list/antag_icons = list()

/datum/asset/spritesheet/antagonists/create_spritesheets()
// Antagonists that don't have a dynamic ruleset, but do have a preference
var/static/list/non_ruleset_antagonists = list(
ROLE_GLITCH = /datum/antagonist/bitrunning_glitch,
ROLE_FUGITIVE = /datum/antagonist/fugitive,
ROLE_LONE_OPERATIVE = /datum/antagonist/nukeop/lone,
ROLE_DRIFTING_CONTRACTOR = /datum/antagonist/contractor, //NOVA EDIT
ROLE_SENTIENCE = /datum/antagonist/sentient_creature,
)

var/list/antagonists = non_ruleset_antagonists.Copy()
var/list/antagonists = GLOB.non_ruleset_antagonists.Copy()

for (var/datum/dynamic_ruleset/ruleset as anything in subtypesof(/datum/dynamic_ruleset))
var/datum/antagonist/antagonist_type = initial(ruleset.antag_datum)
Expand Down

0 comments on commit 6a7f7ce

Please sign in to comment.