reduces a massive amount of endround lag (#23306)

* reduces a massive amount of endround lag

* more improvements
This commit is contained in:
GDN
2023-11-24 09:39:59 -06:00
committed by GitHub
parent 96d828dedc
commit 94fbb46dc4
10 changed files with 71 additions and 64 deletions
+35 -32
View File
@@ -530,26 +530,31 @@ SUBSYSTEM_DEF(ticker)
ending_station_state.count()
var/station_integrity = min(round( 100.0 * GLOB.start_state.score(ending_station_state), 0.1), 100.0)
to_chat(world, "<BR>[TAB]Shift Duration: <B>[round(ROUND_TIME / 36000)]:[add_zero("[ROUND_TIME / 600 % 60]", 2)]:[ROUND_TIME / 100 % 6][ROUND_TIME / 100 % 10]</B>")
to_chat(world, "<BR>[TAB]Station Integrity: <B>[mode.station_was_nuked ? "<font color='red'>Destroyed</font>" : "[station_integrity]%"]</B>")
to_chat(world, "<BR>")
var/list/end_of_round_info = list()
end_of_round_info += "<BR>[TAB]Shift Duration: <B>[round(ROUND_TIME / 36000)]:[add_zero("[ROUND_TIME / 600 % 60]", 2)]:[ROUND_TIME / 100 % 6][ROUND_TIME / 100 % 10]</B>"
end_of_round_info += "<BR>[TAB]Station Integrity: <B>[mode.station_was_nuked ? "<font color='red'>Destroyed</font>" : "[station_integrity]%"]</B>"
end_of_round_info += "<BR>"
//Silicon laws report
for(var/mob/living/silicon/ai/aiPlayer in GLOB.mob_list)
var/ai_ckey = safe_get_ckey(aiPlayer)
if(aiPlayer.stat != 2)
to_chat(world, "<b>[aiPlayer.name] (Played by: [ai_ckey])'s laws at the end of the game were:</b>")
if(aiPlayer.stat != DEAD)
end_of_round_info += "<b>[aiPlayer.name] (Played by: [ai_ckey])'s laws at the end of the game were:</b>"
else
to_chat(world, "<b>[aiPlayer.name] (Played by: [ai_ckey])'s laws when it was deactivated were:</b>")
aiPlayer.show_laws(TRUE)
end_of_round_info += "<b>[aiPlayer.name] (Played by: [ai_ckey])'s laws when it was deactivated were:</b>"
aiPlayer.laws_sanity_check()
for(var/datum/ai_law/law as anything in aiPlayer.laws.sorted_laws)
if(law == aiPlayer.laws.zeroth_law)
end_of_round_info += "<span class='danger'>[law.get_index()]. [law.law]</span>"
else
end_of_round_info += "[law.get_index()]. [law.law]"
if(aiPlayer.connected_robots.len)
var/robolist = "<b>The AI's loyal minions were:</b> "
if(length(aiPlayer.connected_robots))
end_of_round_info += "<b>The AI's loyal minions were:</b> "
for(var/mob/living/silicon/robot/robo in aiPlayer.connected_robots)
var/robo_ckey = safe_get_ckey(robo)
robolist += "[robo.name][robo.stat ? " (Deactivated)" : ""] (Played by: [robo_ckey])"
to_chat(world, "[robolist]")
end_of_round_info += "[robo.name][robo.stat ? " (Deactivated)" : ""] (Played by: [robo_ckey])"
var/dronecount = 0
@@ -562,37 +567,38 @@ SUBSYSTEM_DEF(ticker)
var/robo_ckey = safe_get_ckey(robo)
if(!robo.connected_ai)
if(robo.stat != 2)
to_chat(world, "<b>[robo.name] (Played by: [robo_ckey]) survived as an AI-less borg! Its laws were:</b>")
if(robo.stat != DEAD)
end_of_round_info += "<b>[robo.name] (Played by: [robo_ckey]) survived as an AI-less borg! Its laws were:</b>"
else
to_chat(world, "<b>[robo.name] (Played by: [robo_ckey]) was unable to survive the rigors of being a cyborg without an AI. Its laws were:</b>")
end_of_round_info += "<b>[robo.name] (Played by: [robo_ckey]) was unable to survive the rigors of being a cyborg without an AI. Its laws were:</b>"
if(robo) //How the hell do we lose robo between here and the world messages directly above this?
robo.laws.show_laws(world)
robo.laws_sanity_check()
for(var/datum/ai_law/law as anything in robo.laws.sorted_laws)
if(law == robo.laws.zeroth_law)
end_of_round_info += "<span class='danger'>[law.get_index()]. [law.law]</span>"
else
end_of_round_info += "[law.get_index()]. [law.law]"
if(dronecount)
to_chat(world, "<b>There [dronecount>1 ? "were" : "was"] [dronecount] industrious maintenance [dronecount>1 ? "drones" : "drone"] this round.")
end_of_round_info += "<b>There [dronecount > 1 ? "were" : "was"] [dronecount] industrious maintenance [dronecount > 1 ? "drones" : "drone"] this round."
if(mode.eventmiscs.len)
var/emobtext = ""
if(length(mode.eventmiscs))
for(var/datum/mind/eventmind in mode.eventmiscs)
emobtext += printeventplayer(eventmind)
emobtext += "<br>"
emobtext += printobjectives(eventmind)
emobtext += "<br>"
emobtext += "<br>"
to_chat(world, emobtext)
end_of_round_info += printeventplayer(eventmind)
end_of_round_info += printobjectives(eventmind)
end_of_round_info += "<br>"
mode.declare_completion()//To declare normal completion.
//calls auto_declare_completion_* for all modes
for(var/handler in typesof(/datum/game_mode/proc))
if(findtext("[handler]","auto_declare_completion_"))
call(mode, handler)()
end_of_round_info += mode.get_end_of_round_antagonist_statistics()
for(var/datum/team/team in GLOB.antagonist_teams)
team.on_round_end()
// Save the data before end of the round griefing
SSpersistent_data.save()
to_chat(world, end_of_round_info.Join("<br>"))
// Display the scoreboard window
score.scoreboard()
@@ -602,9 +608,6 @@ SUBSYSTEM_DEF(ticker)
//Ask the event manager to print round end information
SSevents.RoundEnd()
// Save the data before end of the round griefing
SSpersistent_data.save()
//make big obvious note in game logs that round ended
log_game("///////////////////////////////////////////////////////")
log_game("///////////////////// ROUND ENDED /////////////////////")
+2 -5
View File
@@ -57,7 +57,7 @@ GLOBAL_LIST_INIT(possible_changeling_IDs, list("Alpha","Beta","Gamma","Delta","E
/datum/game_mode/proc/auto_declare_completion_changeling()
if(length(changelings))
var/text = "<FONT size = 3><B>The changelings were:</B></FONT>"
var/list/text = list("<FONT size = 3><B>The changelings were:</B></FONT>")
for(var/datum/mind/changeling in changelings)
var/changelingwin = TRUE
@@ -107,7 +107,4 @@ GLOBAL_LIST_INIT(possible_changeling_IDs, list("Alpha","Beta","Gamma","Delta","E
else
text += "<br><font color='red'><B>The changeling has failed.</B></font>"
SSblackbox.record_feedback("tally", "changeling_success", 1, "FAIL")
to_chat(world, text)
return TRUE
return text.Join("")
+2 -2
View File
@@ -376,7 +376,7 @@ GLOBAL_LIST_EMPTY(all_cults)
SSticker.mode_result = "cult loss - staff stopped the cult"
to_chat(world, "<span class='warning'> <FONT size = 3>The staff managed to stop the cult!</FONT></span>")
var/endtext
var/list/endtext = list()
endtext += "<br><b>The cultists' objectives were:</b>"
for(var/datum/objective/obj in cult_objs.presummon_objs)
endtext += "<br>[obj.explanation_text] - "
@@ -391,5 +391,5 @@ GLOBAL_LIST_EMPTY(all_cults)
else
endtext += "<font color='green'><B>Success!</B></font>"
to_chat(world, endtext)
to_chat(world, endtext.Join(""))
..()
+13
View File
@@ -505,3 +505,16 @@
var/datum/atom_hud/antag/antaghud = GLOB.huds[ANTAG_HUD_EVENTMISC]
antaghud.leave_hud(mob_mind.current)
set_antag_hud(mob_mind.current, null)
/// Gets the value of all end of round stats through auto_declare and returns them
/datum/game_mode/proc/get_end_of_round_antagonist_statistics()
. = list()
. += auto_declare_completion_traitor()
. += auto_declare_completion_vampire()
. += auto_declare_completion_enthralled()
. += auto_declare_completion_changeling()
. += auto_declare_completion_nuclear()
. += auto_declare_completion_wizard()
. += auto_declare_completion_revolution()
. += auto_declare_completion_abduction()
listclearnulls(.)
@@ -211,22 +211,22 @@
return 1
/datum/game_mode/proc/auto_declare_completion_abduction()
var/text = ""
if(abductors.len)
var/list/text = list()
if(length(abductors))
text += "<br><span class='big'><b>The abductors were:</b></span><br>"
for(var/datum/mind/abductor_mind in abductors)
text += printplayer(abductor_mind)
text += "<br>"
text += printobjectives(abductor_mind)
text += "<br>"
if(abductees.len)
if(length(abductees))
text += "<br><span class='big'><b>The abductees were:</b></span><br>"
for(var/datum/mind/abductee_mind in abductees)
text += printplayer(abductee_mind)
text += "<br>"
text += printobjectives(abductee_mind)
text += "<br>"
to_chat(world, text)
return text.Join("")
//Landmarks
// TODO: Split into seperate landmarks for prettier ships
+3 -4
View File
@@ -389,8 +389,8 @@
/datum/game_mode/proc/auto_declare_completion_nuclear()
if(syndicates.len || GAMEMODE_IS_NUCLEAR)
var/text = "<br><FONT size=3><B>The syndicate operatives were:</B></FONT>"
if(length(syndicates) || GAMEMODE_IS_NUCLEAR)
var/list/text = list("<br><FONT size=3><B>The syndicate operatives were:</B></FONT>")
var/purchases = ""
var/TC_uses = 0
@@ -420,8 +420,7 @@
if(TC_uses==0 && station_was_nuked && !is_operatives_are_dead())
text += "<BIG><IMG CLASS=icon SRC=\ref['icons/badass.dmi'] ICONSTATE='badass'></BIG>"
to_chat(world, text)
return 1
return text.Join("")
/proc/nukelastname(mob/M as mob) //--All praise goes to NEO|Phyte, all blame goes to DH, and it was Cindi-Kate's idea. Also praise Urist for copypasta ho.
var/randomname = pick(GLOB.last_names)
+3 -4
View File
@@ -182,15 +182,14 @@
num_revs++
if(num_survivors)
to_chat(world, "[TAB]Command's Approval Rating: <B>[100 - round((num_revs/num_survivors)*100, 0.1)]%</B>") // % of loyal crew
var/text = "<br><font size=3><b>The head revolutionaries were:</b></font>"
var/list/text = list("<br><font size=3><b>The head revolutionaries were:</b></font>")
for(var/datum/mind/headrev in head_revolutionaries)
text += printplayer(headrev, 1)
text += "<br>"
to_chat(world, text)
// we dont show the revolutionaries because there are a LOT of them
text = "<br><font size=3><b>The heads of staff were:</b></font>"
text = list("<br><font size=3><b>The heads of staff were:</b></font>")
var/list/heads = get_all_heads()
for(var/datum/mind/head in heads)
var/target = (head in targets)
@@ -198,7 +197,7 @@
text += "<span class='boldannounce'>Target</span>"
text += printplayer(head, 1)
text += "<br>"
to_chat(world, text)
return text.Join("")
/datum/game_mode/revolution/set_scoreboard_vars() // this proc is never called, someone remove it
var/datum/scoreboard/scoreboard = SSticker.score
+2 -3
View File
@@ -72,7 +72,7 @@
/datum/game_mode/proc/auto_declare_completion_traitor()
if(length(traitors))
var/text = "<FONT size = 2><B>The traitors were:</B></FONT><br>"
var/list/text = list("<FONT size = 2><B>The traitors were:</B></FONT><br>")
for(var/datum/mind/traitor in traitors)
var/traitorwin = TRUE
text += printplayer(traitor)
@@ -159,5 +159,4 @@
text += "<br><br><b>The code phrases were:</b> <span class='danger'>[phrases]</span><br>\
<b>The code responses were:</b> <span class='danger'>[responses]</span><br><br>"
to_chat(world, text)
return TRUE
return text.Join("")
@@ -51,7 +51,7 @@
if(!length(vampires))
return
var/text = "<FONT size = 2><B>The vampires were:</B></FONT>"
var/list/text = list("<FONT size = 2><B>The vampires were:</B></FONT>")
for(var/datum/mind/vampire in vampires)
var/traitorwin = TRUE
var/datum/antagonist/vampire/V = vampire.has_antag_datum(/datum/antagonist/vampire)
@@ -101,14 +101,13 @@
else
text += "<br><font color='red'><B>The [special_role_text] has failed!</B></font>"
SSblackbox.record_feedback("tally", "vampire_success", 1, "FAIL")
to_chat(world, text)
return TRUE
return text.Join("")
/datum/game_mode/proc/auto_declare_completion_enthralled()
if(!length(vampire_enthralled))
return
var/text = "<FONT size = 2><B>The Enthralled were:</B></FONT>"
var/list/text = list("<FONT size = 2><B>The Enthralled were:</B></FONT>")
for(var/datum/mind/mind in vampire_enthralled)
text += "<br>[mind.get_display_key()] was [mind.name] ("
if(mind.current)
@@ -121,6 +120,5 @@
else
text += "body destroyed"
text += ")"
to_chat(world, text)
return TRUE
return text.Join("")
+3 -4
View File
@@ -191,8 +191,8 @@
return 1
/datum/game_mode/proc/auto_declare_completion_wizard()
if(wizards.len)
var/text = "<br><font size=3><b>the wizards/witches were:</b></font>"
if(length(wizards))
var/list/text = list("<br><font size=3><b>the wizards/witches were:</b></font>")
for(var/datum/mind/wizard in wizards)
@@ -236,8 +236,7 @@
i++
text += "<br>"
to_chat(world, text)
return 1
return text.Join("")
//OTHER PROCS