From 35de1f63bc5369d4207e304540efd17fa46c0e61 Mon Sep 17 00:00:00 2001
From: TDSSS <32099540+TDSSS@users.noreply.github.com>
Date: Wed, 8 Jul 2020 14:28:04 +0200
Subject: [PATCH 1/3] Added security counter to check antags panel
---
code/__HELPERS/mobs.dm | 29 +++++++++++++++++++++++++++++
code/modules/admin/player_panel.dm | 7 ++++++-
2 files changed, 35 insertions(+), 1 deletion(-)
diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm
index f437c409088..7decace45c3 100644
--- a/code/__HELPERS/mobs.dm
+++ b/code/__HELPERS/mobs.dm
@@ -616,3 +616,32 @@ GLOBAL_LIST_INIT(do_after_once_tracker, list())
chosen = pick(mob_spawn_meancritters)
var/mob/living/simple_animal/C = new chosen(spawn_location)
return C
+
+//determines the job of a mob, taking into account job transfers
+/proc/determine_role(mob/living/P)
+ var/datum/mind/M = P.mind
+ if(!M)
+ return
+ return M.playtime_role ? M.playtime_role : M.assigned_role //returns current role
+
+//checks the security force on station and returns a list of numbers, of the form:
+// total, active, dead, antag
+// where active is defined as conscious (STAT = 0) and not an antag
+/proc/check_active_security_force()
+ var/sec_positions = GLOB.security_positions - "Magistrate" - "Brig Physician"
+ var/total = 0
+ var/active = 0
+ var/dead = 0
+ var/antag = 0
+ for(var/mob/living/carbon/human/player in GLOB.human_list)
+ if(determine_role(player) in sec_positions)
+ total++
+ if(player.stat == DEAD)
+ dead++
+ continue
+ if(isAntag(player))
+ antag++
+ continue
+ if(player.stat == CONSCIOUS)
+ active++
+ return list(total, active, dead, antag)
diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm
index e89b829f421..5e5fe260480 100644
--- a/code/modules/admin/player_panel.dm
+++ b/code/modules/admin/player_panel.dm
@@ -404,7 +404,8 @@
PM [ADMIN_FLW(M, "FLW")] | [close ? "" : ""]"}
/datum/admins/proc/check_antagonists()
- if(!check_rights(R_ADMIN)) return
+ if(!check_rights(R_ADMIN))
+ return
if(SSticker && SSticker.current_state >= GAME_STATE_PLAYING)
var/dat = "Round StatusRound Status
"
dat += "Current Game Mode: [SSticker.mode.name]
"
@@ -570,6 +571,10 @@
if(SSticker.mode.ert.len)
dat += check_role_table("ERT", SSticker.mode.ert)
+ //list active security force count, so admins know how bad things are
+ var/list/sec_list = check_active_security_force()
+ dat += "| Security Force Overview(total/active/dead/antag): [sec_list[1]]/[sec_list[2]]/[sec_list[3]]/[sec_list[4]] |
"
+
dat += ""
usr << browse(dat, "window=roundstatus;size=400x500")
else
From 4c6b3a2a7fddef91cf43fc3069e6aede3c6f73b3 Mon Sep 17 00:00:00 2001
From: TDSSS <32099540+TDSSS@users.noreply.github.com>
Date: Wed, 8 Jul 2020 17:53:29 +0200
Subject: [PATCH 2/3] incorporates code comments
---
code/__HELPERS/mobs.dm | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/code/__HELPERS/mobs.dm b/code/__HELPERS/mobs.dm
index 7decace45c3..f7c66c3378b 100644
--- a/code/__HELPERS/mobs.dm
+++ b/code/__HELPERS/mobs.dm
@@ -624,16 +624,18 @@ GLOBAL_LIST_INIT(do_after_once_tracker, list())
return
return M.playtime_role ? M.playtime_role : M.assigned_role //returns current role
-//checks the security force on station and returns a list of numbers, of the form:
-// total, active, dead, antag
-// where active is defined as conscious (STAT = 0) and not an antag
+/** checks the security force on station and returns a list of numbers, of the form:
+ * total, active, dead, antag
+ * where active is defined as conscious (STAT = 0) and not an antag
+*/
/proc/check_active_security_force()
var/sec_positions = GLOB.security_positions - "Magistrate" - "Brig Physician"
var/total = 0
var/active = 0
var/dead = 0
var/antag = 0
- for(var/mob/living/carbon/human/player in GLOB.human_list)
+ for(var/p in GLOB.human_list) //contains only human mobs, so no type check needed
+ var/mob/living/carbon/human/player = p //need to tell it what type it is or we can't access stat without the dreaded :
if(determine_role(player) in sec_positions)
total++
if(player.stat == DEAD)
From 4deb4e79697f94211a3ea5663c2056e8f1bcde97 Mon Sep 17 00:00:00 2001
From: TDSSS <32099540+TDSSS@users.noreply.github.com>
Date: Mon, 13 Jul 2020 00:31:53 +0200
Subject: [PATCH 3/3] formatting change
---
code/modules/admin/player_panel.dm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm
index 5e5fe260480..1c6bab4d3cd 100644
--- a/code/modules/admin/player_panel.dm
+++ b/code/modules/admin/player_panel.dm
@@ -573,7 +573,12 @@
//list active security force count, so admins know how bad things are
var/list/sec_list = check_active_security_force()
- dat += "| Security Force Overview(total/active/dead/antag): [sec_list[1]]/[sec_list[2]]/[sec_list[3]]/[sec_list[4]] |
"
+ dat += "
| Security | |
"
+ dat += "| Total: | [sec_list[1]] | "
+ dat += "
| Active: | [sec_list[2]] | "
+ dat += "
| Dead: | [sec_list[3]] | "
+ dat += "
| Antag: | [sec_list[4]] | "
+ dat += "
"
dat += "