Clicks refactor (#20321)

Added various events to the dcs system in regards to click handling.
Refactored various mouse related procs.
Fixed MUI mask.
Fixed AI jump on double click.
Fixed some runtimes with the click handler system.
Updated the click handler system.
Fixed fireman carry.
This commit is contained in:
Fluffy
2025-01-09 23:04:48 +00:00
committed by GitHub
parent db6d55b759
commit 457a091d9a
31 changed files with 661 additions and 310 deletions
+1 -1
View File
@@ -759,7 +759,7 @@ var/list/admin_verbs_cciaa = list(
return
var/datum/click_handler/handler = mob.GetClickHandler()
if(handler.type == /datum/click_handler/build_mode)
usr.PopClickHandler()
usr.RemoveClickHandler(/datum/click_handler/build_mode)
else
usr.PushClickHandler(/datum/click_handler/build_mode)
feedback_add_details("admin_verb","TBMS") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
+1 -1
View File
@@ -76,4 +76,4 @@
/obj/effect/bmode/quit/OnClick()
var/datum/click_handler/handler = usr.GetClickHandler()
if(handler.type == /datum/click_handler/build_mode)
usr.PopClickHandler()
usr.RemoveClickHandler(/datum/click_handler/build_mode)
@@ -1,5 +1,5 @@
/datum/click_handler/build_mode
handler_flags = CLICK_HANDLER_REMOVE_ON_MOB_LOGOUT
flags = CLICK_HANDLER_REMOVE_ON_MOB_LOGOUT
var/dir
var/list/build_modes
+4
View File
@@ -813,6 +813,10 @@ var/list/localhost_addresses = list(
else
CRASH("Age check regex failed for [src.ckey]")
/client/Click(atom/object, atom/location, control, params)
SEND_SIGNAL(src, COMSIG_CLIENT_CLICK, object, location, control, params, usr)
..()
/client/MouseDrag(src_object, over_object, src_location, over_location, src_control, over_control, params)
var/list/modifiers = params2list(params)
+1 -1
View File
@@ -155,7 +155,7 @@
if(user.get_equipped_item(slot_wear_mask) != src)
to_chat(user, SPAN_WARNING("You must be wearing \the [src] to activate it!"))
return
var/datum/component/eye/freelook/CN = GetComponent(/datum/component/eye)
var/datum/component/eye/freelook/CN = GetComponent(/datum/component/eye/freelook)
if(!CN)
to_chat(user, SPAN_WARNING("\The [src] doesn't respond!"))
return
@@ -16,7 +16,7 @@
body.mouse_drop_receive(arglist(args))
else . = ..()
/mob/living/heavy_vehicle/ClickOn(var/atom/A, params, var/mob/user)
/mob/living/heavy_vehicle/ClickOn(atom/A, params, mob/user)
if(!user || incapacitated() || user.incapacitated() || lockdown)
return
+18 -5
View File
@@ -1,23 +1,33 @@
// AI EYE
//
// A mob that the AI controls to look around the station with.
// It streams chunks as it moves around, which will show it what the AI can and cannot see.
/// Generic version of the AI eye without the AI-specific handling, for things like the Camera MIU mask.
/mob/abstract/eye/freelook
// Generic version of the AI eye without the AI-specific handling, for things like the Camera MIU mask.
name = "Inactive Camera Eye"
name_suffix = "Camera Eye"
living_eye = FALSE
click_handler_type = /datum/click_handler/eye/freelook
/mob/abstract/eye/freelook/Initialize()
. = ..()
visualnet = GLOB.cameranet
/datum/click_handler/eye/freelook/OnDblClick(atom/A, params)
var/mob/abstract/eye = user.eyeobj
if(!eye) //Something has broken, ensure the click handler doesn't stick around
user.RemoveClickHandler(src)
return
eye.DblClickOn(A, params)
/// AI EYE
///
/// A mob that the AI controls to look around the station with.
/// It streams chunks as it moves around, which will show it what the AI can and cannot see.
/mob/abstract/eye/freelook/aiEye
name = "Inactive AI Eye"
name_suffix = "AI Eye"
icon_state = "AI-eye"
living_eye = FALSE
click_handler_type = /datum/click_handler/eye/freelook/aiEye
/mob/abstract/eye/freelook/aiEye/Initialize()
. = ..()
@@ -35,6 +45,9 @@
ai.holo.move_hologram(ai)
return 1
/datum/click_handler/eye/freelook/aiEye/OnDblClick(atom/A, params)
user.DblClickOn(A, params)
// AI MOVEMENT
// The AI's "eye". Described on the top of the page.
+1 -1
View File
@@ -99,7 +99,7 @@
return
remove_visual(owner)
LAZYREMOVE(owner.additional_vision_handlers, src)
visualnet.remove_eye(src)
visualnet?.remove_eye(src)
owner.eyeobj = null
if(owner.client)
owner.client.eye = owner
+1 -1
View File
@@ -38,7 +38,7 @@
if(istype(target))
ManualFollow(target)
/mob/abstract/ghost/ClickOn(var/atom/A, var/params)
/mob/abstract/ghost/ClickOn(atom/A, params)
if(!canClick())
return
setClickCooldown(4)
@@ -175,7 +175,7 @@
var/datum/click_handler/handler = GetClickHandler()
if(handler.type == /datum/click_handler/build_mode)
usr.PopClickHandler()
usr.RemoveClickHandler(/datum/click_handler/build_mode)
else
usr.PushClickHandler(/datum/click_handler/build_mode)
@@ -1205,7 +1205,7 @@ There are several things that need to be remembered:
if(update_icons)
update_icon()
/mob/living/carbon/human/update_inv_l_hand(var/update_icons=1)
/mob/living/carbon/human/update_inv_l_hand(update_icons = TRUE)
if (QDELETED(src))
return
@@ -1245,7 +1245,7 @@ There are several things that need to be remembered:
if(update_icons)
update_icon(forceDirUpdate = TRUE)
/mob/living/carbon/human/update_inv_r_hand(var/update_icons=1)
/mob/living/carbon/human/update_inv_r_hand(update_icons = TRUE)
if (QDELETED(src))
return
+1 -2
View File
@@ -52,8 +52,7 @@
QDEL_NULL(ability_master)
if(click_handlers)
click_handlers.QdelClear()
QDEL_NULL(click_handlers)
QDEL_LIST(click_handlers)
return ..()
+1 -1
View File
@@ -432,7 +432,7 @@
return ..()
/obj/item/grab/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params)
var/mob/living/carbon/human/H = affecting
var/mob/living/carbon/human/H = over
if(wielded || affecting.buckled_to || !istype(H) || assailant != H || H.get_active_hand() != src)
return
if(!ishuman(affecting))
+2 -2
View File
@@ -16,10 +16,10 @@
/mob/proc/update_inv_back()
return
/mob/proc/update_inv_l_hand()
/mob/proc/update_inv_l_hand(update_icons = TRUE)
return
/mob/proc/update_inv_r_hand()
/mob/proc/update_inv_r_hand(update_icons = TRUE)
return
/mob/proc/update_inv_wear_mask()
+1
View File
@@ -46,6 +46,7 @@ var/global/photo_count = 0
pickup_sound = 'sound/items/pickup/paper.ogg'
/obj/item/photo/New()
. = ..()
id = photo_count++
/obj/item/photo/attack_self(mob/user as mob)