Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] Blocks (most instances of) screen elements from entering base atom /Click #2574

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/dcs/signals/signals_atom/signals_atom_mouse.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 3 additions & 0 deletions code/_onclick/hud/alert.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 12 additions & 3 deletions code/_onclick/hud/screen_objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
. = ..()
Expand All @@ -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()

Expand Down Expand Up @@ -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 = ""
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/crafting/crafting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion code/datums/mood.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/datums/station_traits/_station_trait.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 3 additions & 0 deletions code/datums/status_effects/debuffs/debuffs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions code/datums/status_effects/debuffs/hooked.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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...")
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/effects/cursor_catcher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mod/modules/module_kinesis.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Loading