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-10 00:04:48 +01:00
committed by GitHub
parent db6d55b759
commit 457a091d9a
31 changed files with 661 additions and 310 deletions
+18 -30
View File
@@ -4,7 +4,7 @@
* The component datum
*
* A component should be a single standalone unit
* of functionality, that works by receiving signals from it's parent
* of functionality, that works by receiving signals from its parent
* object to provide some single functionality (i.e a slippery component)
* that makes the object it's attached to cause people to slip over.
* Useful when you want shared behaviour independent of type inheritance
@@ -17,15 +17,6 @@
*/
var/dupe_mode = COMPONENT_DUPE_HIGHLANDER
/**
* The type to check for duplication
*
* `null` means exact match on `type` (default)
*
* Any other type means that and all subtypes
*/
var/dupe_type
/// The datum this components belongs to
var/datum/parent
@@ -57,7 +48,7 @@
qdel(src, TRUE, TRUE)
return
_JoinParent(parent)
_JoinParent()
/**
* Called during component creation with the same arguments as in new excluding parent.
@@ -217,7 +208,7 @@
*
* Use this to do any special cleanup you might need to do before being deregged from an object
*/
/datum/component/proc/PreTransfer()
/datum/component/proc/PreTransfer(datum/new_parent)
return
/**
@@ -227,7 +218,7 @@
*
* Do not call `qdel(src)` from this function, `return COMPONENT_INCOMPATIBLE` instead
*/
/datum/component/proc/PostTransfer()
/datum/component/proc/PostTransfer(datum/new_parent)
return COMPONENT_INCOMPATIBLE //Do not support transfer by default as you must properly support it
/**
@@ -328,7 +319,6 @@
CRASH("[component_type] attempted instantiation!")
var/dupe_mode = initial(component_type.dupe_mode)
var/dupe_type = initial(component_type.dupe_type)
var/uses_sources = (dupe_mode == COMPONENT_DUPE_SOURCES)
if(uses_sources && !source)
CRASH("Attempted to add a sourced component of type '[component_type]' to '[type]' without a source!")
@@ -339,10 +329,7 @@
raw_args[1] = src
if(dupe_mode != COMPONENT_DUPE_ALLOWED && dupe_mode != COMPONENT_DUPE_SELECTIVE && dupe_mode != COMPONENT_DUPE_SOURCES)
if(!dupe_type)
old_component = GetExactComponent(component_type)
else
old_component = GetComponent(dupe_type)
old_component = GetComponent(component_type)
if(old_component)
switch(dupe_mode)
@@ -434,11 +421,11 @@
* Removes the component from parent, ends up with a null parent
* Used as a helper proc by the component transfer proc, does not clean up the component like Destroy does
*/
/datum/component/proc/ClearFromParent()
/datum/component/proc/ClearFromParent(datum/new_parent)
if(!parent)
return
var/datum/old_parent = parent
PreTransfer()
PreTransfer(new_parent)
_RemoveFromParent()
parent = null
SEND_SIGNAL(old_parent, COMSIG_COMPONENT_REMOVING, src)
@@ -455,16 +442,17 @@
if(!target || target.parent == src)
return
if(target.parent)
target.ClearFromParent()
target.parent = src
var/result = target.PostTransfer()
target.ClearFromParent(src)
var/result = target.PostTransfer(src)
switch(result)
if(COMPONENT_INCOMPATIBLE)
var/c_type = target.type
qdel(target)
CRASH("Incompatible [c_type] transfer attempt to a [type]!")
if(target == AddComponent(target))
AddComponent(target)
if(!QDELETED(target))
target.parent = src
target._JoinParent()
/**
@@ -482,13 +470,13 @@
for(var/component_key in dc)
var/component_or_list = dc[component_key]
if(islist(component_or_list))
for(var/datum/component/I in component_or_list)
if(I.can_transfer)
target.TakeComponent(I)
for(var/datum/component/component in component_or_list)
if(component.can_transfer)
target.TakeComponent(component)
else
var/datum/component/C = component_or_list
if(C.can_transfer)
target.TakeComponent(C)
var/datum/component/component = component_or_list
if(!QDELETED(component) && component.can_transfer)
target.TakeComponent(component)
/**
* Return the object that is the host of any UI's that this component has
+1 -1
View File
@@ -17,7 +17,7 @@
QDEL_LIST(actions)
. = ..()
/datum/component/eye/proc/look(var/mob/new_looker, var/list/eye_args)
/datum/component/eye/proc/look(mob/new_looker, list/eye_args)
if(new_looker.eyeobj || current_looker)
return FALSE
LAZYINSERT(eye_args, get_turf(current_looker), 1) //Make sure that a loc is provided to the eye
+8 -6
View File
@@ -1,12 +1,14 @@
//For mobs connecting to the station's cameranet without needing AI procs
/**
* Freelook eye component
*
* For mobs connecting to the station's cameranet without needing AI procs
*
* For mobs connecting to other visualnets, call set_visualnet() with the visualnet to use
*/
/datum/component/eye/freelook
eye_type = /mob/abstract/eye/freelook
//For mobs connecting to other visualnets. Pass visualnet as eye_args in look()
/datum/component/eye/freelook
eye_type = /mob/abstract/eye
/datum/component/eye/freelook/proc/set_visualnet(var/datum/visualnet/net)
/datum/component/eye/freelook/proc/set_visualnet(datum/visualnet/net = GLOB.cameranet)
if(component_eye)
var/mob/abstract/eye/eye = component_eye
if(istype(eye))