Fix buckling and probably a lot more mousedrop interactions (#93352)

This commit is contained in:
MrMelbert
2025-10-08 04:47:52 -05:00
committed by GitHub
parent cf7d5b1e7b
commit e83fd2603f
4 changed files with 43 additions and 2 deletions

View File

@@ -11,7 +11,8 @@
if(!usr || !over)
return
var/proximity_check = usr.client.check_drag_proximity(src, over, src_location, over_location, src_control, over_control, params)
var/client/usrclient = GET_CLIENT(usr)
var/proximity_check = usrclient.check_drag_proximity(src, over, src_location, over_location, src_control, over_control, params)
if(proximity_check)
return proximity_check
@@ -38,7 +39,7 @@
var/combined_atom_flags = interaction_flags_atom | over.interaction_flags_atom
if(!(combined_atom_flags & INTERACT_ATOM_MOUSEDROP_IGNORE_CHECKS))
//Check for adjacency
if(!(combined_atom_flags & INTERACT_ATOM_MOUSEDROP_IGNORE_ADJACENT) && (!user.IsReachableBy(src) || user.IsReachableBy(src) || !user.IsReachableBy(over)))
if(!(combined_atom_flags & INTERACT_ATOM_MOUSEDROP_IGNORE_ADJACENT) && (!IsReachableBy(user) || !over.IsReachableBy(user)))
return // should stop you from dragging through windows
if(!(combined_atom_flags & INTERACT_ATOM_MOUSEDROP_IGNORE_USABILITY))

View File

@@ -85,3 +85,6 @@
/datum/client_interface/proc/set_fullscreen(logging_in = FALSE)
return TRUE
/datum/client_interface/proc/check_drag_proximity(atom/dragging, atom/over, src_location, over_location, src_control, over_control, params)
return FALSE

View File

@@ -110,6 +110,7 @@
#include "blindness.dm"
#include "bloody_footprints.dm"
#include "breath.dm"
#include "buckle.dm"
#include "burning.dm"
#include "cable_powernets.dm"
#include "can_see.dm"

View File

@@ -0,0 +1,36 @@
/// Test you can buckle yourself to a chair
/datum/unit_test/buckling_self
/datum/unit_test/buckling_self/Run()
var/mob/living/carbon/human/consistent/dummy = EASY_ALLOCATE()
dummy.mock_client = new()
var/obj/structure/chair/chair = EASY_ALLOCATE()
var/old_usr = usr
usr = dummy // mouse drop still uses usr
dummy.MouseDrop(chair)
if(dummy.buckled != chair)
TEST_FAIL("The dummy failed to buckle themselves to a chair via mouse drop.")
usr = old_usr
/// Test you can buckle someone else to a chair
/datum/unit_test/buckling_others
/datum/unit_test/buckling_others/Run()
var/mob/living/carbon/human/consistent/dummy = EASY_ALLOCATE()
dummy.mock_client = new()
var/mob/living/carbon/human/consistent/victim = EASY_ALLOCATE()
var/obj/structure/chair/chair = EASY_ALLOCATE()
var/old_usr = usr
usr = dummy // mouse drop still uses usr
victim.MouseDrop(chair)
if(victim.buckled != chair)
TEST_FAIL("The dummy failed to buckle the victim to a chair via mouse drop.")
usr = old_usr