From 8dd039a47c959d145b40a6fdced8bd1656d0631a Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Thu, 5 Dec 2024 18:52:26 -0500 Subject: [PATCH 1/7] Remove remaining hooks --- code/__globals.dm | 8 +- code/_helpers/global_lists.dm | 2 +- code/_helpers/time.dm | 8 -- code/controllers/communications.dm | 6 +- code/controllers/evacuation/evacuation.dm | 2 - code/controllers/hooks-defs.dm | 35 --------- code/controllers/hooks.dm | 39 ---------- .../subsystems/initialization/webhooks.dm | 7 +- code/controllers/subsystems/lighting.dm | 9 +-- code/controllers/subsystems/mapping.dm | 4 - code/controllers/subsystems/ticker.dm | 13 +++- .../config/config_types/config_server.dm | 27 ------- code/datums/mil_ranks.dm | 3 +- code/datums/repositories/admin_pm.dm | 44 ----------- code/datums/traits/_traits.dm | 8 +- code/game/gamemodes/game_mode.dm | 1 - code/game/jobs/server_whitelist.dm | 2 +- code/game/objects/random/subtypes/multi.dm | 4 - code/game/verbs/who.dm | 4 +- code/game/world.dm | 75 +++++++++---------- code/modules/admin/NewBan.dm | 3 - code/modules/admin/admin.dm | 4 +- code/modules/admin/admin_investigate.dm | 4 - code/modules/admin/admin_ranks.dm | 4 - code/modules/admin/banjob.dm | 4 - .../admin/secrets/investigation/admin_pms.dm | 40 ---------- code/modules/admin/ticket.dm | 2 - code/modules/admin/verbs/adminhelp.dm | 4 - code/modules/admin/verbs/adminpm.dm | 29 ------- code/modules/chat_filter/_chat_filter.dm | 2 +- code/modules/client/client_procs.dm | 18 +---- code/modules/error_handler/error_reporting.dm | 23 ------ code/modules/ext_scripts/irc.dm | 55 -------------- code/modules/holidays/holiday_hook.dm | 5 -- .../modules/mob/living/silicon/pai/recruit.dm | 12 ++- .../mob/living/silicon/pai/software.dm | 9 +-- code/modules/mob/new_player/new_player.dm | 4 - code/modules/supermatter/supermatter.dm | 6 +- maps/~mapsystem/maps.dm | 2 +- mods/_modpack.dm | 8 +- mods/content/matchmaking/matchmaker.dm | 32 ++++---- nebula.dme | 6 -- ~code/global_init.dm | 3 +- 43 files changed, 105 insertions(+), 475 deletions(-) delete mode 100644 code/controllers/hooks-defs.dm delete mode 100644 code/controllers/hooks.dm delete mode 100644 code/datums/repositories/admin_pm.dm delete mode 100644 code/modules/admin/secrets/investigation/admin_pms.dm delete mode 100644 code/modules/error_handler/error_reporting.dm delete mode 100644 code/modules/ext_scripts/irc.dm diff --git a/code/__globals.dm b/code/__globals.dm index 12434ad8011..7c9e5ed5dbe 100644 --- a/code/__globals.dm +++ b/code/__globals.dm @@ -1,15 +1,15 @@ // Defined here due to being used immediately below. #define GET_DECL(D) (ispath(D, /decl) ? (decls_repository.fetched_decls[D] || decls_repository.get_decl(D)) : null) +#define IMPLIED_DECL GET_DECL(__IMPLIED_TYPE__) // Defined here due to compile order; overrides in macros make the compiler complain. /decl/global_vars var/static/list/protected_vars = list("protected_vars") // No editing the protected list! +/decl/global_vars/Initialize() + . = ..() + mark_protected_vars() /decl/global_vars/proc/mark_protected_vars() return -/hook/startup/proc/mark_protected_vars() - var/decl/global_vars/global_vars = GET_DECL(/decl/global_vars) - global_vars.mark_protected_vars() - return TRUE #define GLOBAL_GETTER(NAME, TYPE, VAL) \ var/global##TYPE/##NAME; \ diff --git a/code/_helpers/global_lists.dm b/code/_helpers/global_lists.dm index f3379f84c52..84463762e67 100644 --- a/code/_helpers/global_lists.dm +++ b/code/_helpers/global_lists.dm @@ -62,7 +62,7 @@ var/global/list/string_slot_flags = list( . = new /mob/living/human/dummy/mannequin() mannequins_[ckey] = . -/hook/global_init/proc/makeDatumRefLists() +/proc/makeDatumRefLists() // Keybindings for(var/KB in subtypesof(/datum/keybinding)) var/datum/keybinding/keybinding = KB diff --git a/code/_helpers/time.dm b/code/_helpers/time.dm index eea2b9b3833..a59873ee330 100644 --- a/code/_helpers/time.dm +++ b/code/_helpers/time.dm @@ -72,10 +72,6 @@ var/global/next_duration_update = 0 var/global/last_round_duration = 0 var/global/round_start_time = 0 -/hook/roundstart/proc/start_timer() - round_start_time = world.time - return 1 - /proc/ticks2readable(tick_time) var/hours = round(tick_time / (1 HOUR)) var/minutes = round((tick_time % (1 HOUR)) / (1 MINUTE)) @@ -109,10 +105,6 @@ var/global/round_start_time = 0 next_duration_update = world.time + 1 MINUTES return last_round_duration -/hook/startup/proc/set_roundstart_hour() - roundstart_hour = rand(0, 23) - return TRUE - var/global/midnight_rollovers = 0 var/global/rollovercheck_last_timeofday = 0 /proc/update_midnight_rollover() diff --git a/code/controllers/communications.dm b/code/controllers/communications.dm index 4e599b93113..d91f03f89ee 100644 --- a/code/controllers/communications.dm +++ b/code/controllers/communications.dm @@ -123,11 +123,7 @@ var/global/list/all_selectable_radio_filters = list( RADIO_MAGNETS ) -var/global/datum/controller/radio/radio_controller - -/hook/startup/proc/createRadioController() - radio_controller = new /datum/controller/radio() - return 1 +var/global/datum/controller/radio/radio_controller = new /datum/controller/radio() //callback used by objects to react to incoming radio signals /obj/proc/receive_signal(datum/signal/signal, receive_method, receive_param) diff --git a/code/controllers/evacuation/evacuation.dm b/code/controllers/evacuation/evacuation.dm index 69eeb9bc5bc..90849e6e193 100644 --- a/code/controllers/evacuation/evacuation.dm +++ b/code/controllers/evacuation/evacuation.dm @@ -131,8 +131,6 @@ evac_waiting.Announce(replacetext(global.using_map.emergency_shuttle_docked_message, "%ETD%", "[estimated_time] minute\s"), new_sound = sound('sound/effects/Evacuation.ogg', volume = 35)) else priority_announcement.Announce(replacetext(replacetext(global.using_map.shuttle_docked_message, "%dock_name%", "[global.using_map.dock_name]"), "%ETD%", "[estimated_time] minute\s")) - if(get_config_value(/decl/config/toggle/announce_shuttle_dock_to_irc)) - send2mainirc("The shuttle has docked with the station. It will depart in approximately [estimated_time] minute\s.") /datum/evacuation_controller/proc/launch_evacuation() diff --git a/code/controllers/hooks-defs.dm b/code/controllers/hooks-defs.dm deleted file mode 100644 index 696352c85eb..00000000000 --- a/code/controllers/hooks-defs.dm +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Global init hook. - * Called in global_init.dm when the server is initialized. - */ -/hook/global_init - -/** - * Startup hook. - * Called in world.dm when the server starts. - */ -/hook/startup - -/** - * Roundstart hook. - * Called in ticker.dm when a round starts. - */ -/hook/roundstart - -/** - * Roundend hook. - * Called in ticker.dm when a round ends. - */ -/hook/roundend - -/** - * Shutdown hook. - * Called in world.dm when world/Del is called. - */ -/hook/shutdown - -/** - * Reboot hook. - * Called in world.dm prior to the parent call in world/Reboot. - */ -/hook/reboot diff --git a/code/controllers/hooks.dm b/code/controllers/hooks.dm deleted file mode 100644 index 2e05a0621b0..00000000000 --- a/code/controllers/hooks.dm +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file hooks.dm - * Implements hooks, a simple way to run code on pre-defined events. - */ - -/** @page hooks Code hooks - * @section hooks Hooks - * A hook is defined under /hook in the type tree. - * - * To add some code to be called by the hook, define a proc under the type, as so: - * @code - hook/foo/proc/bar() - if(1) - return 1 //Sucessful - else - return 0 //Error, or runtime. - * @endcode - * All hooks must return nonzero on success, as runtimes will force return null. - */ - -/** - * Calls a hook, executing every piece of code that's attached to it. - * @param hook Identifier of the hook to call. - * @returns 1 if all hooked code runs successfully, 0 otherwise. - */ -/proc/callHook(hook, list/args=null) - var/hook_path = text2path("/hook/[hook]") - if(!hook_path) - error("Invalid hook '/hook/[hook]' called.") - return 0 - - var/caller = new hook_path - var/status = 1 - for(var/P in typesof("[hook_path]/proc")) - if(!call(caller, P)(arglist(args))) - error("Hook '[P]' failed or runtimed.") - status = 0 - - return status diff --git a/code/controllers/subsystems/initialization/webhooks.dm b/code/controllers/subsystems/initialization/webhooks.dm index 14c560979d4..c773998c9ba 100644 --- a/code/controllers/subsystems/initialization/webhooks.dm +++ b/code/controllers/subsystems/initialization/webhooks.dm @@ -46,6 +46,9 @@ SUBSYSTEM_DEF(webhooks) else to_world_log("Failed to set up webhook [wid].") +/datum/controller/subsystem/webhooks/proc/is_webhook_configured(wid) + return isnull(webhook_decls[wid]) + /datum/controller/subsystem/webhooks/proc/send(var/wid, var/wdata) var/decl/webhook/webhook = webhook_decls[wid] if(webhook) @@ -88,7 +91,3 @@ SUBSYSTEM_DEF(webhooks) log_and_message_admins("has pinged webhook [choice].", usr) to_world_log("[usr.key] has pinged webhook [choice].") webhook.send() - -/hook/roundstart/proc/run_webhook() - SSwebhooks.send(WEBHOOK_ROUNDSTART, list("url" = get_world_url())) - return 1 diff --git a/code/controllers/subsystems/lighting.dm b/code/controllers/subsystems/lighting.dm index daf0a7a44df..a7583ae1b2f 100644 --- a/code/controllers/subsystems/lighting.dm +++ b/code/controllers/subsystems/lighting.dm @@ -40,17 +40,12 @@ SUBSYSTEM_DEF(lighting) ) ..(out.Join()) -#ifdef USE_INTELLIGENT_LIGHTING_UPDATES - -/hook/roundstart/proc/lighting_init_roundstart() - SSlighting.handle_roundstart() - return TRUE - +// If intelligent updates are off, this is just an empty stub. /datum/controller/subsystem/lighting/proc/handle_roundstart() +#ifdef USE_INTELLIGENT_LIGHTING_UPDATES force_queued = FALSE total_ss_updates = 0 total_instant_updates = 0 - #endif /datum/controller/subsystem/lighting/Initialize(timeofday) diff --git a/code/controllers/subsystems/mapping.dm b/code/controllers/subsystems/mapping.dm index ecc1ad88b1e..6e1061636ec 100644 --- a/code/controllers/subsystems/mapping.dm +++ b/code/controllers/subsystems/mapping.dm @@ -426,7 +426,3 @@ SUBSYSTEM_DEF(mapping) if(!P) continue P.begin_processing() - -/hook/roundstart/proc/start_processing_all_planets() - SSmapping.start_processing_all_planets() - return TRUE diff --git a/code/controllers/subsystems/ticker.dm b/code/controllers/subsystems/ticker.dm index 4855a9a86c5..6bccadcb70a 100644 --- a/code/controllers/subsystems/ticker.dm +++ b/code/controllers/subsystems/ticker.dm @@ -89,7 +89,16 @@ SUBSYSTEM_DEF(ticker) if(job && job.create_record) CreateModularRecord(H) - callHook("roundstart") + // Initialize the roundstart timer + global.round_start_time = world.time + generate_multi_spawn_items() + SSlighting.handle_roundstart() + SSmapping.start_processing_all_planets() + SSwebhooks.send(WEBHOOK_ROUNDSTART, list("url" = get_world_url())) + global.using_map.refresh_lobby_browsers() + for(var/modpack_name in SSmodpacks.loaded_modpacks) + var/decl/modpack/loaded_modpack = SSmodpacks.loaded_modpacks[modpack_name] + loaded_modpack.on_roundstart() spawn(0)//Forking here so we dont have to wait for this to finish mode.post_setup() // Drafts antags who don't override jobs. @@ -102,7 +111,6 @@ SUBSYSTEM_DEF(ticker) global.current_holiday.set_up_holiday() if(!length(global.admins)) - send2adminirc("Round has started with no admins online.") SSwebhooks.send(WEBHOOK_AHELP_SENT, list("name" = "Round Started (Game ID: [game_id])", "body" = "Round has started with no admins online.")) /datum/controller/subsystem/ticker/proc/playing_tick() @@ -128,7 +136,6 @@ SUBSYSTEM_DEF(ticker) return if(END_GAME_READY_TO_END) end_game_state = END_GAME_ENDING - callHook("roundend") if (universe_has_ended) if(mode.station_was_nuked) SSstatistics.set_field_details("end_proper","nuke") diff --git a/code/datums/config/config_types/config_server.dm b/code/datums/config/config_types/config_server.dm index 47239568235..4365bbde4bb 100644 --- a/code/datums/config/config_types/config_server.dm +++ b/code/datums/config/config_types/config_server.dm @@ -16,9 +16,6 @@ /decl/config/num/drone_build_time, /decl/config/num/max_character_traits, /decl/config/num/max_alternate_languages, - /decl/config/text/irc_bot_host, - /decl/config/text/main_irc, - /decl/config/text/admin_irc, /decl/config/text/server_name, /decl/config/text/server, /decl/config/text/serverurl, @@ -54,9 +51,7 @@ /decl/config/toggle/disable_webhook_embeds, /decl/config/toggle/delist_when_no_admins, /decl/config/toggle/wait_for_sigusr1_reboot, - /decl/config/toggle/use_irc_bot, /decl/config/toggle/show_typing_indicator_for_whispers, - /decl/config/toggle/announce_shuttle_dock_to_irc, /decl/config/toggle/guests_allowed, /decl/config/toggle/on/jobs_have_minimal_access, /decl/config/toggle/on/admin_legacy_system, @@ -170,20 +165,6 @@ default_value = 3 desc = "Remove the # to define a different maximum for alternate language selection in chargen." -/decl/config/text/irc_bot_host - uid = "irc_bot_host" - default_value = "localhost" - desc = "Host where the IRC bot is hosted. Port 45678 needs to be open." - -/decl/config/text/main_irc - uid = "main_irc" - default_value = "#main" - desc = "IRC channel to send information to. Leave blank to disable." - -/decl/config/text/admin_irc - uid = "admin_irc" - desc = "IRC channel to send adminhelps to. Leave blank to disable adminhelps-to-irc." - // server name (for world name / status) /decl/config/text/server_name uid = "server_name" @@ -335,18 +316,10 @@ uid = "wait_for_sigusr1_reboot" desc = "Determines if Dream Daemon should refuse to reboot for any reason other than SIGUSR1." -/decl/config/toggle/use_irc_bot - uid = "use_irc_bot" - desc = "Determines if data is sent to the IRC bot. Generally requires MAIN_IRC and associated setup." - /decl/config/toggle/show_typing_indicator_for_whispers uid = "show_typing_indicator_for_whispers" desc = "Determinese if a typing indicator shows overhead for people currently writing whispers." -/decl/config/toggle/announce_shuttle_dock_to_irc - uid = "announce_shuttle_dock_to_irc" - desc = "Determines if announce shuttle dock announcements are sent to the main IRC channel, if MAIN_IRC has also been setup." - /decl/config/toggle/guests_allowed uid = "guests_allowed" desc = "Determines whether or not people without a registered ckey (i.e. guest-*) can connect to your server." diff --git a/code/datums/mil_ranks.dm b/code/datums/mil_ranks.dm index 23a0b69cb66..136559c4aa7 100644 --- a/code/datums/mil_ranks.dm +++ b/code/datums/mil_ranks.dm @@ -143,10 +143,11 @@ var/global/datum/mil_branches/mil_branches = new() . += spawn_rank +// todo: should this be on /datum/map? this will need heavy reworking if we promote submaps from second to first class map status anyway /** * Populate the global branches list from global.using_map */ -/hook/startup/proc/populate_branches() +/proc/populate_branches() if(!(global.using_map.flags & MAP_HAS_BRANCH) && !(global.using_map.flags & MAP_HAS_RANK)) mil_branches.branches = null mil_branches.spawn_branches_ = null diff --git a/code/datums/repositories/admin_pm.dm b/code/datums/repositories/admin_pm.dm deleted file mode 100644 index 03a48de19ab..00000000000 --- a/code/datums/repositories/admin_pm.dm +++ /dev/null @@ -1,44 +0,0 @@ -var/global/repository/admin_pm/admin_pm_repository = new() - -/repository/admin_pm - var/list/admin_pms_ - var/list/irc_clients_by_name - -/repository/admin_pm/New() - ..() - admin_pms_ = list() - irc_clients_by_name = list() - -/repository/admin_pm/proc/store_pm(var/client/sender, var/client/receiver, var/message) - if(receiver) - if(istype(receiver)) - receiver = client_repository.get_lite_client(receiver) - else if(starts_with(receiver, "IRC-")) - receiver = get_irc_client(receiver) - else - CRASH("Invalid receiver: [log_info_line(receiver)]") - - // Newest messages first - admin_pms_.Insert(1, new/datum/admin_privat_message(client_repository.get_lite_client(sender), receiver, message)) - -/repository/admin_pm/proc/get_irc_client(key) - var/datum/client_lite/cl = irc_clients_by_name[key] - if(!cl) - cl = new/datum/client_lite() - cl.name = "IRC" - cl.key = key - irc_clients_by_name[key] = cl - return cl - -/datum/admin_privat_message - var/station_time - var/datum/client_lite/sender // We don't store the proper client because it gets deleted if banned - var/datum/client_lite/receiver - var/message - -/datum/admin_privat_message/New(var/sender, var/receiver, var/message) - station_time = time_stamp() - src.message = message - src.sender = sender - src.receiver = receiver - diff --git a/code/datums/traits/_traits.dm b/code/datums/traits/_traits.dm index ad1041e32da..7c188e2b526 100644 --- a/code/datums/traits/_traits.dm +++ b/code/datums/traits/_traits.dm @@ -2,12 +2,6 @@ // Selectable traits are basically skills + stats + feats all rolled into one. You get to choose a // certain number of them at character generation and they will alter some interactions with the world. -/hook/startup/proc/initialize_trait_trees() - // Precache/build trait trees. - for(var/decl/trait/trait in decls_repository.get_decls_of_type_unassociated(/decl/trait)) - trait.build_references() - return 1 - /mob/living var/list/traits @@ -170,7 +164,7 @@ if(ispath(parent)) parent = GET_DECL(parent) - if(abstract_type != type && category) + if(category) var/datum/trait_category/trait_category = global.trait_categories[category] if(!istype(trait_category)) trait_category = new(category) diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 9a95ba9802f..9bfdd979142 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -410,7 +410,6 @@ var/global/list/additional_antag_types = list() if(escaped_total > 0) SSstatistics.set_field("escaped_total",escaped_total) - send2mainirc("A round of [src.name] has ended - [surviving_total] survivor\s, [ghosts] ghost\s.") SSwebhooks.send(WEBHOOK_ROUNDEND, list("survivors" = surviving_total, "escaped" = escaped_total, "ghosts" = ghosts, "clients" = clients)) return 0 diff --git a/code/game/jobs/server_whitelist.dm b/code/game/jobs/server_whitelist.dm index 083876ecad3..9c8b84f46b5 100644 --- a/code/game/jobs/server_whitelist.dm +++ b/code/game/jobs/server_whitelist.dm @@ -31,7 +31,7 @@ var/global/list/server_whitelist to_file(write_file, jointext(global.server_whitelist, "\n")) var/global/list/alien_whitelist = list() -/hook/startup/proc/loadAlienWhitelist() +/proc/try_load_alien_whitelist() if(get_config_value(/decl/config/toggle/use_alien_whitelist)) if(get_config_value(/decl/config/toggle/use_alien_whitelist_sql)) if(!load_alienwhitelistSQL()) diff --git a/code/game/objects/random/subtypes/multi.dm b/code/game/objects/random/subtypes/multi.dm index 34cd5d7077e..a0268faecae 100644 --- a/code/game/objects/random/subtypes/multi.dm +++ b/code/game/objects/random/subtypes/multi.dm @@ -1,7 +1,3 @@ -/hook/roundstart/proc/roundstart_multi_spawn() - generate_multi_spawn_items() - return TRUE - /proc/generate_multi_spawn_items() for(var/id in multi_point_spawns) var/list/spawn_points = multi_point_spawns[id] diff --git a/code/game/verbs/who.dm b/code/game/verbs/who.dm index 4131ea677ae..dacae043660 100644 --- a/code/game/verbs/who.dm +++ b/code/game/verbs/who.dm @@ -104,7 +104,7 @@ else msg += line - if(get_config_value(/decl/config/text/admin_irc)) - to_chat(src, "Adminhelps are also sent to IRC. If no admins are available in game try anyway and an admin on IRC may see it and respond.") + if(SSwebhooks.is_webhook_configured(WEBHOOK_AHELP_SENT)) + to_chat(src, "Adminhelps are also sent to Discord. If no admins are available in game try anyway and an admin on Discord may see it and join.") to_chat(src, "Current Staff ([active_staff]/[total_staff]):") to_chat(src, jointext(msg,"\n")) diff --git a/code/game/world.dm b/code/game/world.dm index 420c09757f5..079e43ae543 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -1,6 +1,6 @@ GLOBAL_PROTECTED_UNTYPED(game_id, null) -/hook/global_init/proc/generate_game_id() +/proc/generate_game_id() if(!isnull(global.game_id)) return @@ -70,6 +70,10 @@ GLOBAL_PROTECTED_UNTYPED(game_id, null) return match +// Get the URL used to connect to the server. +/proc/get_world_url() + return "byond://[get_config_value(/decl/config/text/server) || get_config_value(/decl/config/text/serverurl) || "[world.address]:[world.port]"]" + /world/New() //set window title @@ -83,10 +87,23 @@ GLOBAL_PROTECTED_UNTYPED(game_id, null) if(byond_version < REQUIRED_DM_VERSION) to_world_log("Your server's BYOND version does not meet the minimum DM version for this server. Please update BYOND.") - callHook("startup") - //Emergency Fix - load_mods() - //end-emergency fix + // Initialize the global vars decl, which marks vars as protected. + GET_DECL(/decl/global_vars) + // And the offset used for in-game time + global.roundstart_hour = rand(0, 23) + initialise_map_list() + world.load_mode() + world.load_motd() + load_admins() + world.connect_database() + jobban_loadbanfile() + LoadBans() + update_holiday() //Uncommenting ALLOW_HOLIDAYS in configuration will enable this. + try_load_alien_whitelist() + investigate_reset() + // Precache/build trait trees. + for(var/decl/trait/trait in decls_repository.get_decls_of_type_unassociated(/decl/trait)) + trait.build_references() . = ..() @@ -149,18 +166,24 @@ var/global/world_topic_last = world.timeofday game_log("World rebooted at [time_stamp()]") - callHook("reboot") + on_reboot(reason) ..(reason) +/// If you need to add modular functionality on-reboot, override this instead of /world/Reboot(). +/// It runs directly before the parent call in /world/Reboot(). +/world/proc/on_reboot(reason) + return + /world/Del() Master.Shutdown() - callHook("shutdown") + on_shutdown() return ..() -/hook/startup/proc/loadMode() - world.load_mode() - return 1 +/// If you need to add modular functionality on-shutdown, override this instead of /world/Del(). +/// It runs directly before the parent call in /world/Del(). +/world/proc/on_shutdown() + return /world/proc/load_mode() if(!fexists("data/mode.txt")) @@ -177,38 +200,9 @@ var/global/world_topic_last = world.timeofday fdel(F) direct_output(F, the_mode) -/hook/startup/proc/loadMOTD() - world.load_motd() - return 1 - /world/proc/load_motd() join_motd = safe_file2text("config/motd.txt", FALSE) -/hook/startup/proc/loadMods() - world.load_mods() - return 1 - -/world/proc/load_mods() - if(get_config_value(/decl/config/toggle/on/admin_legacy_system)) - var/text = safe_file2text("config/moderators.txt", FALSE) - if (!text) - error("Failed to load config/mods.txt") - else - var/list/lines = splittext(text, "\n") - for(var/line in lines) - if (!line) - continue - - if (copytext(line, 1, 2) == ";") - continue - - var/title = "Moderator" - var/rights = admin_ranks[title] - - var/ckey = copytext(line, 1, length(line)+1) - var/datum/admins/D = new /datum/admins(title, rights, ckey) - D.associate(global.ckey_directory[ckey]) - /world/proc/update_status() var/s = "[station_name()]" @@ -281,12 +275,11 @@ var/global/world_topic_last = world.timeofday #define FAILED_DB_CONNECTION_CUTOFF 5 var/global/failed_db_connections = 0 -/hook/startup/proc/connectDB() +/world/proc/connect_database() if(!setup_database_connection()) to_world_log("Your server failed to establish a connection with the SQL database.") else to_world_log("SQL database connection established.") - return 1 /proc/setup_database_connection() diff --git a/code/modules/admin/NewBan.dm b/code/modules/admin/NewBan.dm index 5f2e3c19cc6..ecfb5bd522f 100644 --- a/code/modules/admin/NewBan.dm +++ b/code/modules/admin/NewBan.dm @@ -59,9 +59,6 @@ var/global/savefile/Banlist CMinutes = (world.realtime / 10) / 60 return 1 -/hook/startup/proc/loadBans() - return LoadBans() - /proc/LoadBans() Banlist = new("data/banlist.bdb") diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 79c44208bc0..5e06996ca46 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -789,9 +789,7 @@ var/global/BSACooldown = 0 if (new_vis && !world.reachable) message_admins("WARNING: The server will not show up on the hub because byond is detecting that a firewall is blocking incoming connections.") - var/full_message = "[key_name(src)]" + long_message - send2adminirc(full_message) - SSwebhooks.send(WEBHOOK_AHELP_SENT, list("name" = "Hub Visibility Toggled (Game ID: [game_id])", "body" = full_message)) + SSwebhooks.send(WEBHOOK_AHELP_SENT, list("name" = "Hub Visibility Toggled (Game ID: [game_id])", "body" = "[key_name(src)]" + long_message)) log_and_message_admins(long_message) SSstatistics.add_field_details("admin_verb","THUB") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc diff --git a/code/modules/admin/admin_investigate.dm b/code/modules/admin/admin_investigate.dm index 66fe7e8daff..546f5753cee 100644 --- a/code/modules/admin/admin_investigate.dm +++ b/code/modules/admin/admin_investigate.dm @@ -11,10 +11,6 @@ /proc/investigate_subject2file(var/subject) return file("[INVESTIGATE_DIR][subject].html") -/hook/startup/proc/resetInvestigate() - investigate_reset() - return 1 - /proc/investigate_reset() if(fdel(INVESTIGATE_DIR)) return 1 return 0 diff --git a/code/modules/admin/admin_ranks.dm b/code/modules/admin/admin_ranks.dm index 5a6a4d7b17a..42eab17d7f7 100644 --- a/code/modules/admin/admin_ranks.dm +++ b/code/modules/admin/admin_ranks.dm @@ -52,10 +52,6 @@ var/global/list/admin_ranks = list() //list of all ranks with associated testing(msg) #endif -/hook/startup/proc/loadAdmins() - load_admins() - return 1 - /proc/load_admins() //clear the datums references admin_datums.Cut() diff --git a/code/modules/admin/banjob.dm b/code/modules/admin/banjob.dm index 79ca30569ee..37374968324 100644 --- a/code/modules/admin/banjob.dm +++ b/code/modules/admin/banjob.dm @@ -36,10 +36,6 @@ var/global/list/jobban_keylist = list() //to store the keys & ranks return "Reason Unspecified" return 0 -/hook/startup/proc/loadJobBans() - jobban_loadbanfile() - return 1 - /proc/jobban_loadbanfile() if(get_config_value(/decl/config/toggle/on/ban_legacy_system)) var/savefile/S=new("data/job_full.ban") diff --git a/code/modules/admin/secrets/investigation/admin_pms.dm b/code/modules/admin/secrets/investigation/admin_pms.dm deleted file mode 100644 index cd57bf73283..00000000000 --- a/code/modules/admin/secrets/investigation/admin_pms.dm +++ /dev/null @@ -1,40 +0,0 @@ -/datum/admin_secret_item/investigation/admin_pms - name = "Admin PMs" - -/datum/admin_secret_item/investigation/admin_pms/execute(var/mob/user, var/filter) - . = ..() - if(!.) - return - var/dat = list() - dat += "Refresh Filtering on: " - if(filter) - dat += " [filter] Clear" - else - dat += "None" - dat += "
" - dat += "" - dat += "" - - for(var/datum/admin_privat_message/pm in admin_pm_repository.admin_pms_) - var/datum/client_lite/sender = pm.sender - var/datum/client_lite/receiver = pm.receiver - - if(filter && !(sender.ckey == filter || (receiver && receiver.ckey == filter))) - continue - - if(receiver) - dat += "" - else - dat += "" - dat += "" - dat += "
TimeSenderReceiver
[pm.station_time][sender.key_name(FALSE)] F[receiver.key_name(FALSE)] F
[pm.station_time][sender.key_name(FALSE)] F
[pm.message]
" - - var/datum/browser/popup = new(user, "admin_ahelps", "Admin PMs", 800, 400) - popup.set_content(jointext(dat, null)) - popup.open() - -/datum/admin_secret_item/investigation/admin_pms/Topic(href, href_list) - . = ..() - if(.) - return - execute(usr, href_list["filter"]) diff --git a/code/modules/admin/ticket.dm b/code/modules/admin/ticket.dm index 526c9867927..8612a5306d9 100644 --- a/code/modules/admin/ticket.dm +++ b/code/modules/admin/ticket.dm @@ -51,7 +51,6 @@ var/global/list/ticket_panels = list() src.closed_by = closed_by to_chat(client_by_ckey(src.owner.ckey), "Your ticket has been closed by [closed_by.key].") message_staff("[src.owner.key_name(0)]'s ticket has been closed by [closed_by.key].") - send2adminirc("[src.owner.key_name(0)]'s ticket has been closed by [closed_by.key].") SSwebhooks.send(WEBHOOK_AHELP_SENT, list("name" = "Ticket ([id]) (Game ID: [game_id]) Ticket Closed", "body" = "[src.owner.key_name(0)] 's ticket (ID [id]) has been closed by [closed_by.key].")) var/closed_by_not_assigned = TRUE @@ -100,7 +99,6 @@ var/global/list/ticket_panels = list() ticket_take.Execute() message_staff("[assigned_admin.key] has assigned themself to [src.owner.key_name(0)]'s ticket.") - send2adminirc("[assigned_admin.key] has assigned themself to [src.owner.key_name(0)]'s ticket.") to_chat(client_by_ckey(src.owner.ckey), "[assigned_admin.key] has added themself to your ticket and should respond shortly. Thanks for your patience!") SSwebhooks.send(WEBHOOK_AHELP_SENT, list("name" = "Ticket ([id]) (Game ID: [game_id]) Ticked Assigned", "body" = "[assigned_admin.key] has added themself to ticket ID [id].")) diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index ee9f73e756b..77017eee5f6 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -134,10 +134,6 @@ var/global/list/adminhelp_ignored_words = list("unknown","the","a","an","of","mo to_chat(src, SPAN_BLUE("PM to-Staff (CLOSE): [original_msg]")) var/admin_number_present = global.admins.len - admin_number_afk log_admin("HELP: [key_name(src)]: [original_msg] - heard by [admin_number_present] non-AFK admins.") - if(admin_number_present <= 0) - adminmsg2adminirc(src, null, "[html_decode(original_msg)] - !![admin_number_afk ? "All admins AFK ([admin_number_afk])" : "No admins online"]!!") - else - adminmsg2adminirc(src, null, "[html_decode(original_msg)]") SSstatistics.add_field_details("admin_verb","AH") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/admin/verbs/adminpm.dm b/code/modules/admin/verbs/adminpm.dm index d3e506f6327..7371ff70873 100644 --- a/code/modules/admin/verbs/adminpm.dm +++ b/code/modules/admin/verbs/adminpm.dm @@ -151,7 +151,6 @@ sound_to(C, 'sound/effects/adminhelp.ogg') log_admin("PM: [key_name(src)]->[key_name(C)]: [msg]") - adminmsg2adminirc(src, C, html_decode(msg)) ticket.msgs += new /datum/ticket_msg(src.ckey, C.ckey, msg) update_ticket_panels() @@ -168,31 +167,3 @@ continue if(X.key != key && X.key != C.key && (X.holder.rights & R_ADMIN|R_MOD)) to_chat(X, "" + create_text_tag("pm_other", "PM:", X) + " [key_name(src, X, 0, ticket)] to [key_name(C, X, 0, ticket)] ([(ticket.status == TICKET_OPEN) ? "TAKE" : "JOIN"]) (CLOSE): [msg]") - -/client/proc/cmd_admin_irc_pm(sender) - if(prefs.muted & MUTE_ADMINHELP) - to_chat(src, "Error: Private-Message: You are unable to use PM-s (muted).") - return - - var/msg = input(src,"Message:", "Reply private message to [sender] on IRC / 400 character limit") as text|null - - if(!msg) - return - - // Handled on Bot32's end, unsure about other bots -// if(length(msg) > 400) // TODO: if message length is over 400, divide it up into seperate messages, the message length restriction is based on IRC limitations. Probably easier to do this on the bots ends. -// to_chat(src, "Your message was not sent because it was more then 400 characters, find your message below for ease of copy/pasting.") -// to_chat(src, "[msg]") -// return - - adminmsg2adminirc(src, sender, html_decode(msg)) - msg = sanitize(msg) - log_admin("PM: [key_name(src)]->IRC-[sender]: [msg]") - admin_pm_repository.store_pm(src, "IRC-[sender]", msg) - - to_chat(src, "" + create_text_tag("pm_out_alt", "PM", src) + " to [sender]: [msg]") - for(var/client/X in global.admins) - if(X == src) - continue - if(X.holder.rights & R_ADMIN|R_MOD) - to_chat(X, "" + create_text_tag("pm_other", "PM:", X) + " [key_name(src, X, 0)] to [sender]: [msg]") diff --git a/code/modules/chat_filter/_chat_filter.dm b/code/modules/chat_filter/_chat_filter.dm index 15beabc9ba0..7e9ce18e77a 100644 --- a/code/modules/chat_filter/_chat_filter.dm +++ b/code/modules/chat_filter/_chat_filter.dm @@ -1,7 +1,7 @@ var/global/list/chat_blockers_in_use var/global/list/chat_modifiers_in_use -/hook/startup/proc/build_filter_lists() +/proc/build_filter_lists() global.chat_blockers_in_use = list() global.chat_modifiers_in_use = list() var/list/all_filters = decls_repository.get_decls_of_type(/decl/chat_filter) diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 4afacdc2b06..76f96bf0866 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -65,16 +65,6 @@ var/global/list/localhost_addresses = list( cmd_admin_pm(C, null, ticket) return - if(href_list["irc_msg"]) - if(!holder && received_irc_pm < world.time - 6000) //Worst they can do is spam IRC for 10 minutes - to_chat(usr, SPAN_WARNING("You are no longer able to use this, it's been more then 10 minutes since an admin on IRC has responded to you.")) - return - if(mute_irc) - to_chat(usr, SPAN_WARNING("You cannot use this as your client has been muted from sending messages to the admins on IRC.")) - return - cmd_admin_irc_pm(href_list["irc_msg"]) - return - if(href_list["close_ticket"]) var/datum/ticket/ticket = locate(href_list["close_ticket"]) @@ -378,14 +368,10 @@ var/global/list/localhost_addresses = list( if(admin_datums[ckey] && GAME_STATE == RUNLEVEL_GAME) //Only report this stuff if we are currently playing. message_staff("\[[holder.rank]\] [key_name(src)] logged out.") if(!global.admins.len) //Apparently the admin logging out is no longer an admin at this point, so we have to check this towards 0 and not towards 1. Awell. - var/full_message = "[key_name(src)] logged out - no more staff online." - send2adminirc(full_message) - SSwebhooks.send(WEBHOOK_AHELP_SENT, list("name" = "Admin Logout (Game ID: [game_id])", "body" = full_message)) + SSwebhooks.send(WEBHOOK_AHELP_SENT, list("name" = "Admin Logout (Game ID: [game_id])", "body" = "[key_name(src)] logged out - no more staff online.")) if(get_config_value(/decl/config/toggle/delist_when_no_admins) && get_config_value(/decl/config/toggle/hub_visibility)) toggle_config_value(/decl/config/toggle/hub_visibility) - full_message = "Toggled hub visibility. The server is now invisible." - send2adminirc(full_message) - SSwebhooks.send(WEBHOOK_AHELP_SENT, list("name" = "Automatic Hub Visibility Toggle (Game ID: [game_id])", "body" = full_message)) + SSwebhooks.send(WEBHOOK_AHELP_SENT, list("name" = "Automatic Hub Visibility Toggle (Game ID: [game_id])", "body" = "Toggled hub visibility. The server is now invisible.")) //checks if a client is afk //3000 frames = 5 minutes diff --git a/code/modules/error_handler/error_reporting.dm b/code/modules/error_handler/error_reporting.dm deleted file mode 100644 index 773920717cb..00000000000 --- a/code/modules/error_handler/error_reporting.dm +++ /dev/null @@ -1,23 +0,0 @@ -// this proc will only work with DEBUG enabled -#ifdef DEBUG - -/hook/roundend/proc/send_runtimes_to_ircbot() - if(!revdata.revision) return // we can't do much useful if we don't know what we are - var/list/errors = list() - for(var/erruid in global.error_cache.error_sources) - var/datum/error_viewer/error_source/e = global.error_cache.error_sources[erruid] - var/datum/error_viewer/error_entry/err = e.errors[1] - - var/data = list( - id = erruid, - name = err.info_name, - info = err.info - ) - - errors[++errors.len] = list2params(data) - - runtimes2irc(list2params(errors), revdata.revision) - - return 1 - -#endif diff --git a/code/modules/ext_scripts/irc.dm b/code/modules/ext_scripts/irc.dm deleted file mode 100644 index 9b1887f118f..00000000000 --- a/code/modules/ext_scripts/irc.dm +++ /dev/null @@ -1,55 +0,0 @@ -/proc/send2irc(var/channel, var/msg) - export2irc(list(type="msg", mesg=msg, chan=channel, pwd=get_config_value(/decl/config/text/comms_password))) - -/proc/export2irc(params) - if(!get_config_value(/decl/config/toggle/use_irc_bot)) - return - var/irc_bot_host = get_config_value(/decl/config/text/irc_bot_host) - if(irc_bot_host) - spawn(-1) // spawn here prevents hanging in the case that the bot isn't reachable - world.Export("http://[irc_bot_host]:45678?[list2params(params)]") - -/proc/runtimes2irc(runtimes, revision) - export2irc(list(pwd=get_config_value(/decl/config/text/comms_password), type="runtime", runtimes=runtimes, revision=revision)) - -/proc/send2mainirc(var/msg) - var/main_irc = get_config_value(/decl/config/text/main_irc) - if(main_irc) - send2irc(main_irc, msg) - return - -/proc/send2adminirc(var/msg) - var/admin_irc = get_config_value(/decl/config/text/admin_irc) - if(admin_irc) - send2irc(admin_irc, msg) - return - -/proc/adminmsg2adminirc(client/source, client/target, msg) - var/admin_irc = get_config_value(/decl/config/text/admin_irc) - if(admin_irc) - var/list/params[0] - - params["pwd"] = get_config_value(/decl/config/text/comms_password) - params["chan"] = admin_irc - params["msg"] = msg - params["src_key"] = source.key - params["src_char"] = source.mob.real_name || source.mob.name - if(!target) - params["type"] = "adminhelp" - else if(istext(target)) - params["type"] = "ircpm" - params["target"] = target - params["rank"] = source.holder ? source.holder.rank : "Player" - else - params["type"] = "adminpm" - params["trg_key"] = target.key - params["trg_char"] = target.mob.real_name || target.mob.name - - export2irc(params) - -/proc/get_world_url() - return "byond://[get_config_value(/decl/config/text/server) || get_config_value(/decl/config/text/serverurl) || "[world.address]:[world.port]"]" - -/hook/startup/proc/ircNotify() - send2mainirc("Server starting up on [get_world_url()]") - return 1 diff --git a/code/modules/holidays/holiday_hook.dm b/code/modules/holidays/holiday_hook.dm index 6b6870c5bb0..231c1a056fd 100644 --- a/code/modules/holidays/holiday_hook.dm +++ b/code/modules/holidays/holiday_hook.dm @@ -1,8 +1,3 @@ -//Uncommenting ALLOW_HOLIDAYS in configuration will enable this hook. -/hook/startup/proc/updateHoliday() - update_holiday() - return TRUE - /proc/update_holiday() if(!get_config_value(/decl/config/toggle/allow_holidays)) diff --git a/code/modules/mob/living/silicon/pai/recruit.dm b/code/modules/mob/living/silicon/pai/recruit.dm index 6e1a7989b71..0d02001ceae 100644 --- a/code/modules/mob/living/silicon/pai/recruit.dm +++ b/code/modules/mob/living/silicon/pai/recruit.dm @@ -2,8 +2,6 @@ // Recruiting observers to play as pAIs -var/global/datum/paiController/paiController // Global handler for pAI candidates - /datum/paiCandidate var/name var/key @@ -14,11 +12,7 @@ var/global/datum/paiController/paiController // Global handler for pAI candida var/chassis = "Drone" var/say_verb = "Robotic" - -/hook/startup/proc/paiControllerSetup() - paiController = new /datum/paiController() - return 1 - +var/global/datum/paiController/paiController = new /datum/paiController() // Global handler for pAI candidates /datum/paiController var/inquirer = null @@ -27,6 +21,10 @@ var/global/datum/paiController/paiController // Global handler for pAI candida var/askDelay = 10 * 60 * 1 // One minute [ms * sec * min] +/datum/paiController/New() + ..() + populate_pai_software_list() + /datum/paiController/Topic(href, href_list[]) if(href_list["download"]) var/datum/paiCandidate/candidate = locate(href_list["candidate"]) diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm index 72c1af676bb..b53b8a9cfe2 100644 --- a/code/modules/mob/living/silicon/pai/software.dm +++ b/code/modules/mob/living/silicon/pai/software.dm @@ -19,19 +19,18 @@ var/global/list/pai_emotions = list( var/global/list/pai_software_by_key = list() var/global/list/default_pai_software = list() -/hook/startup/proc/populate_pai_software_list() - var/r = 1 // I would use ., but it'd sacrifice runtime detection +/proc/populate_pai_software_list() + pai_software_by_key = list() + default_pai_software = list() for(var/type in subtypesof(/datum/pai_software)) var/datum/pai_software/P = new type() if(pai_software_by_key[P.id]) var/datum/pai_software/O = pai_software_by_key[P.id] - log_error("pAI software module [P.name] has the same key as [O.name]!") - r = 0 + PRINT_STACK_TRACE("pAI software module [type] has the same key ([P.id]) as [O.type] [O.id]!") continue pai_software_by_key[P.id] = P if(P.default) default_pai_software[P.id] = P - return r /mob/living/silicon/pai/proc/paiInterface() ui_interact(src) diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index f03372203ad..df2fc50f4b3 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -482,10 +482,6 @@ INITIALIZE_IMMEDIATE(/mob/new_player) /mob/new_player/get_admin_job_string() return "New player" -/hook/roundstart/proc/update_lobby_browsers() - global.using_map.refresh_lobby_browsers() - return TRUE - /mob/new_player/change_mob_type(var/new_type, var/turf/location, var/new_name, var/delete_old_mob = FALSE, var/subspecies) to_chat(usr, SPAN_WARNING("You cannot convert players who have not entered the game yet!")) return FALSE diff --git a/code/modules/supermatter/supermatter.dm b/code/modules/supermatter/supermatter.dm index 56b086005c7..5cb5d84467e 100644 --- a/code/modules/supermatter/supermatter.dm +++ b/code/modules/supermatter/supermatter.dm @@ -237,13 +237,13 @@ var/global/list/supermatter_delam_accent_sounds = list( else aw_EPR = FALSE -/obj/machinery/power/supermatter/proc/status_adminwarn_check(var/min_status, var/current_state, var/message, var/send_to_irc = FALSE) +/obj/machinery/power/supermatter/proc/status_adminwarn_check(var/min_status, var/current_state, var/message, var/send_webhook = FALSE) var/status = get_status() if(status >= min_status) if(!current_state) log_and_message_admins(message) - if(send_to_irc) - send2adminirc(message) + if(send_webhook) + SSwebhooks.send(WEBHOOK_AHELP_SENT, list("name" = "Supermatter Warning", "body" = message)) return TRUE else return FALSE diff --git a/maps/~mapsystem/maps.dm b/maps/~mapsystem/maps.dm index fa0aaa49977..807c786ed51 100644 --- a/maps/~mapsystem/maps.dm +++ b/maps/~mapsystem/maps.dm @@ -4,7 +4,7 @@ var/global/list/all_maps = list() var/global/const/MAP_HAS_BRANCH = 1 //Branch system for occupations, togglable var/global/const/MAP_HAS_RANK = 2 //Rank system, also togglable -/hook/startup/proc/initialise_map_list() +/proc/initialise_map_list() for(var/type in subtypesof(/datum/map)) var/datum/map/M if(type == global.using_map.type) diff --git a/mods/_modpack.dm b/mods/_modpack.dm index 279002ba251..1e8accdf306 100644 --- a/mods/_modpack.dm +++ b/mods/_modpack.dm @@ -56,6 +56,10 @@ if(length(credits_nouns)) SSlore.credits_nouns |= credits_nouns +/// This runs on-roundstart after roundstart characters have been created. +/decl/modpack/proc/on_roundstart() + return + /decl/modpack/proc/get_membership_perks() return @@ -70,11 +74,11 @@ . = "

Modpacks List



" for(var/modpack in SSmodpacks.loaded_modpacks) var/decl/modpack/M = SSmodpacks.loaded_modpacks[modpack] - + if(M.name) . += "
" . += "
[M.name]
" - + if(M.desc || M.author) . += "
" if(M.desc) diff --git a/mods/content/matchmaking/matchmaker.dm b/mods/content/matchmaking/matchmaker.dm index 0892ba4c827..453d885321c 100644 --- a/mods/content/matchmaking/matchmaker.dm +++ b/mods/content/matchmaking/matchmaker.dm @@ -1,14 +1,12 @@ -var/global/datum/matchmaker/matchmaker = new() - -/hook/roundstart/proc/matchmaking() - matchmaker.do_matchmaking() - return TRUE +/decl/modpack/matchmaking/on_roundstart() + do_matchmaking() -/datum/matchmaker/matchmaker/New() +// It doesn't really matter when this registers during init as long as it's before roundstart. +/decl/modpack/matchmaking/post_initialize() . = ..() events_repository.register_global(/decl/observ/player_latejoin, src, PROC_REF(matchmake_latejoiner)) -/datum/matchmaker/proc/matchmake_latejoiner(mob/living/character, datum/job/job) +/decl/modpack/matchmaking/proc/matchmake_latejoiner(mob/living/character, datum/job/job) if(character.mind && character.client?.prefs.relations.len) for(var/T in character.client.prefs.relations) var/TT = relation_types[T] @@ -30,17 +28,17 @@ var/global/datum/matchmaker/matchmaker = new() QDEL_NULL_LIST(known_connections) . = ..() -/datum/matchmaker +/decl/modpack/matchmaking var/list/relation_types = list() var/list/relations = list() -/datum/matchmaker/New() - ..() +/decl/modpack/matchmaking/Initialize() + . = ..() for(var/T in subtypesof(/datum/relation/)) var/datum/relation/R = T relation_types[initial(R.name)] = T -/datum/matchmaker/proc/do_matchmaking() +/decl/modpack/matchmaking/proc/do_matchmaking() var/list/to_warn = list() for(var/datum/relation/R in relations) if(R.other) @@ -51,13 +49,13 @@ var/global/datum/matchmaker/matchmaker = new() for(var/mob/M in to_warn) to_chat(M,"You have new connections. Use \"See Relationship Info\" to view and finalize them.") -/datum/matchmaker/proc/get_relationships(datum/mind/M, finalized_only) +/decl/modpack/matchmaking/proc/get_relationships(datum/mind/M, finalized_only) . = list() for(var/datum/relation/R in relations) if(R.holder == M && R.other && (R.finalized || !finalized_only)) . += R -/datum/matchmaker/proc/get_relationships_between(datum/mind/holder, datum/mind/target, finalized_only) +/decl/modpack/matchmaking/proc/get_relationships_between(datum/mind/holder, datum/mind/target, finalized_only) . = list() for(var/datum/relation/R in relations) if(R.holder == holder && R.other && R.other.holder == target && (R.finalized || !finalized_only)) @@ -68,6 +66,7 @@ var/global/datum/matchmaker/matchmaker = new() return if(!source.mind || !user.mind || source.name != source.real_name) return + var/decl/modpack/matchmaking/matchmaker = IMPLIED_DECL if(!length(matchmaker.get_relationships_between(user.mind, source.mind, TRUE))) return return "
You know them. More...
" @@ -89,10 +88,12 @@ var/global/datum/matchmaker/matchmaker = new() ..() if(!can_connect_to) can_connect_to = list(type) + var/decl/modpack/matchmaking/matchmaker = IMPLIED_DECL matchmaker.relations += src /datum/relation/proc/get_candidates() .= list() + var/decl/modpack/matchmaking/matchmaker = IMPLIED_DECL for(var/datum/relation/R in matchmaker.relations) if(!valid_candidate(R.holder) || !can_connect(R)) continue @@ -112,6 +113,7 @@ var/global/datum/matchmaker/matchmaker = new() return TRUE /datum/relation/proc/can_connect(var/datum/relation/R) + var/decl/modpack/matchmaking/matchmaker = IMPLIED_DECL for(var/datum/relation/D in matchmaker.relations) //have to check all connections between us and them if(D.holder == R.holder && D.other && D.other.holder == holder) if(D.type in incompatible) @@ -141,6 +143,7 @@ var/global/datum/matchmaker/matchmaker = new() to_chat(holder.current,"Your connection with [other.holder] is no more.") to_chat(other.holder.current,"Your connection with [holder] is no more.") other.other = null + var/decl/modpack/matchmaking/matchmaker = IMPLIED_DECL matchmaker.relations -= other matchmaker.relations -= src qdel(other) @@ -187,6 +190,7 @@ var/global/datum/matchmaker/matchmaker = new() set desc = "See what connections between people you know of." set category = "IC" + var/decl/modpack/matchmaking/matchmaker = IMPLIED_DECL var/list/relations = matchmaker.get_relationships(mind) var/list/dat = list() var/editable = 0 @@ -221,6 +225,7 @@ var/global/datum/matchmaker/matchmaker = new() /mob/living/proc/see_relationship_info_with(var/mob/living/other) if(!other.mind) return + var/decl/modpack/matchmaking/matchmaker = IMPLIED_DECL var/list/relations = matchmaker.get_relationships(mind,other.mind,TRUE) var/list/dat = list("

[other]

") if(mind.gen_relations_info) @@ -268,6 +273,7 @@ var/global/datum/matchmaker/matchmaker = new() var/ok = "Close anyway" ok = alert("HEY! You have some non-finalized relationships. You can terminate them if they do not fit your character, or edit the info tidbit that the other party is given. THIS IS YOUR ONLY CHANCE to do so - after you close the window, they won't be editable.","Finalize relationships","Return to edit", "Close anyway") if(ok == "Close anyway") + var/decl/modpack/matchmaking/matchmaker = IMPLIED_DECL var/list/relations = matchmaker.get_relationships(mind) for(var/datum/relation/R in relations) R.finalize() diff --git a/nebula.dme b/nebula.dme index d28a50a9d58..5036830ed67 100644 --- a/nebula.dme +++ b/nebula.dme @@ -241,8 +241,6 @@ #include "code\controllers\communications.dm" #include "code\controllers\controller.dm" #include "code\controllers\failsafe.dm" -#include "code\controllers\hooks-defs.dm" -#include "code\controllers\hooks.dm" #include "code\controllers\master.dm" #include "code\controllers\subsystem.dm" #include "code\controllers\verbs.dm" @@ -616,7 +614,6 @@ #include "code\datums\proximity_trigger\proximity_trigger.dm" #include "code\datums\proximity_trigger\turf_selection.dm" #include "code\datums\repositories\_defines.dm" -#include "code\datums\repositories\admin_pm.dm" #include "code\datums\repositories\areas.dm" #include "code\datums\repositories\atom_info.dm" #include "code\datums\repositories\attack_logs.dm" @@ -1705,7 +1702,6 @@ #include "code\modules\admin\secrets\fun_secrets\power_all_smes.dm" #include "code\modules\admin\secrets\fun_secrets\triple_ai_mode.dm" #include "code\modules\admin\secrets\fun_secrets\waddle.dm" -#include "code\modules\admin\secrets\investigation\admin_pms.dm" #include "code\modules\admin\secrets\investigation\attack_logs.dm" #include "code\modules\admin\verbs\adminhelp.dm" #include "code\modules\admin\verbs\adminjump.dm" @@ -2302,7 +2298,6 @@ #include "code\modules\emotes\definitions\tail.dm" #include "code\modules\emotes\definitions\visible.dm" #include "code\modules\error_handler\error_handler.dm" -#include "code\modules\error_handler\error_reporting.dm" #include "code\modules\error_handler\error_viewer.dm" #include "code\modules\events\ailments.dm" #include "code\modules\events\apc_damage.dm" @@ -2345,7 +2340,6 @@ #include "code\modules\events\trivial_news.dm" #include "code\modules\events\wallrot.dm" #include "code\modules\events\wormholes.dm" -#include "code\modules\ext_scripts\irc.dm" #include "code\modules\fabrication\__fabricator_defines.dm" #include "code\modules\fabrication\_fabricator.dm" #include "code\modules\fabrication\_fabricator_build_order.dm" diff --git a/~code/global_init.dm b/~code/global_init.dm index 00301af2ca2..82950bb246d 100644 --- a/~code/global_init.dm +++ b/~code/global_init.dm @@ -15,7 +15,8 @@ var/global_init = new /datum/global_init() /datum/global_init/New() SSconfiguration.load_all_configuration() - callHook("global_init") + generate_game_id() + makeDatumRefLists() qdel(src) //we're done /datum/global_init/Destroy() From bb79c469c77163ec89f6a1c32d5abf386a2ecfb8 Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Thu, 5 Dec 2024 19:21:47 -0500 Subject: [PATCH 2/7] Remove redundant multitool extension Topic defines --- code/__defines/topic.dm | 4 +- .../datums/extensions/multitool/_multitool.dm | 3 - .../circuitboards/buildtype_select.dm | 2 +- .../circuitboards/shuttle_console.dm | 6 +- .../multitool/circuitboards/stationalert.dm | 4 +- .../extensions/multitool/items/cable.dm | 2 +- .../multitool/items/stock_parts_radio.dm | 58 +++++++++---------- code/datums/extensions/multitool/multitool.dm | 21 ++++--- .../airlock_controllers_dummy.dm | 6 +- .../embedded_controller_base.dm | 8 +-- nebula.dme | 1 - 11 files changed, 58 insertions(+), 57 deletions(-) delete mode 100644 code/datums/extensions/multitool/_multitool.dm diff --git a/code/__defines/topic.dm b/code/__defines/topic.dm index 74e2ca005f0..219abf3728e 100644 --- a/code/__defines/topic.dm +++ b/code/__defines/topic.dm @@ -2,6 +2,8 @@ #define TOPIC_HANDLED BITFLAG(0) #define TOPIC_REFRESH BITFLAG(1) #define TOPIC_UPDATE_PREVIEW BITFLAG(2) - // use to force a browse() call, unblocking some rsc operations +/// Return this to force a browse() call, unblocking some rsc operations #define TOPIC_HARD_REFRESH BITFLAG(3) +/// Return this to indicate the window associated with this Topic() call should be closed. +#define TOPIC_CLOSE BITFLAG(4) #define TOPIC_REFRESH_UPDATE_PREVIEW (TOPIC_HARD_REFRESH|TOPIC_UPDATE_PREVIEW) diff --git a/code/datums/extensions/multitool/_multitool.dm b/code/datums/extensions/multitool/_multitool.dm deleted file mode 100644 index fd581a007f9..00000000000 --- a/code/datums/extensions/multitool/_multitool.dm +++ /dev/null @@ -1,3 +0,0 @@ -#define MT_NOACTION 0 -#define MT_REFRESH 1 -#define MT_CLOSE 2 diff --git a/code/datums/extensions/multitool/circuitboards/buildtype_select.dm b/code/datums/extensions/multitool/circuitboards/buildtype_select.dm index 703d9c4f3f6..ae95b5cb13a 100644 --- a/code/datums/extensions/multitool/circuitboards/buildtype_select.dm +++ b/code/datums/extensions/multitool/circuitboards/buildtype_select.dm @@ -25,5 +25,5 @@ board.build_path = path var/obj/thing = path board.SetName("circuitboard ([initial(thing.name)])") - return MT_REFRESH + return TOPIC_REFRESH return ..() \ No newline at end of file diff --git a/code/datums/extensions/multitool/circuitboards/shuttle_console.dm b/code/datums/extensions/multitool/circuitboards/shuttle_console.dm index 9e267968246..77ad6c394f3 100644 --- a/code/datums/extensions/multitool/circuitboards/shuttle_console.dm +++ b/code/datums/extensions/multitool/circuitboards/shuttle_console.dm @@ -19,11 +19,11 @@ break if(!new_name) to_chat(user, SPAN_WARNING("No eligible shuttle could be located. Make sure the board is inside a shuttle and try again.")) - return MT_NOACTION + return TOPIC_NOACTION if(!board.is_valid_shuttle(SSshuttle.shuttles[new_name])) to_chat(user, SPAN_WARNING("The current shuttle does not support this console type. Try a different shuttle or circuit board.")) - return MT_NOACTION + return TOPIC_NOACTION board.shuttle_tag = new_name to_chat(user, SPAN_NOTICE("You set the shuttle name to '[new_name]'.")) - return MT_REFRESH + return TOPIC_REFRESH return ..() \ No newline at end of file diff --git a/code/datums/extensions/multitool/circuitboards/stationalert.dm b/code/datums/extensions/multitool/circuitboards/stationalert.dm index e3ec67a2024..209dfba6b73 100644 --- a/code/datums/extensions/multitool/circuitboards/stationalert.dm +++ b/code/datums/extensions/multitool/circuitboards/stationalert.dm @@ -18,12 +18,12 @@ var/datum/alarm_handler/AH = locate(href_list["add"]) in SSalarm.all_handlers if(AH) SA.alarm_handlers |= AH - return MT_REFRESH + return TOPIC_REFRESH if(href_list["remove"]) var/datum/alarm_handler/AH = locate(href_list["remove"]) in SSalarm.all_handlers if(AH) SA.alarm_handlers -= AH - return MT_REFRESH + return TOPIC_REFRESH return ..() diff --git a/code/datums/extensions/multitool/items/cable.dm b/code/datums/extensions/multitool/items/cable.dm index f58fc823297..7f95e27e73e 100644 --- a/code/datums/extensions/multitool/items/cable.dm +++ b/code/datums/extensions/multitool/items/cable.dm @@ -21,6 +21,6 @@ var/obj/item/stack/cable_coil/cable_coil = holder if(href_list["select_color"] && (href_list["select_color"] in get_global_cable_colors())) cable_coil.set_cable_color(href_list["select_color"], user) - return MT_REFRESH + return TOPIC_REFRESH return ..() diff --git a/code/datums/extensions/multitool/items/stock_parts_radio.dm b/code/datums/extensions/multitool/items/stock_parts_radio.dm index ec0b51dc454..e35bf864977 100644 --- a/code/datums/extensions/multitool/items/stock_parts_radio.dm +++ b/code/datums/extensions/multitool/items/stock_parts_radio.dm @@ -49,48 +49,48 @@ var/obj/item/stock_parts/radio/radio = holder if(href_list["unlink"]) machine = null - return MT_CLOSE + return TOPIC_CLOSE if(href_list["frequency"]) var/new_frequency = input(user, "Select a new frequency:", "Frequency Selection", radio.frequency) as null|num if(!new_frequency || (extension_status(user) != STATUS_INTERACTIVE)) - return MT_NOACTION + return TOPIC_NOACTION new_frequency = sanitize_frequency(new_frequency, RADIO_LOW_FREQ, RADIO_HIGH_FREQ) if(new_frequency == radio.frequency) - return MT_NOACTION + return TOPIC_NOACTION radio.set_frequency(new_frequency, radio.filter) - return MT_REFRESH + return TOPIC_REFRESH if(href_list["id_tag"]) var/new_id_tag = input(user, "Select a new ID:", "ID Selection", radio.id_tag) as null|text if(!new_id_tag || (extension_status(user) != STATUS_INTERACTIVE)) - return MT_NOACTION + return TOPIC_NOACTION new_id_tag = sanitize(new_id_tag) if(new_id_tag == radio.id_tag) - return MT_NOACTION + return TOPIC_NOACTION radio.set_id_tag(new_id_tag) - return MT_REFRESH + return TOPIC_REFRESH if(href_list["filter"]) var/new_filter = input(user, "Select a new radio filter (usually signals are sent to listeners on your id_tag; this will override that behavior):", "Filter Selection", radio.filter) as null|anything in global.all_selectable_radio_filters if(!new_filter || (extension_status(user) != STATUS_INTERACTIVE)) - return MT_NOACTION + return TOPIC_NOACTION if(new_filter == radio.filter) - return MT_NOACTION + return TOPIC_NOACTION radio.set_frequency(radio.frequency, new_filter) - return MT_REFRESH + return TOPIC_REFRESH if(href_list["encryption"]) var/new_encryption = input(user, "Select a new encryption key:", "Encryption Key Selection", radio.encryption) as null|num if(!new_encryption || (extension_status(user) != STATUS_INTERACTIVE)) - return MT_NOACTION + return TOPIC_NOACTION new_encryption = sanitize_integer(new_encryption, 0, 999, radio.encryption) if(new_encryption == radio.encryption) - return MT_NOACTION + return TOPIC_NOACTION radio.encryption = new_encryption - return MT_REFRESH + return TOPIC_REFRESH if(href_list["stockreset"]) var/obj/machinery/actual_machine = machine && machine.resolve() if(!actual_machine) - return MT_CLOSE + return TOPIC_CLOSE actual_machine.apply_preset_to(radio) - return MT_REFRESH + return TOPIC_REFRESH // Helper. /datum/extension/interactive/multitool/radio/proc/event_list_to_selection_table(table_tag, list/selected_events) @@ -111,44 +111,44 @@ if(href_list["remove"]) var/thing = href_list["remove"] LAZYREMOVE(selected_events, thing) - return MT_REFRESH + return TOPIC_REFRESH if(href_list["rename"]) var/thing = href_list["rename"] if(selected_events && selected_events[thing]) var/new_name = input(user, "Select a new message key for this item:", "Key Select", thing) as null|text new_name = sanitize(new_name) if(!new_name || (extension_status(user) != STATUS_INTERACTIVE)) - return MT_REFRESH + return TOPIC_REFRESH if(!selected_events || !selected_events[thing]) - return MT_REFRESH + return TOPIC_REFRESH selected_events[new_name] = selected_events[thing] selected_events -= thing - return MT_REFRESH + return TOPIC_REFRESH if(href_list["new_val"]) var/thing = href_list["new_val"] var/decl/public_access/variable = selected_events && selected_events[thing] if(!variable || !LAZYLEN(valid_events)) - return MT_REFRESH + return TOPIC_REFRESH var/valid_variables = list() for(var/path in valid_events) valid_variables += valid_events[path] var/new_var = input(user, "Select a new action for this item:", "Action Select", thing) as null|anything in valid_variables if(!new_var || (extension_status(user) != STATUS_INTERACTIVE)) - return MT_REFRESH + return TOPIC_REFRESH if(!(selected_events && selected_events[thing] == variable)) - return MT_REFRESH + return TOPIC_REFRESH selected_events[thing] = new_var - return MT_REFRESH + return TOPIC_REFRESH if(href_list["add"]) if(!LAZYLEN(valid_events)) - return MT_REFRESH + return TOPIC_REFRESH LAZYSET(selected_events, copytext(md5(num2text(rand(0, 1))), 1, 11), valid_events[pick(valid_events)]) // random key - return MT_REFRESH + return TOPIC_REFRESH if(href_list["desc"]) var/decl/public_access/variable = locate(href_list["desc"]) if(istype(variable)) to_chat(user, variable.desc) - return MT_NOACTION + return TOPIC_NOACTION /datum/extension/interactive/multitool/radio/transmitter/aquire_target() var/obj/machinery/actual_machine = ..() @@ -178,7 +178,7 @@ return var/obj/machinery/actual_machine = machine.resolve() if(!actual_machine) - return MT_CLOSE + return TOPIC_CLOSE var/obj/item/stock_parts/radio/transmitter/basic/radio = holder if(href_list["on_change"]) return event_list_topic(radio.transmit_on_change, actual_machine.public_variables, user, href_list) @@ -216,7 +216,7 @@ return var/obj/machinery/actual_machine = machine.resolve() if(!actual_machine) - return MT_CLOSE + return TOPIC_CLOSE var/obj/item/stock_parts/radio/transmitter/on_event/radio = holder if(href_list["on_event"]) @@ -257,7 +257,7 @@ return var/obj/machinery/actual_machine = machine.resolve() if(!actual_machine) - return MT_CLOSE + return TOPIC_CLOSE var/obj/item/stock_parts/radio/receiver/radio = holder if(href_list["call"]) return event_list_topic(radio.receive_and_call, actual_machine.public_methods, user, href_list) diff --git a/code/datums/extensions/multitool/multitool.dm b/code/datums/extensions/multitool/multitool.dm index 08e98ebe7eb..7327f919da9 100644 --- a/code/datums/extensions/multitool/multitool.dm +++ b/code/datums/extensions/multitool/multitool.dm @@ -45,26 +45,29 @@ . = send_buffer(M, buffer, user) else if(href_list["purge"]) M.set_buffer(null) - . = MT_REFRESH + . = TOPIC_REFRESH else . = on_topic(href, href_list, user) - switch(.) - if(MT_REFRESH) - interact(M, user) - if(MT_CLOSE) - close_window(user) - return MT_NOACTION ? FALSE : TRUE + if(. & TOPIC_CLOSE) + close_window(user) + return TOPIC_HANDLED // don't run any other Topic() behavior for this call + else if(. & TOPIC_REFRESH) + interact(M, user) + return TOPIC_HANDLED // don't return TOPIC_REFRESH to avoid any potential double-refreshes + else if(!.) + return TOPIC_NOACTION + return TOPIC_REFRESH /datum/extension/interactive/multitool/proc/on_topic(href, href_list, user) - return MT_NOACTION + return TOPIC_NOACTION /datum/extension/interactive/multitool/proc/send_buffer(var/obj/item/multitool/M, var/atom/buffer, var/mob/user) if(M.get_buffer() == buffer && buffer) receive_buffer(M, buffer, user) else if(!buffer) to_chat(user, "Unable to acquire data from the buffered object. Purging from memory.") - return MT_REFRESH + return TOPIC_REFRESH /datum/extension/interactive/multitool/proc/receive_buffer(var/obj/item/multitool/M, var/atom/buffer, var/mob/user) return \ No newline at end of file diff --git a/code/game/machinery/embedded_controller/airlock_controllers_dummy.dm b/code/game/machinery/embedded_controller/airlock_controllers_dummy.dm index f187d98f09c..dabbb7680fb 100644 --- a/code/game/machinery/embedded_controller/airlock_controllers_dummy.dm +++ b/code/game/machinery/embedded_controller/airlock_controllers_dummy.dm @@ -132,12 +132,12 @@ if(href_list["input_tag"]) var/new_tag = input(user, "Enter the tag of the controller to connect to.", "Tag Selection", terminal.id_tag) as text|null if(extension_status(user) != STATUS_INTERACTIVE) - return MT_NOACTION + return TOPIC_NOACTION new_tag = sanitize_name(new_tag, MAX_MESSAGE_LEN, TRUE, FALSE) if(new_tag) terminal.id_tag = new_tag terminal.setup_target_controller() - return MT_REFRESH + return TOPIC_REFRESH if(istext(href_list["set_tag"])) var/new_tag = href_list["set_tag"] @@ -145,6 +145,6 @@ if(new_tag) terminal.id_tag = new_tag terminal.setup_target_controller() - return MT_REFRESH + return TOPIC_REFRESH return ..() diff --git a/code/game/machinery/embedded_controller/embedded_controller_base.dm b/code/game/machinery/embedded_controller/embedded_controller_base.dm index bfdbc356c44..2f893501f6e 100644 --- a/code/game/machinery/embedded_controller/embedded_controller_base.dm +++ b/code/game/machinery/embedded_controller/embedded_controller_base.dm @@ -174,20 +174,20 @@ if(href_list["set_tag"]) var/new_tag = input(user, "Enter a new tag to use. Warning: this will reset all tags used by this machine, not just the main one!", "Tag Selection", controller.id_tag) as text|null if(extension_status(user) != STATUS_INTERACTIVE) - return MT_NOACTION + return TOPIC_NOACTION new_tag = sanitize_name(new_tag, MAX_MESSAGE_LEN, TRUE, FALSE) if(new_tag) controller.reset_id_tags(new_tag) controller.set_frequency(controller.frequency) - return MT_REFRESH + return TOPIC_REFRESH if(href_list["set_freq"]) var/new_frequency = input(user, "Enter a new frequency to use.", "frequency Selection", controller.frequency) as num|null if(!new_frequency || (extension_status(user) != STATUS_INTERACTIVE)) - return MT_NOACTION + return TOPIC_NOACTION new_frequency = sanitize_frequency(new_frequency, RADIO_LOW_FREQ, RADIO_HIGH_FREQ) controller.set_frequency(new_frequency) - return MT_REFRESH + return TOPIC_REFRESH /decl/stock_part_preset/radio/receiver/vent_pump/airlock frequency = EXTERNAL_AIR_FREQ diff --git a/nebula.dme b/nebula.dme index 5036830ed67..c3058b700c4 100644 --- a/nebula.dme +++ b/nebula.dme @@ -449,7 +449,6 @@ #include "code\datums\extensions\eye\landing.dm" #include "code\datums\extensions\holster\holster.dm" #include "code\datums\extensions\milkable\milkable.dm" -#include "code\datums\extensions\multitool\_multitool.dm" #include "code\datums\extensions\multitool\multitool.dm" #include "code\datums\extensions\multitool\store.dm" #include "code\datums\extensions\multitool\circuitboards\buildtype_select.dm" From 7635c33395e9f210636631147f84e5dcc24672fe Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Thu, 5 Dec 2024 20:30:33 -0500 Subject: [PATCH 3/7] Consolidate ghost mob files with only one proc each --- code/modules/mob/observer/ghost/ghost.dm | 18 ++++++++++++++++++ code/modules/mob/observer/ghost/login.dm | 6 ------ code/modules/mob/observer/ghost/logout.dm | 5 ----- code/modules/mob/observer/ghost/say.dm | 2 -- nebula.dme | 3 --- 5 files changed, 18 insertions(+), 16 deletions(-) delete mode 100644 code/modules/mob/observer/ghost/login.dm delete mode 100644 code/modules/mob/observer/ghost/logout.dm delete mode 100644 code/modules/mob/observer/ghost/say.dm diff --git a/code/modules/mob/observer/ghost/ghost.dm b/code/modules/mob/observer/ghost/ghost.dm index acf4b0af582..b6c2f5f18be 100644 --- a/code/modules/mob/observer/ghost/ghost.dm +++ b/code/modules/mob/observer/ghost/ghost.dm @@ -626,3 +626,21 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp ghost_all_access = new if(!is_type_in_list(ghost_all_access, exceptions)) LAZYDISTINCTADD(., ghost_all_access) + +/mob/observer/ghost/Login() + ..() + if (ghost_image) + ghost_image.appearance = src + ghost_image.appearance_flags = RESET_ALPHA + SSghost_images.queue_image_update(src) + +/mob/observer/ghost/proc/check_existence_failure() + if(!QDELETED(src) && !key) //we've transferred to another mob. This ghost should be deleted. + qdel(src) + +/mob/observer/ghost/Logout() + ..() + addtimer(CALLBACK(src, PROC_REF(check_existence_failure)), 0) + +/mob/observer/ghost/say(var/message) + sanitize_and_communicate(/decl/communication_channel/dsay, client, message) diff --git a/code/modules/mob/observer/ghost/login.dm b/code/modules/mob/observer/ghost/login.dm deleted file mode 100644 index f8be3dd4671..00000000000 --- a/code/modules/mob/observer/ghost/login.dm +++ /dev/null @@ -1,6 +0,0 @@ -/mob/observer/ghost/Login() - ..() - if (ghost_image) - ghost_image.appearance = src - ghost_image.appearance_flags = RESET_ALPHA - SSghost_images.queue_image_update(src) diff --git a/code/modules/mob/observer/ghost/logout.dm b/code/modules/mob/observer/ghost/logout.dm deleted file mode 100644 index 7c125cef367..00000000000 --- a/code/modules/mob/observer/ghost/logout.dm +++ /dev/null @@ -1,5 +0,0 @@ -/mob/observer/ghost/Logout() - ..() - spawn(0) - if(src && !key) //we've transferred to another mob. This ghost should be deleted. - qdel(src) diff --git a/code/modules/mob/observer/ghost/say.dm b/code/modules/mob/observer/ghost/say.dm deleted file mode 100644 index f30f4a672c1..00000000000 --- a/code/modules/mob/observer/ghost/say.dm +++ /dev/null @@ -1,2 +0,0 @@ -/mob/observer/ghost/say(var/message) - sanitize_and_communicate(/decl/communication_channel/dsay, client, message) diff --git a/nebula.dme b/nebula.dme index c3058b700c4..a48e4415c23 100644 --- a/nebula.dme +++ b/nebula.dme @@ -3089,9 +3089,6 @@ #include "code\modules\mob\observer\eye\freelook\ai\update_triggers.dm" #include "code\modules\mob\observer\ghost\follow.dm" #include "code\modules\mob\observer\ghost\ghost.dm" -#include "code\modules\mob\observer\ghost\login.dm" -#include "code\modules\mob\observer\ghost\logout.dm" -#include "code\modules\mob\observer\ghost\say.dm" #include "code\modules\mob\observer\virtual\_constants.dm" #include "code\modules\mob\observer\virtual\base.dm" #include "code\modules\mob\observer\virtual\helpers.dm" From da2fbfc1566d0bc7060b413a1309111efe8c5594 Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Thu, 5 Dec 2024 22:01:24 -0500 Subject: [PATCH 4/7] Remove unused item worth define --- code/modules/item_worth/_helpers.dm | 3 --- nebula.dme | 1 - 2 files changed, 4 deletions(-) delete mode 100644 code/modules/item_worth/_helpers.dm diff --git a/code/modules/item_worth/_helpers.dm b/code/modules/item_worth/_helpers.dm deleted file mode 100644 index 8841debc67a..00000000000 --- a/code/modules/item_worth/_helpers.dm +++ /dev/null @@ -1,3 +0,0 @@ -//Workaround by Ginja due to the fact initial(parent_type) does not work. - -#define PARENT(x) text2path(replacetext("[x]", regex("/\[^/\]+$"), "")) \ No newline at end of file diff --git a/nebula.dme b/nebula.dme index a48e4415c23..2033d9acb32 100644 --- a/nebula.dme +++ b/nebula.dme @@ -2630,7 +2630,6 @@ #include "code\modules\item_effects\item_effect_charges.dm" #include "code\modules\item_effects\item_effect_debug.dm" #include "code\modules\item_effects\item_effect_item.dm" -#include "code\modules\item_worth\_helpers.dm" #include "code\modules\keybindings\_defines.dm" #include "code\modules\keybindings\_keybindings.dm" #include "code\modules\keybindings\admin.dm" From 0b9bea4cbe068eb6ffcddaf8a1c6ec7634f627e2 Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Wed, 11 Dec 2024 01:51:16 -0500 Subject: [PATCH 5/7] Bump Del count for comments --- test/check-paths.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/check-paths.sh b/test/check-paths.sh index 77f46145433..64ca05563de 100755 --- a/test/check-paths.sh +++ b/test/check-paths.sh @@ -24,7 +24,7 @@ exactly() { # exactly N name search [mode] [filter] # With the potential exception of << if you increase any of these numbers you're probably doing it wrong # Additional exception August 2020: \b is a regex symbol as well as a BYOND macro. exactly 1 "escapes" '\\\\(red|blue|green|black|b|i[^mc])' -exactly 6 "Del()s" '\WDel\(' +exactly 8 "Del()s" '\WDel\(' exactly 2 "/atom text paths" '"/atom' exactly 2 "/area text paths" '"/area' exactly 2 "/datum text paths" '"/datum' From 2d69b12ab4403df901cc00b341a97a7da13c743e Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Wed, 11 Dec 2024 01:51:31 -0500 Subject: [PATCH 6/7] Add guard for mobs destroyed in handle_environment --- code/modules/mob/living/life.dm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm index e73ef41b016..22631be2091 100644 --- a/code/modules/mob/living/life.dm +++ b/code/modules/mob/living/life.dm @@ -23,6 +23,8 @@ //Handle temperature/pressure differences between body and environment handle_environment(loc.return_air()) + if(QDELETED(src)) // Destroyed by fire or pressure damage in handle_environment() + return PROCESS_KILL handle_regular_status_updates() // Status & health update, are we dead or alive etc. handle_stasis() From 38aa9d3ed745366ed1caa444fe573a743107af52 Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Thu, 12 Dec 2024 17:27:11 -0500 Subject: [PATCH 7/7] Adjust counts in check-paths.sh --- test/check-paths.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/check-paths.sh b/test/check-paths.sh index 64ca05563de..dcf902b9335 100755 --- a/test/check-paths.sh +++ b/test/check-paths.sh @@ -32,12 +32,12 @@ exactly 2 "/mob text paths" '"/mob' exactly 6 "/obj text paths" '"/obj' exactly 10 "/turf text paths" '"/turf' exactly 1 "world<< uses" 'world<<|world[[:space:]]<<' -exactly 93 "'in world' uses" 'in world' +exactly 90 "'in world' uses" 'in world' exactly 1 "world.log<< uses" 'world.log<<|world.log[[:space:]]<<' exactly 18 "<< uses" '(?> uses" '>>(?!>)' -P exactly 0 "incorrect indentations" '^( {4,})' -P -exactly 24 "text2path uses" 'text2path' +exactly 22 "text2path uses" 'text2path' exactly 4 "update_icon() override" '/update_icon\((.*)\)' -P exactly 0 "goto uses" 'goto ' exactly 9 "atom/New uses" '^/(obj|atom|area|mob|turf).*/New\('