diff --git a/code/_helpers/mobs.dm b/code/_helpers/mobs.dm index 6ef4b78f1a..2f18207faa 100644 --- a/code/_helpers/mobs.dm +++ b/code/_helpers/mobs.dm @@ -378,3 +378,13 @@ Proc for attack log creation, because really why not to_chat(user, span_warning("Please set informative OOC notes related to RP/ERP preferences. Set them using the 'OOC Notes' button on the 'General' tab in character setup.")) return TRUE return FALSE + +///Makes a call in the context of a different usr. Use sparingly +/world/proc/push_usr(mob/user_mob, datum/callback/invoked_callback, ...) + var/temp = usr + usr = user_mob + if (length(args) > 2) + . = invoked_callback.Invoke(arglist(args.Copy(3))) + else + . = invoked_callback.Invoke() + usr = temp diff --git a/code/controllers/master.dm b/code/controllers/master.dm index feb78c01f5..0f5ca28a50 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -72,7 +72,7 @@ GLOBAL_REAL(Master, /datum/controller/master) = new // Highlander-style: there can only be one! Kill off the old and replace it with the new. if(!random_seed) - #ifdef UNIT_TESTS + #ifdef UNIT_TEST random_seed = 29051994 // How about 22475? #else random_seed = rand(1, 1e9) diff --git a/code/controllers/subsystems/verb_manager.dm b/code/controllers/subsystems/verb_manager.dm index 1e3cce0a9a..8e8c4cd3bd 100644 --- a/code/controllers/subsystems/verb_manager.dm +++ b/code/controllers/subsystems/verb_manager.dm @@ -78,7 +78,7 @@ SUBSYSTEM_DEF(verb_manager) //we want unit tests to be able to directly call verbs that attempt to queue, and since unit tests should test internal behavior, we want the queue //to happen as if it was actually from player input if its called on a mob. -#ifdef UNIT_TESTS +#ifdef UNIT_TEST if(QDELETED(usr) && ismob(incoming_callback.object)) incoming_callback.user = WEAKREF(incoming_callback.object) var/datum/callback/new_us = CALLBACK(arglist(list(GLOBAL_PROC, GLOBAL_PROC_REF(_queue_verb)) + args.Copy())) diff --git a/code/game/world.dm b/code/game/world.dm index 6540ae7e99..010df4fd4e 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -280,7 +280,8 @@ var/world_topic_spam_protect_time = world.timeofday else if(copytext(T,1,5) == "info") var/input[] = params2list(T) - if(input["key"] != CONFIG_GET(string/comms_password)) + var/password = CONFIG_GET(string/comms_password) + if(!password || input["key"] != password) if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50) spawn(50) @@ -367,7 +368,8 @@ var/world_topic_spam_protect_time = world.timeofday var/input[] = params2list(T) - if(input["key"] != CONFIG_GET(string/comms_password)) + var/password = CONFIG_GET(string/comms_password) + if(!password || input["key"] != password) if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50) spawn(50) @@ -417,7 +419,8 @@ var/world_topic_spam_protect_time = world.timeofday 2. validationkey = the key the bot has, it should match the gameservers commspassword in it's configuration. */ var/input[] = params2list(T) - if(input["key"] != CONFIG_GET(string/comms_password)) + var/password = CONFIG_GET(string/comms_password) + if(!password || input["key"] != password) if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50) spawn(50) @@ -432,7 +435,8 @@ var/world_topic_spam_protect_time = world.timeofday else if(copytext(T,1,4) == "age") var/input[] = params2list(T) - if(input["key"] != CONFIG_GET(string/comms_password)) + var/password = CONFIG_GET(string/comms_password) + if(!password || input["key"] != password) if(world_topic_spam_protect_ip == addr && abs(world_topic_spam_protect_time - world.time) < 50) spawn(50) world_topic_spam_protect_time = world.time diff --git a/code/modules/asset_cache/iconforge/universal_icon.dm b/code/modules/asset_cache/iconforge/universal_icon.dm index 3446151c9b..8afcc7e657 100644 --- a/code/modules/asset_cache/iconforge/universal_icon.dm +++ b/code/modules/asset_cache/iconforge/universal_icon.dm @@ -11,7 +11,7 @@ /// Don't instantiate these yourself, use uni_icon. /datum/universal_icon/New(icon/icon_file, icon_state="", dir=SOUTH, frame=1, datum/icon_transformer/transform=null, color=null) - #ifdef UNIT_TESTS + #ifdef UNIT_TEST // This check is kinda slow and shouldn't fail unless a developer makes a mistake. So it'll get caught in unit tests. if(!isicon(icon_file) || !isfile(icon_file) || "[icon_file]" == "/icon") // bad! use 'icons/path_to_dmi.dmi' format only diff --git a/code/modules/asset_cache/transports/asset_transport.dm b/code/modules/asset_cache/transports/asset_transport.dm index 77daee2a60..e320742235 100644 --- a/code/modules/asset_cache/transports/asset_transport.dm +++ b/code/modules/asset_cache/transports/asset_transport.dm @@ -85,7 +85,7 @@ /// asset_list - A list of asset filenames to be sent to the client. Can optionally be assoicated with the asset's asset_cache_item datum. /// Returns TRUE if any assets were sent. /datum/asset_transport/proc/send_assets(client/client, list/asset_list) -#if defined(UNIT_TESTS) +#if defined(UNIT_TEST) return #endif if (!istype(client))