From 6896a2e481193dfe41e5808e532fc97e2af20f5f Mon Sep 17 00:00:00 2001 From: SandPoot Date: Thu, 27 Jul 2023 21:09:41 -0300 Subject: [PATCH 1/2] what was it again? --- .../configuration/entries/general.dm | 4 ++ code/datums/station_traits/neutral_traits.dm | 56 +++++++++++++++++++ config/entries/general.txt | 18 ++++++ 3 files changed, 78 insertions(+) diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index b7a92ee48f..ec79caf145 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -345,3 +345,7 @@ config_entry_value = 5 //ambition end +/datum/config_entry/keyed_list/randomizing_station_name_message + key_mode = KEY_MODE_TEXT + value_mode = VALUE_MODE_TEXT + lowercase = FALSE diff --git a/code/datums/station_traits/neutral_traits.dm b/code/datums/station_traits/neutral_traits.dm index 19480f6672..e9426955ff 100644 --- a/code/datums/station_traits/neutral_traits.dm +++ b/code/datums/station_traits/neutral_traits.dm @@ -114,3 +114,59 @@ /datum/station_trait/announcement_medbot/New() . = ..() SSstation.announcer = /datum/centcom_announcer/medbot + +/datum/station_trait/randomizing_station_name + name = "Randomizing station name" + show_in_report = TRUE + report_message = "Due to legal reasons or other, we might not be able to settle on a station name." + trait_processes = TRUE + COOLDOWN_DECLARE(randomizing_cooldown) + var/trigger_every = 5 MINUTES + blacklist = list(/datum/station_trait/randomizing_station_name/fast, /datum/station_trait/randomizing_station_name/slow) + +/datum/station_trait/randomizing_station_name/on_round_start() + . = ..() + COOLDOWN_START(src, randomizing_cooldown, trigger_every) + +/datum/station_trait/randomizing_station_name/process(delta_time) + if(!COOLDOWN_FINISHED(src, randomizing_cooldown)) + return + + COOLDOWN_START(src, randomizing_cooldown, trigger_every) + + var/new_name = new_station_name() + + var/pick_entry = pick(CONFIG_GET(keyed_list/randomizing_station_name_message)) + var/centcom_announcement = CONFIG_GET(keyed_list/randomizing_station_name_message)[pick_entry] + + // Replace with CURRENT station name + centcom_announcement = replacetext(centcom_announcement, "%CURRENT_STATION_NAME%", station_name()) + + // Replace with NEW station name + centcom_announcement = replacetext(centcom_announcement, "%NEW_STATION_NAME%", new_name) + + // Take a CREWMEMBER's name for the goofs + if(findtext(centcom_announcement, "%RANDOM_CREWMEMBER%")) + var/crewmember = locate(/mob/living/carbon/human) in GLOB.alive_mob_list + if(!crewmember) + crewmember = random_unique_name() + centcom_announcement = replacetext(centcom_announcement, "%RANDOM_CREWMEMBER%", crewmember) + + // Replace with a completely RANDOM name + if(findtext(centcom_announcement, "%RANDOM_NAME%")) + var/name = random_unique_name() + centcom_announcement = replacetext(centcom_announcement, "%RANDOM_NAME%", name) + + set_station_name(new_name) + + print_command_report(centcom_announcement) + +/datum/station_trait/randomizing_station_name/fast + name = "Randomizing station name - Fast" + trigger_every = 3 MINUTES + blacklist = list(/datum/station_trait/randomizing_station_name, /datum/station_trait/randomizing_station_name/slow) + +/datum/station_trait/randomizing_station_name/slow + name = "Randomizing station name - Slow" + trigger_every = 10 MINUTES + blacklist = list(/datum/station_trait/randomizing_station_name/fast, /datum/station_trait/randomizing_station_name) diff --git a/config/entries/general.txt b/config/entries/general.txt index ad8792c10a..ced33c096b 100644 --- a/config/entries/general.txt +++ b/config/entries/general.txt @@ -498,3 +498,21 @@ PAI_CUSTOM_HOLOFORMS ## Do station renames from the station charter require admin approval to pass, as opposed to autoapproving if not denied. STATION_NAME_NEEDS_APPROVAL + +## Strings for the station trait "Randomizing station name" +## Also each value needs an unique key because keyed_lists are dumb +RANDOMIZING_STATION_NAME_MESSAGE 1 Due to internal affairs, the station is now named %NEW_STATION_NAME%. +RANDOMIZING_STATION_NAME_MESSAGE 2 The solar system's government has formally requested that the station now be named %NEW_STATION_NAME%. +RANDOMIZING_STATION_NAME_MESSAGE 3 A gorilla broke into the office and destroyed a bunch of paperwork. We don't know what your station's old name was. It's now %NEW_STATION_NAME%. +RANDOMIZING_STATION_NAME_MESSAGE 4 An intern said %NEW_STATION_NAME% would be a cool name. That's your station's name now. +RANDOMIZING_STATION_NAME_MESSAGE 5 Our predictive language model has renamed your station to %NEW_STATION_NAME%. +RANDOMIZING_STATION_NAME_MESSAGE 6 It's %NEW_STATION_NAME% now. +RANDOMIZING_STATION_NAME_MESSAGE 7 The CEO demanded that your station be named %NEW_STATION_NAME%. +RANDOMIZING_STATION_NAME_MESSAGE 8 Our intern accidentally wiped the database, so your station needs a new name: %NEW_STATION_NAME%. +RANDOMIZING_STATION_NAME_MESSAGE 9 Due to copyright infringement, the station is now temporarily renamed to %NEW_STATION_NAME%. +RANDOMIZING_STATION_NAME_MESSAGE 10 Due to recent corporate acquisitions, the station has been rebranded to %NEW_STATION_NAME%. +RANDOMIZING_STATION_NAME_MESSAGE 11 %NEW_STATION_NAME%. +RANDOMIZING_STATION_NAME_MESSAGE 12 %NEW_STATION_NAME%? %NEW_STATION_NAME%! %NEW_STATION_NAME%!!!!!!!! +RANDOMIZING_STATION_NAME_MESSAGE 13 A popular social network application had already claimed the trademark of %CURRENT_STATION_NAME%, the station has been renamed to %NEW_STATION_NAME%. +RANDOMIZING_STATION_NAME_MESSAGE 14 We're pulling a prank on %RANDOM_CREWMEMBER%, so we've changed the station's name to %NEW_STATION_NAME%. +RANDOMIZING_STATION_NAME_MESSAGE 15 %RANDOM_NAME% made us change the station name, which is now %NEW_STATION_NAME%. From bfe07112ff22c6c9cfded2235eb976f96cac34b4 Mon Sep 17 00:00:00 2001 From: SandPoot Date: Fri, 28 Jul 2023 13:53:09 -0300 Subject: [PATCH 2/2] i hate keyed_list, i'm not keeping it in --- .../configuration/entries/general.dm | 5 ----- code/datums/station_traits/neutral_traits.dm | 5 +++-- config/entries/general.txt | 18 ------------------ strings/randomizing_station_name_messages.txt | 15 +++++++++++++++ 4 files changed, 18 insertions(+), 25 deletions(-) create mode 100644 strings/randomizing_station_name_messages.txt diff --git a/code/controllers/configuration/entries/general.dm b/code/controllers/configuration/entries/general.dm index ec79caf145..ddb54d6957 100644 --- a/code/controllers/configuration/entries/general.dm +++ b/code/controllers/configuration/entries/general.dm @@ -344,8 +344,3 @@ /datum/config_entry/number/max_ambitions // Maximum number of ambitions a mind can store. config_entry_value = 5 //ambition end - -/datum/config_entry/keyed_list/randomizing_station_name_message - key_mode = KEY_MODE_TEXT - value_mode = VALUE_MODE_TEXT - lowercase = FALSE diff --git a/code/datums/station_traits/neutral_traits.dm b/code/datums/station_traits/neutral_traits.dm index e9426955ff..8936951b10 100644 --- a/code/datums/station_traits/neutral_traits.dm +++ b/code/datums/station_traits/neutral_traits.dm @@ -115,6 +115,8 @@ . = ..() SSstation.announcer = /datum/centcom_announcer/medbot +GLOBAL_LIST_INIT(randomizing_station_name_messages, world.file2list("strings/randomizing_station_name_messages.txt")) + /datum/station_trait/randomizing_station_name name = "Randomizing station name" show_in_report = TRUE @@ -136,8 +138,7 @@ var/new_name = new_station_name() - var/pick_entry = pick(CONFIG_GET(keyed_list/randomizing_station_name_message)) - var/centcom_announcement = CONFIG_GET(keyed_list/randomizing_station_name_message)[pick_entry] + var/centcom_announcement = pick(GLOB.randomizing_station_name_messages) // Replace with CURRENT station name centcom_announcement = replacetext(centcom_announcement, "%CURRENT_STATION_NAME%", station_name()) diff --git a/config/entries/general.txt b/config/entries/general.txt index ced33c096b..ad8792c10a 100644 --- a/config/entries/general.txt +++ b/config/entries/general.txt @@ -498,21 +498,3 @@ PAI_CUSTOM_HOLOFORMS ## Do station renames from the station charter require admin approval to pass, as opposed to autoapproving if not denied. STATION_NAME_NEEDS_APPROVAL - -## Strings for the station trait "Randomizing station name" -## Also each value needs an unique key because keyed_lists are dumb -RANDOMIZING_STATION_NAME_MESSAGE 1 Due to internal affairs, the station is now named %NEW_STATION_NAME%. -RANDOMIZING_STATION_NAME_MESSAGE 2 The solar system's government has formally requested that the station now be named %NEW_STATION_NAME%. -RANDOMIZING_STATION_NAME_MESSAGE 3 A gorilla broke into the office and destroyed a bunch of paperwork. We don't know what your station's old name was. It's now %NEW_STATION_NAME%. -RANDOMIZING_STATION_NAME_MESSAGE 4 An intern said %NEW_STATION_NAME% would be a cool name. That's your station's name now. -RANDOMIZING_STATION_NAME_MESSAGE 5 Our predictive language model has renamed your station to %NEW_STATION_NAME%. -RANDOMIZING_STATION_NAME_MESSAGE 6 It's %NEW_STATION_NAME% now. -RANDOMIZING_STATION_NAME_MESSAGE 7 The CEO demanded that your station be named %NEW_STATION_NAME%. -RANDOMIZING_STATION_NAME_MESSAGE 8 Our intern accidentally wiped the database, so your station needs a new name: %NEW_STATION_NAME%. -RANDOMIZING_STATION_NAME_MESSAGE 9 Due to copyright infringement, the station is now temporarily renamed to %NEW_STATION_NAME%. -RANDOMIZING_STATION_NAME_MESSAGE 10 Due to recent corporate acquisitions, the station has been rebranded to %NEW_STATION_NAME%. -RANDOMIZING_STATION_NAME_MESSAGE 11 %NEW_STATION_NAME%. -RANDOMIZING_STATION_NAME_MESSAGE 12 %NEW_STATION_NAME%? %NEW_STATION_NAME%! %NEW_STATION_NAME%!!!!!!!! -RANDOMIZING_STATION_NAME_MESSAGE 13 A popular social network application had already claimed the trademark of %CURRENT_STATION_NAME%, the station has been renamed to %NEW_STATION_NAME%. -RANDOMIZING_STATION_NAME_MESSAGE 14 We're pulling a prank on %RANDOM_CREWMEMBER%, so we've changed the station's name to %NEW_STATION_NAME%. -RANDOMIZING_STATION_NAME_MESSAGE 15 %RANDOM_NAME% made us change the station name, which is now %NEW_STATION_NAME%. diff --git a/strings/randomizing_station_name_messages.txt b/strings/randomizing_station_name_messages.txt new file mode 100644 index 0000000000..9b12dba310 --- /dev/null +++ b/strings/randomizing_station_name_messages.txt @@ -0,0 +1,15 @@ +Due to internal affairs, the station is now named %NEW_STATION_NAME%. +The solar system's government has formally requested that the station now be named %NEW_STATION_NAME%. +A gorilla broke into the office and destroyed a bunch of paperwork. We don't know what your station's old name was. It's now %NEW_STATION_NAME%. +An intern said %NEW_STATION_NAME% would be a cool name. That's your station's name now. +Our predictive language model has renamed your station to %NEW_STATION_NAME%. +It's %NEW_STATION_NAME% now. +The CEO demanded that your station be named %NEW_STATION_NAME%. +Our intern accidentally wiped the database, so your station needs a new name: %NEW_STATION_NAME%. +Due to copyright infringement, the station is now temporarily renamed to %NEW_STATION_NAME%. +Due to recent corporate acquisitions, the station has been rebranded to %NEW_STATION_NAME%. +%NEW_STATION_NAME%. +%NEW_STATION_NAME%? %NEW_STATION_NAME%! %NEW_STATION_NAME%!!!!!!!! +A popular social network application had already claimed the trademark of %CURRENT_STATION_NAME%, the station has been renamed to %NEW_STATION_NAME%. +We're pulling a prank on %RANDOM_CREWMEMBER%, so we've changed the station's name to %NEW_STATION_NAME%. +%RANDOM_NAME% made us change the station name, which is now %NEW_STATION_NAME%.