Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

malf ai fix #486

Merged
merged 4 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/modules/mob/dead/dead.dm
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ INITIALIZE_IMMEDIATE(/mob/dead)
. += "Time To Start: SOON"

. += "Players: [LAZYLEN(GLOB.clients)]"
. += "Players Ready: [SSticker.totalPlayersReady]"
if(client.holder)
. += "Players Ready: [SSticker.totalPlayersReady]"
. += "Admins Ready: [SSticker.total_admins_ready] / [length(GLOB.admins)]"

/mob/dead/proc/server_hop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
var/living_players_arg = round_started ? TRUE : FALSE
var/midround_antag_pref_arg = round_started ? FALSE : TRUE

var/list/candidates = SSgamemode.get_candidates(antag_flag, antag_flag, ready_newplayers = new_players_arg, living_players = living_players_arg, midround_antag_pref = midround_antag_pref_arg, restricted_roles = restricted_roles)
var/list/candidates = SSgamemode.get_candidates(antag_flag, antag_flag, ready_newplayers = new_players_arg, living_players = living_players_arg, midround_antag_pref = midround_antag_pref_arg, restricted_roles = restricted_roles, required_roles = exclusive_roles)
candidates = trim_candidates(candidates)
return candidates

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
JOB_HEAD_OF_SECURITY,
JOB_RESEARCH_DIRECTOR,
JOB_SCIENTIST,
JOB_ROBOTICIST,
JOB_SECURITY_OFFICER,
JOB_WARDEN,
)
maximum_antags = 1
exclusive_roles = list(JOB_AI)
required_enemies = 4
weight = 4
Expand Down
10 changes: 7 additions & 3 deletions monkestation/code/modules/storytellers/gamemode_subsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ SUBSYSTEM_DEF(gamemode)

/// Gets the number of antagonists the antagonist injection events will stop rolling after.
/datum/controller/subsystem/gamemode/proc/get_antag_cap()
var/cap = FLOOR((get_correct_popcount() / ANTAG_CAP_DENOMINATOR), 1) + ANTAG_CAP_FLAT
var/total_number = get_correct_popcount() + (sec_crew * 2)
var/cap = FLOOR((total_number / ANTAG_CAP_DENOMINATOR), 1) + ANTAG_CAP_FLAT
return cap

/// Whether events can inject more antagonists into the round
Expand All @@ -234,7 +235,7 @@ SUBSYSTEM_DEF(gamemode)
return (get_antag_cap() > total_valid_antags)

/// Gets candidates for antagonist roles.
/datum/controller/subsystem/gamemode/proc/get_candidates(be_special, job_ban, observers, ready_newplayers, living_players, required_time, inherit_required_time = TRUE, midround_antag_pref, no_antags = TRUE, list/restricted_roles)
/datum/controller/subsystem/gamemode/proc/get_candidates(be_special, job_ban, observers, ready_newplayers, living_players, required_time, inherit_required_time = TRUE, midround_antag_pref, no_antags = TRUE, list/restricted_roles, list/required_roles)
var/list/candidates = list()
var/list/candidate_candidates = list() //lol

Expand All @@ -246,7 +247,7 @@ SUBSYSTEM_DEF(gamemode)
else if (observers && isobserver(player))
candidate_candidates += player
else if (living_players && isliving(player))
if(!ishuman(player))
if(!ishuman(player) && !isAI(player))
continue
if(!(player.z in SSmapping.levels_by_trait(ZTRAIT_STATION)))
continue
Expand All @@ -260,6 +261,9 @@ SUBSYSTEM_DEF(gamemode)
continue
if(restricted_roles && (candidate.mind.assigned_role.title in restricted_roles))
continue
if(length(required_roles) && !(candidate.mind.assigned_role.title in required_roles))
continue

if(be_special)
if(!(candidate.client.prefs) || !(be_special in candidate.client.prefs.be_special))
continue
Expand Down