From c0e0e9289f7cb7df7bfcecaa76bd7a7bf6735e64 Mon Sep 17 00:00:00 2001 From: Jeremiah <42397676+jlsnow301@users.noreply.github.com> Date: Tue, 28 May 2024 14:54:05 -0700 Subject: [PATCH] [no gbp] Fixes hilberts hotel alt click (#83431) ## About The Pull Request Base alt click would skip turfs as I did not think any had special alt click behaviors. I was mistaken. The comment was too. Note: Checking can_perform_action() does not work on turfs. I added some simple checks for turfs in its absence. ## Why It's Good For The Game Fixes #83430 ## Changelog :cl: add: Added a screentip for hilbert's hotel door fix: Fixed alt-click interaction with hilbert's hotel door /:cl: --------- Co-authored-by: san7890 --- code/_onclick/click_alt.dm | 22 +++++++++++++++++-- .../ruins/spaceruin_code/hilbertshotel.dm | 13 +++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/code/_onclick/click_alt.dm b/code/_onclick/click_alt.dm index bda0e849a65..dfda35ebda9 100644 --- a/code/_onclick/click_alt.dm +++ b/code/_onclick/click_alt.dm @@ -24,8 +24,14 @@ client.loot_panel.open(tile) return - // Turfs don't have a click_alt currently, so this saves some time. - if(!isturf(target) && can_perform_action(target, (target.interaction_flags_click | SILENT_ADJACENCY))) + var/can_use_click_action = FALSE + if(isturf(target)) + // Turfs are special because they can't be used with can_perform_action + can_use_click_action = can_perform_turf_action(target) + else + can_use_click_action = can_perform_action(target, (target.interaction_flags_click | SILENT_ADJACENCY)) + + if(can_use_click_action) // If it has a signal handler that returns a click action, done. if(SEND_SIGNAL(target, COMSIG_CLICK_ALT, src) & CLICK_ACTION_ANY) return @@ -78,3 +84,15 @@ /atom/proc/click_alt(mob/user) SHOULD_CALL_PARENT(FALSE) return NONE + + +/// Helper proc to validate turfs. Used because can_perform_action does not support turfs. +/mob/proc/can_perform_turf_action(turf/target) + if(!CanReach(target)) // No error message for parity with SILENT_ADJACENCY + return FALSE + + if(incapacitated()) + to_chat(src, span_warning("You can't use this!")) + return FALSE + + return TRUE diff --git a/code/modules/mapfluff/ruins/spaceruin_code/hilbertshotel.dm b/code/modules/mapfluff/ruins/spaceruin_code/hilbertshotel.dm index 8906a6d2555..b2e0e16f9a8 100644 --- a/code/modules/mapfluff/ruins/spaceruin_code/hilbertshotel.dm +++ b/code/modules/mapfluff/ruins/spaceruin_code/hilbertshotel.dm @@ -302,6 +302,15 @@ GLOBAL_VAR_INIT(hhMysteryRoomNumber, rand(1, 999999)) explosive_resistance = INFINITY var/obj/item/hilbertshotel/parentSphere +/turf/closed/indestructible/hoteldoor/Initialize(mapload) + . = ..() + register_context() + +/turf/closed/indestructible/hoteldoor/add_context(atom/source, list/context, obj/item/held_item, mob/user) + . = ..() + context[SCREENTIP_CONTEXT_ALT_LMB] = "Peek through" + return CONTEXTUAL_SCREENTIP_SET + /turf/closed/indestructible/hoteldoor/proc/promptExit(mob/living/user) if(!isliving(user)) return @@ -345,6 +354,10 @@ GLOBAL_VAR_INIT(hhMysteryRoomNumber, rand(1, 999999)) promptExit(user) /turf/closed/indestructible/hoteldoor/click_alt(mob/user) + if(user.is_blind()) + to_chat(user, span_warning("Drats! Your vision is too poor to use this!")) + return CLICK_ACTION_BLOCKING + to_chat(user, span_notice("You peak through the door's bluespace peephole...")) user.reset_perspective(parentSphere) var/datum/action/peephole_cancel/PHC = new