From f797eb05c097bf23ea2fceb032cacded6b09ca6b Mon Sep 17 00:00:00 2001 From: Batrachophreno Date: Fri, 30 Jan 2026 14:26:47 -0500 Subject: [PATCH] Mousetrap fix (#21759) Fixes https://github.com/Aurorastation/Aurora.3/issues/21744 Mousetraps were missing the loc_connection element on initialization. They now trigger appropriately when mobs (mouse, human, or otherwise) step onto their location. changes: - bugfix: "Mousetraps now trigger when mobs move onto their location." - code_imp: "Updates affected assemblies to use feedback_hints() instead of get_examine_text(), improves clarity." --------- Signed-off-by: Batrachophreno Co-authored-by: Cody Brittain <1779662+Generalcamo@users.noreply.github.com> --- code/modules/assembly/assembly.dm | 17 +++------ code/modules/assembly/mousetrap.dm | 13 ++++++- html/changelogs/Bat-Mousetrap.yml | 59 ++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 14 deletions(-) create mode 100644 html/changelogs/Bat-Mousetrap.yml diff --git a/code/modules/assembly/assembly.dm b/code/modules/assembly/assembly.dm index 759e61a0b19..f851d8743db 100644 --- a/code/modules/assembly/assembly.dm +++ b/code/modules/assembly/assembly.dm @@ -96,9 +96,7 @@ attach_assembly(A, user) return if(attacking_item.tool_behaviour == TOOL_SCREWDRIVER) - if(toggle_secure()) - to_chat(user, SPAN_NOTICE("\The [src] is ready!")) - else + if(!toggle_secure()) to_chat(user, SPAN_NOTICE("\The [src] can now be attached!")) return return ..() @@ -107,15 +105,10 @@ STOP_PROCESSING(SSprocessing, src) return - -/obj/item/device/assembly/get_examine_text(mob/user, distance, is_adjacent, infix, suffix) - . = ..() - if(distance <= 1 || loc == user) - if(secured) - . += "\The [src] is ready!" - else - . += "\The [src] can be attached!" - +/obj/item/device/assembly/feedback_hints(mob/user, distance, is_adjacent) + . += ..() + if((distance <= 1 || loc == user) && !secured) + . += SPAN_NOTICE("\The [src] can be attached!") /obj/item/device/assembly/attack_self(mob/user) if(!user) diff --git a/code/modules/assembly/mousetrap.dm b/code/modules/assembly/mousetrap.dm index 5a150390262..a4bc7a58aa0 100644 --- a/code/modules/assembly/mousetrap.dm +++ b/code/modules/assembly/mousetrap.dm @@ -13,10 +13,19 @@ matter = list(DEFAULT_WALL_MATERIAL = 100) var/armed = FALSE -/obj/item/device/assembly/mousetrap/get_examine_text(mob/user, distance, is_adjacent, infix, suffix) +/obj/item/device/assembly/mousetrap/Initialize(mapload) . = ..() + + var/static/list/loc_connections = list( + COMSIG_ATOM_ENTERED = PROC_REF(on_entered), + ) + + AddElement(/datum/element/connect_loc, loc_connections) + +/obj/item/device/assembly/mousetrap/feedback_hints(mob/user, distance, is_adjacent) + . += ..() if(armed) - . += "It looks like it's armed." + . += SPAN_NOTICE("It looks like it's armed.") /obj/item/device/assembly/mousetrap/update_icon() icon_state = armed ? "mousetraparmed" : "mousetrap" diff --git a/html/changelogs/Bat-Mousetrap.yml b/html/changelogs/Bat-Mousetrap.yml new file mode 100644 index 00000000000..d9c584d5843 --- /dev/null +++ b/html/changelogs/Bat-Mousetrap.yml @@ -0,0 +1,59 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: Batrachophrenoboocosmomachia + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Mousetraps now trigger when mobs move onto their location." + - code_imp: "Updates affected assemblies to use feedback_hints() instead of get_examine_text(), improves clarity."