diff --git a/code/__DEFINES/dcs/signals/signals_atom/signals_atom_mouse.dm b/code/__DEFINES/dcs/signals/signals_atom/signals_atom_mouse.dm index 2312c42baa4..3ff131d9a39 100644 --- a/code/__DEFINES/dcs/signals/signals_atom/signals_atom_mouse.dm +++ b/code/__DEFINES/dcs/signals/signals_atom/signals_atom_mouse.dm @@ -26,3 +26,5 @@ #define COMSIG_MOUSEDROPPED_ONTO "mousedropped_onto" ///from base of mob/MouseWheelOn(): (/atom, delta_x, delta_y, params) #define COMSIG_MOUSE_SCROLL_ON "mousescroll_on" +/// From /atom/movable/screen/click(): (atom/target, atom/location, control, params, mob/user) +#define COMSIG_SCREEN_ELEMENT_CLICK "screen_element_click" diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm index 8b96a5491bd..ac10680db27 100644 --- a/code/_onclick/hud/alert.dm +++ b/code/_onclick/hud/alert.dm @@ -1048,6 +1048,9 @@ or shoot a gun to move around via Newton's 3rd Law of Motion." return TRUE /atom/movable/screen/alert/Click(location, control, params) + SHOULD_CALL_PARENT(TRUE) + + ..() if(!usr || !usr.client) return FALSE if(usr != owner) diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 2a5b1cc35fd..d7bd98febda 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -35,6 +35,12 @@ /// If FALSE, this will not be cleared when calling /client/clear_screen() var/clear_with_screen = TRUE + /// If TRUE, clicking the screen element will fall through and perform a default "Click" call + /// Obviously this requires your Click override, if any, to call parent on their own. + /// This is set to FALSE to default to dissade you from doing this. + /// Generally we don't want default Click stuff, which results in bugs like using Telekinesis on a screen element + /// or trying to point your gun at your screen. + var/default_click = FALSE /atom/movable/screen/Initialize(mapload, datum/hud/hud_owner) . = ..() @@ -46,6 +52,12 @@ hud = null return ..() +/atom/movable/screen/Click(location, control, params) + if(flags_1 & INITIALIZED_1) + SEND_SIGNAL(src, COMSIG_SCREEN_ELEMENT_CLICK, location, control, params, usr) + if(default_click) + return ..() + /atom/movable/screen/examine(mob/user) return list() @@ -654,9 +666,6 @@ icon_state = "mood5" screen_loc = ui_mood -/atom/movable/screen/mood/attack_tk() - return - /atom/movable/screen/splash icon = 'icons/blanks/blank_title.png' icon_state = "" diff --git a/code/datums/components/crafting/crafting.dm b/code/datums/components/crafting/crafting.dm index 3581bec4b5a..a6a905ccdb4 100644 --- a/code/datums/components/crafting/crafting.dm +++ b/code/datums/components/crafting/crafting.dm @@ -10,7 +10,7 @@ C.icon = H.ui_style H.static_inventory += C CL.screen += C - RegisterSignal(C, COMSIG_CLICK, PROC_REF(component_ui_interact)) + RegisterSignal(C, COMSIG_SCREEN_ELEMENT_CLICK, PROC_REF(component_ui_interact)) #define COOKING TRUE #define CRAFTING FALSE diff --git a/code/datums/mood.dm b/code/datums/mood.dm index ac4f3cc60cd..51b17a583ff 100644 --- a/code/datums/mood.dm +++ b/code/datums/mood.dm @@ -304,7 +304,7 @@ mood_screen_object.color = "#4b96c4" hud.infodisplay += mood_screen_object RegisterSignal(hud, COMSIG_QDELETING, PROC_REF(unmodify_hud)) - RegisterSignal(mood_screen_object, COMSIG_CLICK, PROC_REF(hud_click)) + RegisterSignal(mood_screen_object, COMSIG_SCREEN_ELEMENT_CLICK, PROC_REF(hud_click)) /// Removes the mood HUD object /datum/mood/proc/unmodify_hud(datum/source) diff --git a/code/datums/station_traits/_station_trait.dm b/code/datums/station_traits/_station_trait.dm index 7130f1c896b..28836b2b4fa 100644 --- a/code/datums/station_traits/_station_trait.dm +++ b/code/datums/station_traits/_station_trait.dm @@ -93,7 +93,7 @@ GLOBAL_LIST_EMPTY(lobby_station_traits) SHOULD_CALL_PARENT(TRUE) lobby_buttons |= lobby_button RegisterSignal(lobby_button, COMSIG_ATOM_UPDATE_ICON, PROC_REF(on_lobby_button_update_icon)) - RegisterSignal(lobby_button, COMSIG_CLICK, PROC_REF(on_lobby_button_click)) + RegisterSignal(lobby_button, COMSIG_SCREEN_ELEMENT_CLICK, PROC_REF(on_lobby_button_click)) RegisterSignal(lobby_button, COMSIG_QDELETING, PROC_REF(on_lobby_button_destroyed)) lobby_button.update_appearance(UPDATE_ICON) diff --git a/code/datums/status_effects/debuffs/debuffs.dm b/code/datums/status_effects/debuffs/debuffs.dm index fa4ba9a6dae..e7d1fabde4d 100644 --- a/code/datums/status_effects/debuffs/debuffs.dm +++ b/code/datums/status_effects/debuffs/debuffs.dm @@ -881,6 +881,9 @@ icon_state = "antalert" /atom/movable/screen/alert/status_effect/ants/Click() + . = ..() + if(!.) + return var/mob/living/living = owner if(!istype(living) || !living.can_resist() || living != owner) return diff --git a/code/datums/status_effects/debuffs/hooked.dm b/code/datums/status_effects/debuffs/hooked.dm index 9280303209a..3eb7caf1c37 100644 --- a/code/datums/status_effects/debuffs/hooked.dm +++ b/code/datums/status_effects/debuffs/hooked.dm @@ -31,6 +31,9 @@ icon_state = "hooked" /atom/movable/screen/alert/status_effect/hooked/Click() + . = ..() + if(!.) + return if(!owner.can_resist()) return owner.balloon_alert(owner, "removing hook...") diff --git a/code/game/objects/effects/cursor_catcher.dm b/code/game/objects/effects/cursor_catcher.dm index 3624018afc8..3229cd44b70 100644 --- a/code/game/objects/effects/cursor_catcher.dm +++ b/code/game/objects/effects/cursor_catcher.dm @@ -3,6 +3,7 @@ icon_state = "fullscreen_blocker" // Fullscreen semi transparent icon plane = HUD_PLANE mouse_opacity = MOUSE_OPACITY_ICON + default_click = TRUE /// The mob whose cursor we are tracking. var/mob/owner /// Client view size of the scoping mob. diff --git a/code/modules/mod/modules/module_kinesis.dm b/code/modules/mod/modules/module_kinesis.dm index 0cd13871071..bf26337af3a 100644 --- a/code/modules/mod/modules/module_kinesis.dm +++ b/code/modules/mod/modules/module_kinesis.dm @@ -171,7 +171,7 @@ kinesis_beam = mod.wearer.Beam(grabbed_atom, "kinesis") kinesis_catcher = mod.wearer.overlay_fullscreen("kinesis", /atom/movable/screen/fullscreen/cursor_catcher/kinesis, 0) kinesis_catcher.assign_to_mob(mod.wearer) - RegisterSignal(kinesis_catcher, COMSIG_CLICK, PROC_REF(on_catcher_click)) + RegisterSignal(kinesis_catcher, COMSIG_SCREEN_ELEMENT_CLICK, PROC_REF(on_catcher_click)) soundloop.start() START_PROCESSING(SSfastprocess, src)