From 7dca62d28ef65e5654f25c74aa48d78331d00f20 Mon Sep 17 00:00:00 2001
From: SECBATON GRIFFON <87321915+SECBATON-GRIFFON@users.noreply.github.com>
Date: Wed, 27 Mar 2024 08:43:01 +0000
Subject: [PATCH] Moves nukeop and rev score info to their respective factions
on board (#36231)
* Moves nukeop and rev score info to their respective factions on board
* cleanup of commented code
* tracks where the boom happened just in case
* makes the all arrested vars more accurate
* makes this total show up right now
* more accurate arrest check
* cells are here!
* excessive
---------
Co-authored-by: SECBATON-GRIFFON <>
---
code/datums/gamemode/factions/faction.dm | 7 +
.../gamemode/factions/syndicate/nukeops.dm | 83 +++++++++
.../datums/gamemode/factions/syndicate/rev.dm | 44 +++++
code/datums/gamemode/objectives/escape.dm | 5 +-
.../endgame/scoreboard/antag_score.dm | 176 ------------------
.../endgame/scoreboard/scoreboard.dm | 7 -
code/game/gamemodes/nuclear/nuclearbomb.dm | 2 +
7 files changed, 138 insertions(+), 186 deletions(-)
diff --git a/code/datums/gamemode/factions/faction.dm b/code/datums/gamemode/factions/faction.dm
index 64c566ec5e9..1c800fe8999 100644
--- a/code/datums/gamemode/factions/faction.dm
+++ b/code/datums/gamemode/factions/faction.dm
@@ -33,6 +33,8 @@ var/list/factions_with_hud_icons = list()
var/required_pref = ""
var/list/restricted_species = list()
var/list/members = list()
+ var/peak_member_amount = 0
+ var/role_peak_member_typefilter
var/max_roles = 0
var/accept_latejoiners = FALSE
var/datum/objective_holder/objective_holder
@@ -287,8 +289,13 @@ var/list/factions_with_hud_icons = list()
return dat
/datum/faction/proc/process()
+ var/total
for (var/datum/role/R in members)
R.process()
+ if(!role_peak_member_typefilter || istype(R,role_peak_member_typefilter))
+ total++
+ if(total > peak_member_amount)
+ peak_member_amount = total
/datum/faction/proc/stage(var/value)
stage = value
diff --git a/code/datums/gamemode/factions/syndicate/nukeops.dm b/code/datums/gamemode/factions/syndicate/nukeops.dm
index 88335295631..b9d12fd857c 100644
--- a/code/datums/gamemode/factions/syndicate/nukeops.dm
+++ b/code/datums/gamemode/factions/syndicate/nukeops.dm
@@ -26,6 +26,87 @@
. += "
The operatives bought:
"
for(var/entry in faction_scoreboard_data)
. += "[entry]
"
+ var/diskdat = null
+ var/bombdat = null
+ var/opkilled = 0
+ var/oparrested = 0
+ var/alloparrested = 0
+ //var/nukedpenalty = 1000
+ for(var/datum/role/R in members)
+ var/datum/mind/M = R.antag
+ if(!M || !M.current)
+ opkilled++
+ continue
+ var/turf/T = M.current.loc
+ if(T && (istype(T.loc, /area/security/brig) || istype(T.loc, /area/security/perma) || istype(T, /turf/simulated/floor/shuttle/brig)))
+ oparrested++
+ else if(M.current.stat == DEAD)
+ opkilled++
+ if(peak_member_amount == oparrested)
+ alloparrested = 1
+ score.crewscore += oparrested * 2000
+ score.crewscore += opkilled * 250
+ score.crewscore += oparrested * 1000
+ //if(score.scores["nuked"])
+ //score.crewscore -= nukedpenalty
+
+ if(nukedisk)
+ var/atom/disk_loc = nukedisk.loc
+ while(!istype(disk_loc, /turf))
+ if(istype(disk_loc, /mob))
+ var/mob/M = disk_loc
+ diskdat += "Carried by [M.real_name] "
+ if(istype(disk_loc, /obj))
+ var/obj/O = disk_loc
+ diskdat += "in \a [O.name] "
+ disk_loc = disk_loc.loc
+ diskdat += "in [disk_loc.loc]"
+ /*score.scores["disc"] = 1
+ if(istype(disk_loc,/mob/living/carbon))
+ var/area/bad_zone1 = locate(/area) in areas
+ if(location in bad_zone1)
+ score.scores["disc"] = 0
+ if(istype(get_area(nukedisc),/area/syndicate_mothership))
+ score.scores["disc"] = 0
+ if(istype(get_area(nukedisc),/area/wizard_station))
+ score.scores["disc"] = 0
+ if(nukedisk.loc.z != map.zMainStation)
+ score.scores["disc"] = 0*/
+
+ bombdat = nuked_area
+ if(!nuked_area)
+ for(var/obj/machinery/nuclearbomb/nuke in nuclear_bombs)
+ if(nuke.r_code == "LOLNO")
+ continue
+ bombdat = get_area(nuke)
+ /*nukedpenalty = 50000 //Congratulations, your score was nuked
+ var/turf/T = get_turf(nuke)
+ if(istype(T,/area/syndicate_mothership) || istype(T,/area/wizard_station) || istype(T,/area/solar/) || istype(T,/area))
+ nukedpenalty = 1000
+ else if (istype(T,/area/security/main) || istype(T,/area/security/brig) || istype(T,/area/security/armory) || istype(T,/area/security/checkpoint2))
+ nukedpenalty = 50000
+ else if (istype(T,/area/engine))
+ nukedpenalty = 100000
+ else
+ nukedpenalty = 5000*/
+ //break
+ if(!diskdat)
+ diskdat = "Unknown"
+ log_admin("The disk could not be found for the nuke ops scoreboard! Report this")
+ message_admins("The disk could not be found for the nuke ops scoreboard! Report this")
+ if(!bombdat)
+ bombdat = "Unknown"
+ log_admin("The nuke could not be found for the nuke ops scoreboard! Report this")
+ message_admins("The nuke could not be found for the nuke ops scoreboard! Report this")
+
+ . += {"
+ Final Location of Nuke: [bombdat]
+ Final Location of Disk: [diskdat]
+ Operatives Arrested: [oparrested] ([oparrested * 1000] Points)
+ Operatives Killed: [opkilled] ([opkilled * 250] Points)
+ All Operatives Arrested: [alloparrested ? "Yes" : "No"] ([oparrested * 2000] Points)
"}
+// Station Destroyed: [score.scores["nuked"] ? "Yes" : "No"] (-[nukedpenalty] Points)
+// Nuclear Disk Secure: [score.scores["disc"] ? "Yes" : "No"] ([score.scores["disc"] * 500] Points)
/datum/faction/syndicate/nuke_op/AdminPanelEntry()
var/list/dat = ..()
@@ -142,3 +223,5 @@
livingmembers++
if(!livingmembers && ticker.IsThematic(playlist))
ticker.StopThematic()
+ if(livingmembers > peak_member_amount)
+ peak_member_amount = livingmembers
diff --git a/code/datums/gamemode/factions/syndicate/rev.dm b/code/datums/gamemode/factions/syndicate/rev.dm
index 01fdb5a71c2..dffd6b5f877 100644
--- a/code/datums/gamemode/factions/syndicate/rev.dm
+++ b/code/datums/gamemode/factions/syndicate/rev.dm
@@ -12,6 +12,7 @@
playlist = "nukesquad"
default_admin_voice = "Union Boss"
admin_voice_style = "secradio"
+ role_peak_member_typefilter = /datum/role/revolutionary/leader
var/discovered = 0
/datum/faction/revolution/HandleRecruitedMind(var/datum/mind/M)
@@ -181,3 +182,46 @@
ticker.revolutionary_victory = 1
if (ALL_REVS_DEAD)
to_chat(world, "The crew has won!
All revolutionaries are either dead or have fled the station!")
+
+/datum/faction/revolution/GetScoreboard()
+ . = ..()
+ var/loycount = 0
+ var/revarrested = 0
+ var/revkilled = 0
+ var/allrevarrested = 1
+ var/deadcommand = 0
+ for(var/datum/role/R in members)
+ var/datum/mind/M = R.antag
+ if(!M || !M.current)
+ revkilled++
+ continue
+ var/turf/T = M.current.loc
+ if(T && (istype(T.loc, /area/security/brig) || istype(T.loc, /area/security/perma) || istype(T, /turf/simulated/floor/shuttle/brig)))
+ revarrested++
+ else if (M.current.stat == DEAD)
+ revkilled++
+ for(var/mob/living/player in player_list)
+ if (istype(player, /mob/living/carbon/human))
+ var/role = player.mind.assigned_role
+ if((role in command_positions) && player.stat == DEAD)
+ deadcommand++
+ else if(!(locate(/datum/role/revolutionary) in player.mind.antag_roles))
+ loycount++
+ else if(istype(player, /mob/living/silicon) && player.stat != DEAD)
+ loycount++
+ //if(score.scores["traitorswon"])
+ //score.scores["crewscore"] -= 10000
+ if(peak_member_amount == revarrested) // That way only head revs count
+ allrevarrested = 1
+ score.crewscore += revarrested * 2000
+ score.crewscore += revarrested * 1000
+ score.crewscore += revkilled * 500
+ score.crewscore -= deadcommand * 500
+
+ . += {"
+ Number of Surviving Loyal Crew: [loycount]
+ Revolution Heads Arrested: [revarrested] ([revarrested * 1000] Points)
+ Revolution Heads Slain: [revkilled] ([revkilled * 500] Points)
+ Command Staff Slain: [deadcommand] (-[deadcommand * 500] Points)
+ All Revolution Heads Arrested: [allrevarrested ? "Yes" : "No"] ([revarrested * 2000] Points)
"}
+// Revolution Successful: [score.scores["traitorswon"] ? "Yes" : "No"] (-[score.scores["traitorswon"] * revpenalty] Points)
diff --git a/code/datums/gamemode/objectives/escape.dm b/code/datums/gamemode/objectives/escape.dm
index 9ebb972332b..fff80bdd5e8 100644
--- a/code/datums/gamemode/objectives/escape.dm
+++ b/code/datums/gamemode/objectives/escape.dm
@@ -33,7 +33,6 @@
else
return FALSE
-
//Prisoner Escapes. Same as above, except you don't have to be on the shuttle and you can't be in the brig roundend.
/datum/objective/escape_prisoner
@@ -64,11 +63,11 @@
if(istype(owner.current, /mob/living/carbon/human))
var/mob/living/carbon/human/H = owner.current
- if(H.restrained())
+ if(H.restrained())
return FALSE
else if (istype(owner.current, /mob/living/carbon))
var/mob/living/carbon/C = owner.current
if (C.handcuffed)
return FALSE
- return TRUE
\ No newline at end of file
+ return TRUE
diff --git a/code/game/gamemodes/endgame/scoreboard/antag_score.dm b/code/game/gamemodes/endgame/scoreboard/antag_score.dm
index 4bf8ee0579a..6dca8777ef1 100644
--- a/code/game/gamemodes/endgame/scoreboard/antag_score.dm
+++ b/code/game/gamemodes/endgame/scoreboard/antag_score.dm
@@ -18,179 +18,3 @@
for(var/entry in score.implant_phrases)
completions += "[entry]
"
return completions
-
-/datum/controller/gameticker/scoreboard/proc/nuke_op_score(var/datum/faction/syndicate/nuke_op/NO)
- var/foecount = 0
- var/crewcount = 0
- var/diskdat = ""
- var/bombdat = null
- var/opkilled
- var/oparrested
- var/alloparrested
- var/dat
- //var/nukedpenalty = 1000
- for(var/datum/role/R in NO.members)
- foecount++
- var/datum/mind/M = R.antag
- if(!M || !M.current)
- opkilled++
- continue
- var/turf/T = M.current.loc
- if(T && istype(T.loc, /area/security/brig))
- oparrested++
- else if(M.current.stat == DEAD)
- opkilled++
- for(var/mob/living/C in player_list)
- if(!istype(C,/mob/living/carbon/human) || !istype(C,/mob/living/silicon/robot) || !istype(C,/mob/living/silicon/ai))
- continue
- if(C.stat == DEAD)
- continue
- if(!C.client)
- continue
- crewcount++
- if(foecount == oparrested)
- alloparrested = 1
- score.crewscore += oparrested * 2000
- score.crewscore += opkilled * 250
- score.crewscore += oparrested * 1000
- //if(score.scores["nuked"])
- //score.scores["crewscore"] -= nukedpenalty
-
- /*score.scores["disc"] = 1
- for(var/obj/item/weapon/disk/nuclear/A in world)
- if(A.loc != /mob/living/carbon)
- continue
- var/turf/location = get_turf(A.loc)
- var/area/bad_zone1 = locate(/area)
- var/area/bad_zone2 = locate(/area/syndicate_mothership)
- var/area/bad_zone3 = locate(/area/wizard_station)
- if(location in bad_zone1)
- score.scores["disc"] = 0
- if(location in bad_zone2)
- score.scores["disc"] = 0
- if(location in bad_zone3)
- score.scores["disc"] = 0
- if(A.loc.z != map.zMainStation)
- score.scores["disc"] = 0*/
-
- /*if(score.scores["nuked"])
- nukedpenalty = 50000 //Congratulations, your score was nuked
-
- for(var/obj/machinery/nuclearbomb/nuke in machines)
- if(nuke.r_code == "Nope")
- continue
- var/turf/T = get_turf(nuke)
- if(istype(T, /area/syndicate_mothership) || istype(T, /area/wizard_station) || istype(T, /area/solar))
- nukedpenalty = 1000
- else if(istype(T, /area/security/main) || istype(T, /area/security/brig) || istype(T, /area/security/armory) || istype(T, /area/security/checkpoint2))
- nukedpenalty = 50000
- else if(istype(T, /area/engine))
- nukedpenalty = 100000
- else
- nukedpenalty = 10000*/
-
-
- for(var/obj/item/weapon/disk/nuclear/N in world)
- if(!N)
- continue
- var/atom/disk_loc = N.loc
- while(!istype(disk_loc, /turf))
- if(istype(disk_loc, /mob))
- var/mob/M = disk_loc
- diskdat += "Carried by [M.real_name] "
- if(istype(disk_loc, /obj))
- var/obj/O = disk_loc
- diskdat += "in \a [O.name] "
- disk_loc = disk_loc.loc
- diskdat += "in [disk_loc.loc]"
- break // Should only need one go-round, probably
-
- /*for(var/obj/machinery/nuclearbomb/nuke in machines)
- if(nuke.r_code == "Nope")
- continue
- var/turf/T = nuke.loc
- bombdat = T.loc
- if(istype(T,/area/syndicate_mothership) || istype(T,/area/wizard_station) || istype(T,/area/solar/) || istype(T,/area))
- nukedpenalty = 1000
- else if (istype(T,/area/security/main) || istype(T,/area/security/brig) || istype(T,/area/security/armory) || istype(T,/area/security/checkpoint2))
- nukedpenalty = 50000
- else if (istype(T,/area/engine))
- nukedpenalty = 100000
- else
- nukedpenalty = 5000
- break*/
- if(!diskdat)
- diskdat = "Uh oh. Something has fucked up! Report this."
-
- return dat += {"NUCLEAR ASSAULT STATS
- Number of Operatives: [foecount]
- Number of Surviving Crew: [crewcount]
- Final Location of Nuke: [bombdat]
- Final Location of Disk: [diskdat]
- Operatives Arrested: [oparrested] ([oparrested * 1000] Points)
- Operatives Killed: [opkilled] ([opkilled * 250] Points)
- All Operatives Arrested: [alloparrested ? "Yes" : "No"] ([oparrested * 2000])
-
"}
-// Station Destroyed: [score.scores["nuked"] ? "Yes" : "No"] (-[nukedpenalty] Points)
-// Nuclear Disk Secure: [score.scores["disc"] ? "Yes" : "No"] ([score.scores["disc"] * 500] Points)
-
-/datum/controller/gameticker/scoreboard/proc/revolution_score(var/datum/faction/revolution/RV)
- var/foecount = 0
- var/comcount = 0
- var/revcount = 0
- var/loycount = 0
- var/revarrested = 0
- var/revkilled = 0
- var/allrevarrested = 1
- var/deadcommand = 0
- var/dat
- for(var/datum/role/R in RV.members)
- if(R.antag.current && R.antag.current.stat != 2)
- if(istype(R,/datum/role/revolutionary/leader))
- foecount++
- else
- revcount++
- var/datum/mind/M = R.antag
- if(!M || !M.current)
- revkilled++
- continue
- var/turf/T = M.current.loc
- if(istype(T.loc, /area/security/brig))
- revarrested++
- else if (M.current.stat == DEAD)
- revkilled++
- for(var/mob/living/player in player_list)
- if (istype(player, /mob/living/carbon/human))
- var/role = player.mind.assigned_role
- if(role in list("Captain", "Head of Security", "Head of Personnel", "Chief Engineer", "Research Director"))
- if(player.stat == DEAD)
- deadcommand++
- else
- comcount++
- else
- if(locate(/datum/role/revolutionary) in player.mind.antag_roles)
- continue
- loycount++
- else if(istype(player, /mob/living/silicon))
- if (player.stat != DEAD)
- loycount++
- //if(score.scores["traitorswon"])
- //score.scores["crewscore"] -= 10000
- if(foecount == revarrested)
- allrevarrested = 1
- score.crewscore += revarrested * 2000
- score.crewscore += revarrested * 1000
- score.crewscore += revkilled * 500
- score.crewscore -= deadcommand * 500
-
- return dat += {"REVOLUTION STATS
- Number of Surviving Revolution Heads: [foecount]
- Number of Surviving Command Staff: [comcount]
- Number of Surviving Revolutionaries: [revcount]
- Number of Surviving Loyal Crew: [loycount]
- Revolution Heads Arrested: [revarrested] ([revarrested * 1000] Points)
- Revolution Heads Slain: [revkilled] ([revkilled * 500] Points)
- Command Staff Slain: [deadcommand] (-[deadcommand * 500] Points)
- All Revolution Heads Arrested: [allrevarrested ? "Yes" : "No"] ([revarrested * 2000] Points)
-
"}
-// Revolution Successful: [score.scores["traitorswon"] ? "Yes" : "No"] (-[score.scores["traitorswon"] * revpenalty] Points)
\ No newline at end of file
diff --git a/code/game/gamemodes/endgame/scoreboard/scoreboard.dm b/code/game/gamemodes/endgame/scoreboard/scoreboard.dm
index 52a94f29636..8acbc3fc2b7 100644
--- a/code/game/gamemodes/endgame/scoreboard/scoreboard.dm
+++ b/code/game/gamemodes/endgame/scoreboard/scoreboard.dm
@@ -89,9 +89,6 @@ var/global/datum/controller/gameticker/scoreboard/score = new()
var/list/global_paintings = list()
/datum/controller/gameticker/scoreboard/proc/main(var/dat)
- var/datum/faction/syndicate/nuke_op/NO = find_active_faction_by_type(/datum/faction/syndicate/nuke_op)
- var/datum/faction/revolution/RV = find_active_faction_by_type(/datum/faction/revolution)
-
ticker.mode.declare_completion()
dat += "[ticker.mode.dat]
"
@@ -101,10 +98,6 @@ var/global/datum/controller/gameticker/scoreboard/score = new()
dat += service_score()
dat += supply_score()
dat += science_score()
- if(NO)
- dat += nuke_op_score(NO)
- if(RV)
- dat += revolution_score(RV)
dat += syndicate_score()
dat += silicon_score()
dat += misc_score()
diff --git a/code/game/gamemodes/nuclear/nuclearbomb.dm b/code/game/gamemodes/nuclear/nuclearbomb.dm
index a7bcb267c49..6c4661f4af7 100644
--- a/code/game/gamemodes/nuclear/nuclearbomb.dm
+++ b/code/game/gamemodes/nuclear/nuclearbomb.dm
@@ -285,6 +285,7 @@ var/list/nuclear_bombs = list()
return
#define NUKERANGE 120
+var/area/nuked_area
/obj/machinery/nuclearbomb/proc/explode(var/sound = TRUE)
if (src.safety)
src.timing = 0
@@ -302,6 +303,7 @@ var/list/nuclear_bombs = list()
var/off_station = 0
var/turf/bomb_location = get_turf(src)
+ nuked_area = bomb_location.loc
explosion(bomb_location, 30, 60, 120, 120, 10)
if( bomb_location && (bomb_location.z == map.zMainStation) )
var/map_center_x = world.maxx * 0.5