From d8f472289d3ef23ff6c9ba9dcb801fbd21345e3d Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Wed, 20 Aug 2025 20:24:47 +0200 Subject: [PATCH] ticker followup (#18275) * ticker followup * . * . * fix the timer * . * move sleep out of ticker * area * strip improper --- code/_helpers/chat.dm | 4 ++-- code/_helpers/game.dm | 2 +- code/_helpers/roundend.dm | 22 +++++++++---------- .../roundstats => _helpers}/roundstats.dm | 19 ++++++++-------- code/_helpers/text.dm | 2 +- code/_helpers/unsorted.dm | 3 --- code/controllers/hooks-defs.dm | 6 ----- code/controllers/subsystems/ticker.dm | 14 +++++++++++- code/datums/browser.dm | 2 +- code/game/gamemodes/epidemic/epidemic.dm | 4 ++-- code/game/gamemodes/game_mode.dm | 22 ++++++++++--------- code/game/gamemodes/meteor/meteor.dm | 3 +-- code/game/gamemodes/nuclear/nuclear.dm | 6 ++--- .../objects/items/weapons/storage/fancy.dm | 2 +- code/modules/food/food/lunch.dm | 2 +- code/modules/mob/living/carbon/human/death.dm | 2 +- code/modules/telesci/gps_advanced.dm | 2 +- code/modules/tgui/modules/communications.dm | 2 +- code/modules/tooltip/tooltip.dm | 3 +-- vorestation.dme | 2 +- 20 files changed, 62 insertions(+), 62 deletions(-) rename code/{datums/roundstats => _helpers}/roundstats.dm (88%) diff --git a/code/_helpers/chat.dm b/code/_helpers/chat.dm index dbb124b9508..976890f93a1 100644 --- a/code/_helpers/chat.dm +++ b/code/_helpers/chat.dm @@ -7,8 +7,8 @@ /proc/send2adminchat(category, message, embed_links = FALSE) set waitfor = FALSE - category = replacetext(replacetext(category, "\proper", ""), "\improper", "") - message = replacetext(replacetext(message, "\proper", ""), "\improper", "") + category = strip_improper(category) + message = strip_improper(message) if(!embed_links) message = GLOB.has_discord_embeddable_links.Replace(replacetext(message, "`", ""), " ```$1``` ") world.TgsTargetedChatBroadcast(new /datum/tgs_message_content("[category] | [message]"), TRUE) diff --git a/code/_helpers/game.dm b/code/_helpers/game.dm index 4b6c4a5715e..da1a42325b7 100644 --- a/code/_helpers/game.dm +++ b/code/_helpers/game.dm @@ -37,7 +37,7 @@ var/area/A = isarea(X) ? X : get_area(X) if(!A) return null - return format_text ? format_text(A.name) : A.name + return format_text ? strip_improper(A.name) : A.name /** Checks if any living humans are in a given area. */ /proc/area_is_occupied(var/area/myarea) diff --git a/code/_helpers/roundend.dm b/code/_helpers/roundend.dm index 3bd043cd584..9fbae7e33f6 100644 --- a/code/_helpers/roundend.dm +++ b/code/_helpers/roundend.dm @@ -5,7 +5,7 @@ roundend_callbacks.InvokeAsync() LAZYCLEARLIST(round_end_events) - to_world(span_filter_system("


A round of [mode.name] has ended!

")) + to_chat(world, span_filter_system("


A round of [mode.name] has ended!

")) for(var/mob/Player in GLOB.player_list) if(Player.mind && !isnewplayer(Player)) if(Player.stat != DEAD) @@ -28,20 +28,20 @@ to_chat(Player, span_filter_system(span_red(span_bold("You did not survive the events on [station_name()]...")))) else to_chat(Player, span_filter_system(span_red(span_bold("You did not survive the events on [station_name()]...")))) - to_world(span_filter_system("
")) + to_chat(world, span_filter_system("
")) for (var/mob/living/silicon/ai/aiPlayer in GLOB.mob_list) if (aiPlayer.stat != 2) - to_world(span_filter_system(span_bold("[aiPlayer.name]'s laws at the end of the round were:"))) // VOREStation edit + to_chat(world, span_filter_system(span_bold("[aiPlayer.name]'s laws at the end of the round were:"))) // VOREStation edit else - to_world(span_filter_system(span_bold("[aiPlayer.name]'s laws when it was deactivated were:"))) // VOREStation edit + to_chat(world, span_filter_system(span_bold("[aiPlayer.name]'s laws when it was deactivated were:"))) // VOREStation edit aiPlayer.show_laws(1) if (aiPlayer.connected_robots.len) var/robolist = span_bold("The AI's loyal minions were:") + " " for(var/mob/living/silicon/robot/robo in aiPlayer.connected_robots) robolist += "[robo.name][robo.stat?" (Deactivated), ":", "]" // VOREStation edit - to_world(span_filter_system("[robolist]")) + to_chat(world, span_filter_system("[robolist]")) var/dronecount = 0 @@ -58,17 +58,18 @@ if (!robo.connected_ai) if (robo.stat != 2) - to_world(span_filter_system(span_bold("[robo.name] survived as an AI-less stationbound synthetic! Its laws were:"))) // VOREStation edit + to_chat(world, span_filter_system(span_bold("[robo.name] survived as an AI-less stationbound synthetic! Its laws were:"))) // VOREStation edit else - to_world(span_filter_system(span_bold("[robo.name] was unable to survive the rigors of being a stationbound synthetic without an AI. Its laws were:"))) // VOREStation edit + to_chat(world, span_filter_system(span_bold("[robo.name] was unable to survive the rigors of being a stationbound synthetic without an AI. Its laws were:"))) // VOREStation edit if(robo) //How the hell do we lose robo between here and the world messages directly above this? robo.laws.show_laws(world) if(dronecount) - to_world(span_filter_system(span_bold("There [dronecount>1 ? "were" : "was"] [dronecount] industrious maintenance [dronecount>1 ? "drones" : "drone"] at the end of this round."))) + to_chat(world, span_filter_system(span_bold("There [dronecount>1 ? "were" : "was"] [dronecount] industrious maintenance [dronecount>1 ? "drones" : "drone"] at the end of this round."))) - mode.declare_completion()//To declare normal completion. + var/extra_delay = mode.declare_completion()//To declare normal completion. + RoundTrivia() //Ask the event manager to print round end information SSevents.RoundEnd() @@ -92,9 +93,8 @@ SSdbcore.SetRoundEnd() - sleep(5 SECONDS) ready_for_reboot = TRUE - standard_reboot() + addtimer(CALLBACK(src, PROC_REF(standard_reboot)), 5 SECONDS + extra_delay) /datum/controller/subsystem/ticker/proc/standard_reboot() if(ready_for_reboot) diff --git a/code/datums/roundstats/roundstats.dm b/code/_helpers/roundstats.dm similarity index 88% rename from code/datums/roundstats/roundstats.dm rename to code/_helpers/roundstats.dm index 64cb6d50059..8b91b575d53 100644 --- a/code/datums/roundstats/roundstats.dm +++ b/code/_helpers/roundstats.dm @@ -21,14 +21,14 @@ GLOBAL_VAR_INIT(items_sold_shift_roundstat, 0) GLOBAL_VAR_INIT(disposals_flush_shift_roundstat, 0) GLOBAL_VAR_INIT(rocks_drilled_roundstat, 0) GLOBAL_VAR_INIT(mech_destroyed_roundstat, 0) -GLOBAL_VAR_INIT(prey_eaten_roundstat, 0) //VOREStation Edit - Obviously -GLOBAL_VAR_INIT(prey_absorbed_roundstat, 0) //VOREStation Edit - Obviously -GLOBAL_VAR_INIT(prey_digested_roundstat, 0) //VOREStation Edit - Obviously -GLOBAL_VAR_INIT(items_digested_roundstat, 0) //VOREStation Edit - Obviously -GLOBAL_LIST_EMPTY(security_printer_tickets) //VOREStation Edit +GLOBAL_VAR_INIT(prey_eaten_roundstat, 0) +GLOBAL_VAR_INIT(prey_absorbed_roundstat, 0) +GLOBAL_VAR_INIT(prey_digested_roundstat, 0) +GLOBAL_VAR_INIT(items_digested_roundstat, 0) +GLOBAL_LIST_EMPTY(security_printer_tickets) GLOBAL_LIST_EMPTY(refined_chems_sold) -/hook/roundend/proc/RoundTrivia()//bazinga +/datum/controller/subsystem/ticker/proc/RoundTrivia()//bazinga var/list/valid_stats_list = list() //This is to be populated with the good shit if(GLOB.lost_limbs_shift_roundstat > 1) @@ -56,7 +56,6 @@ GLOBAL_LIST_EMPTY(refined_chems_sold) else if(GLOB.disposals_flush_shift_roundstat > 40) valid_stats_list.Add("The disposal system flushed a whole [GLOB.disposals_flush_shift_roundstat] times for this shift. We should really invest in waste treatement.") - //VOREStation add Start - Ticket time! if(GLOB.security_printer_tickets.len) valid_stats_list.Add(span_danger("[GLOB.security_printer_tickets.len] unique security tickets were issued today!") + "
Examples include:") var/good_num = 5 @@ -73,7 +72,7 @@ GLOBAL_LIST_EMPTY(refined_chems_sold) good_num = 0 if(GLOB.prey_eaten_roundstat > 0) - valid_stats_list.Add("A total of [GLOB.prey_eaten_roundstat] individuals were eaten today!") + valid_stats_list.Add("Individuals were eaten a total of [GLOB.prey_eaten_roundstat] times today!") if(GLOB.prey_digested_roundstat > 0) valid_stats_list.Add("A total of [GLOB.prey_digested_roundstat] individuals were digested today!") if(GLOB.prey_absorbed_roundstat > 0) @@ -100,7 +99,7 @@ GLOBAL_LIST_EMPTY(refined_chems_sold) valid_stats_list.Add("For a total of: [points] points, or [end_dols] [end_dols > 1 ? "thalers" : "thaler"]!") if(LAZYLEN(valid_stats_list)) - to_world(span_world("Shift trivia!")) + to_chat(world, span_world("Shift trivia!")) for(var/body in valid_stats_list) - to_world(span_filter_system("[body]")) + to_chat(world, span_filter_system("[body]")) diff --git a/code/_helpers/text.dm b/code/_helpers/text.dm index 09b59195a5d..10497416e66 100644 --- a/code/_helpers/text.dm +++ b/code/_helpers/text.dm @@ -400,7 +400,7 @@ GLOBAL_LIST_EMPTY(text_tag_cache) * Strip out the special beyond characters for \proper and \improper * from text that will be sent to the browser. */ -/proc/strip_improper(var/text) +/proc/strip_improper(text) return replacetext(replacetext(text, "\proper", ""), "\improper", "") /proc/pencode2html(t) diff --git a/code/_helpers/unsorted.dm b/code/_helpers/unsorted.dm index 3b71e555907..f9337260204 100644 --- a/code/_helpers/unsorted.dm +++ b/code/_helpers/unsorted.dm @@ -1167,9 +1167,6 @@ var/list/WALLITEMS = list( return 1 return 0 -/proc/format_text(text) - return replacetext(replacetext(text,"\proper ",""),"\improper ","") - /proc/topic_link(var/datum/D, var/arglist, var/content) if(istype(arglist,/list)) arglist = list2params(arglist) diff --git a/code/controllers/hooks-defs.dm b/code/controllers/hooks-defs.dm index b333f96ec9e..0c468b358ce 100644 --- a/code/controllers/hooks-defs.dm +++ b/code/controllers/hooks-defs.dm @@ -10,12 +10,6 @@ */ /hook/roundstart -/** - * Roundend hook. - * Called in gameticker.dm when a round ends. - */ -/hook/roundend - /** * Death hook. * Called in death.dm when someone dies. diff --git a/code/controllers/subsystems/ticker.dm b/code/controllers/subsystems/ticker.dm index b0350a32564..2c4f96aa85c 100644 --- a/code/controllers/subsystems/ticker.dm +++ b/code/controllers/subsystems/ticker.dm @@ -454,7 +454,9 @@ SUBSYSTEM_DEF(ticker) return if(!delay) - delay = CONFIG_GET(number/round_end_countdown) * 10 + delay = CONFIG_GET(number/round_end_countdown) SECONDS + if(delay >= 60 SECONDS) + addtimer(CALLBACK(src, PROC_REF(announce_countodwn), delay), 60 SECONDS) var/skip_delay = check_rights() if(delay_end && !skip_delay) @@ -475,6 +477,16 @@ SUBSYSTEM_DEF(ticker) UNTIL(round_end_sound_sent || (world.time - start_wait) > (delay * 2)) //don't wait forever reboot_timer = addtimer(CALLBACK(src, PROC_REF(reboot_callback), reason, end_string), delay - (world.time - start_wait), TIMER_STOPPABLE) +/datum/controller/subsystem/ticker/proc/announce_countodwn(remaining_time) + if(remaining_time >= 60 SECONDS) + remaining_time -= 60 SECONDS + to_chat(world, span_boldannounce("Rebooting World in [DisplayTimeText(remaining_time)].")) + addtimer(CALLBACK(src, PROC_REF(announce_countodwn), remaining_time), 60 SECONDS) + return + if(remaining_time > 0) + addtimer(CALLBACK(src, PROC_REF(announce_countodwn), 0), remaining_time) + return + to_chat(world, span_boldannounce("Rebooting World.")) /datum/controller/subsystem/ticker/proc/reboot_callback(reason, end_string) if(end_string) diff --git a/code/datums/browser.dm b/code/datums/browser.dm index c6369ca21f0..081016629ff 100644 --- a/code/datums/browser.dm +++ b/code/datums/browser.dm @@ -23,7 +23,7 @@ RegisterSignal(user, COMSIG_PARENT_QDELETING, PROC_REF(user_deleted)) src.window_id = window_id if (title) - src.title = format_text(title) + src.title = strip_improper(title) if (width) src.width = width if (height) diff --git a/code/game/gamemodes/epidemic/epidemic.dm b/code/game/gamemodes/epidemic/epidemic.dm index dd0a8ee2b6e..9919a51b7b3 100644 --- a/code/game/gamemodes/epidemic/epidemic.dm +++ b/code/game/gamemodes/epidemic/epidemic.dm @@ -194,5 +194,5 @@ else if(finished == 2) feedback_set_details("round_end_result","loss - rev heads killed") to_world(span_boldannounce(span_large("The crew succumbed to the epidemic!"))) - ..() - return 1 + + return ..() diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index f7cdf7dd358..99a193a120c 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -282,18 +282,22 @@ GLOBAL_LIST_EMPTY(additional_antag_types) /datum/game_mode/proc/cleanup() //This is called when the round has ended but not the game, if any cleanup would be necessary in that case. return -/datum/game_mode/proc/declare_completion() +/datum/game_mode/proc/declare_antag_goals() + for(var/datum/antagonist/antag in antag_templates) + sleep(10) + antag.check_victory() + antag.print_player_summary() + addtimer(CALLBACK(src, PROC_REF(finish_completion_declatration)), 1 SECOND) - var/is_antag_mode = (antag_templates && antag_templates.len) +/datum/game_mode/proc/declare_completion() + var/is_antag_mode = LAZYLEN(antag_templates) check_victory() if(is_antag_mode) - sleep(10) - for(var/datum/antagonist/antag in antag_templates) - sleep(10) - antag.check_victory() - antag.print_player_summary() - sleep(10) + is_antag_mode += 2 + addtimer(CALLBACK(src, PROC_REF(declare_antag_goals)), 1 SECOND) + return is_antag_mode SECONDS +/datum/game_mode/proc/finish_completion_declatration() var/clients = 0 var/surviving_humans = 0 var/surviving_total = 0 @@ -380,8 +384,6 @@ GLOBAL_LIST_EMPTY(additional_antag_types) ) ) - return 0 - /datum/game_mode/proc/check_win() //universal trigger to be called at mob death, nuke explosion, etc. To be called from everywhere. return 0 diff --git a/code/game/gamemodes/meteor/meteor.dm b/code/game/gamemodes/meteor/meteor.dm index a17781bd16d..e9668895c1d 100644 --- a/code/game/gamemodes/meteor/meteor.dm +++ b/code/game/gamemodes/meteor/meteor.dm @@ -42,7 +42,6 @@ feedback_set_details("round_end_result","end - evacuation") feedback_set("round_end_result",survivors) - ..() - return 1 + return ..() #undef METEOR_DELAY diff --git a/code/game/gamemodes/nuclear/nuclear.dm b/code/game/gamemodes/nuclear/nuclear.dm index 0e460f6bfa2..33ab06034dd 100644 --- a/code/game/gamemodes/nuclear/nuclear.dm +++ b/code/game/gamemodes/nuclear/nuclear.dm @@ -34,8 +34,7 @@ GLOBAL_LIST_EMPTY(nuke_disks) /datum/game_mode/nuclear/declare_completion() if(CONFIG_GET(flag/objectives_disabled)) - ..() - return + return ..() var/disk_rescued = 1 for(var/obj/item/disk/nuclear/D in GLOB.nuke_disks) var/disk_area = get_area(D) @@ -89,5 +88,4 @@ GLOBAL_LIST_EMPTY(nuke_disks) to_world(span_filter_system(span_large(span_bold("Neutral Victory")))) to_world(span_filter_system(span_bold("Round was mysteriously interrupted!"))) - ..() - return + return ..() diff --git a/code/game/objects/items/weapons/storage/fancy.dm b/code/game/objects/items/weapons/storage/fancy.dm index 13c403c1fe0..46a6c62696f 100644 --- a/code/game/objects/items/weapons/storage/fancy.dm +++ b/code/game/objects/items/weapons/storage/fancy.dm @@ -439,7 +439,7 @@ ..() /obj/item/storage/fancy/cigar/choiba - name = "/improper Choiba cigar case" + name = "\improper Choiba cigar case" desc = "A fancy case for holding your cigars when you are not smoking them." description_fluff = "The exquisite wooden case bears the markings of the \ Choiba cigar company based out of Cuba. The perfectly humidized case keeps \ diff --git a/code/modules/food/food/lunch.dm b/code/modules/food/food/lunch.dm index c7642406933..98b458bdb46 100644 --- a/code/modules/food/food/lunch.dm +++ b/code/modules/food/food/lunch.dm @@ -178,7 +178,7 @@ var/list/lunchables_ethanol_reagents_ = list(/datum/reagent/ethanol/acid_spit, /proc/init_lunchable_list(var/list/lunches) . = list() for(var/obj/O as anything in lunches) - var/name = replacetext(initial(O.name), new/regex("\improper *", "g"), "") + var/name = strip_improper(initial(O.name)) .[name] = O return sortAssoc(.) diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index eb98f42a43d..885d60686ff 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -91,7 +91,7 @@ if(!isbelly(loc) || !vore_death_privacy) for(var/mob/observer/dead/O in GLOB.mob_list) if(O.client?.prefs?.read_preference(/datum/preference/toggle/show_dsay)) - to_chat(O, span_deadsay(span_bold("[src]") + " has died in " + span_bold("[get_area(src)]") + ". [ghost_follow_link(src, O)] ")) + to_chat(O, span_deadsay(span_bold("[src]") + " has died in " + span_bold(strip_improper("[A]")) + ". [ghost_follow_link(src, O)] ")) if(!gibbed && !isbelly(loc)) playsound(src, pick(get_species_sound(get_gendered_sound(src))["death"]), src.species.death_volume, 1, 20, volume_channel = VOLUME_CHANNEL_DEATH_SOUNDS) diff --git a/code/modules/telesci/gps_advanced.dm b/code/modules/telesci/gps_advanced.dm index b0da9d006f5..3cd14985300 100644 --- a/code/modules/telesci/gps_advanced.dm +++ b/code/modules/telesci/gps_advanced.dm @@ -43,7 +43,7 @@ if(G.emped == 1) t += "
[tracked_gpstag]: ERROR" else - t += "
[tracked_gpstag]: [format_text(gps_area.name)] ([pos.x], [pos.y], [pos.z])" + t += "
[tracked_gpstag]: [strip_improper(gps_area.name)] ([pos.x], [pos.y], [pos.z])" var/datum/browser/popup = new(user, "GPS", name, 600, 450) popup.set_content(t) diff --git a/code/modules/tgui/modules/communications.dm b/code/modules/tgui/modules/communications.dm index 45bd3390db4..8b8148f03d2 100644 --- a/code/modules/tgui/modules/communications.dm +++ b/code/modules/tgui/modules/communications.dm @@ -141,7 +141,7 @@ data["message_current_id"] = current_viewing_message_id data["message_current"] = current_viewing_message - // data["lastCallLoc"] = SSshuttle.emergencyLastCallLoc ? format_text(SSshuttle.emergencyLastCallLoc.name) : null + // data["lastCallLoc"] = SSshuttle.emergencyLastCallLoc ? strip_improper(SSshuttle.emergencyLastCallLoc.name) : null data["msg_cooldown"] = message_cooldown ? (round((message_cooldown - world.time) / 10)) : 0 data["cc_cooldown"] = centcomm_message_cooldown ? (round((centcomm_message_cooldown - world.time) / 10)) : 0 diff --git a/code/modules/tooltip/tooltip.dm b/code/modules/tooltip/tooltip.dm index cd267521e5c..948bdab5605 100644 --- a/code/modules/tooltip/tooltip.dm +++ b/code/modules/tooltip/tooltip.dm @@ -76,8 +76,7 @@ Notes: content = "

[content]

" // Strip macros from item names - title = replacetext(title, "\proper", "") - title = replacetext(title, "\improper", "") + title = strip_improper(title) //Make our dumb param object params = {"{ "cursor": "[params]", "screenLoc": "[thing.screen_loc]" }"} diff --git a/vorestation.dme b/vorestation.dme index db485b27d4a..3d341ffed99 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -270,6 +270,7 @@ #include "code\_helpers\names.dm" #include "code\_helpers\refinery.dm" #include "code\_helpers\roundend.dm" +#include "code\_helpers\roundstats.dm" #include "code\_helpers\sanitize_values.dm" #include "code\_helpers\screen_objs.dm" #include "code\_helpers\shell.dm" @@ -777,7 +778,6 @@ #include "code\datums\repositories\repository.dm" #include "code\datums\repositories\unique.dm" #include "code\datums\roundstats\_defines_local.dm" -#include "code\datums\roundstats\roundstats.dm" #include "code\datums\supplypacks\atmospherics.dm" #include "code\datums\supplypacks\contraband.dm" #include "code\datums\supplypacks\costumes.dm"