Skip to content

Commit

Permalink
Fixes wallmounted lights falling on drag (#142)
Browse files Browse the repository at this point in the history
* Fixes wallmounted lights falling on drag (#80609)

## About The Pull Request

Being able to move around lights when using the light debugger is
important
Can't just be qdeling em whenever you try

Closes tgstation/tgstation#78662
## Changelog
:cl:
fix: Dear mappers, the light debugger tool no longer deletes dragged
wall lights
/:cl:

* Fixes wallmounted lights falling on drag

---------

Co-authored-by: LemonInTheDark <[email protected]>
Co-authored-by: NovaBot <[email protected]>
  • Loading branch information
3 people authored and Iajret committed Dec 28, 2023
1 parent 0b44352 commit d897b9a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion code/datums/components/wall_mounted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/datum/component/wall_mounted/RegisterWithParent()
RegisterSignal(hanging_wall_turf, COMSIG_ATOM_EXAMINE, PROC_REF(on_examine))
RegisterSignal(hanging_wall_turf, COMSIG_TURF_CHANGE, PROC_REF(on_turf_changing))
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(drop_wallmount))
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(on_move))
RegisterSignal(parent, COMSIG_QDELETING, PROC_REF(on_linked_destroyed))

/datum/component/wall_mounted/UnregisterFromParent()
Expand Down Expand Up @@ -49,6 +49,18 @@
if (ispath(path, /turf/open))
drop_wallmount()


/**
* If we get dragged from our wall (by a singulo for instance) we should deconstruct
*/
/datum/component/wall_mounted/proc/on_move(datum/source, atom/old_loc, dir, forced, list/old_locs)
SIGNAL_HANDLER
// If we're having our lighting messed with we're likely to get dragged about
// That shouldn't lead to a decon
if(HAS_TRAIT(parent, TRAIT_LIGHTING_DEBUGGED))
return
drop_wallmount()

/**
* Handles the dropping of the linked object. This is done via deconstruction, as that should be the most sane way to handle it for most objects.
* Except for intercoms, which are handled by creating a new wallframe intercom, as they're apparently items.
Expand All @@ -66,6 +78,7 @@

if(!QDELING(src))
qdel(src) //Well, we fell off the wall, so we're done here.

/**
* Checks object direction and then verifies if there's a wall in that direction. Finally, applies a wall_mounted component to the object.
*
Expand Down

0 comments on commit d897b9a

Please sign in to comment.