mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-15 01:54:52 +01:00
558c466b81
* Splits placeontop proc (#79702) ## About The Pull Request I find the proc hard to read honestly. There's no reason we can't split this into two functions - the secondary functionality is used only once, in reader.dmm. ## Why It's Good For The Game Code improvement Glorious snake case ## Changelog N/A nothing player facing --------- Co-authored-by: san7890 <34697715+san7890@ users.noreply.github.com> * Splits placeontop proc * Update brass_spreader.dm --------- Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com> Co-authored-by: san7890 <34697715+san7890@ users.noreply.github.com> Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
33 lines
931 B
Plaintext
33 lines
931 B
Plaintext
/**
|
|
* movement_turf_changer element; which makes the movement of a movable atom change the turf it moved to
|
|
*
|
|
* Used for moonicorns!
|
|
*/
|
|
/datum/element/movement_turf_changer
|
|
element_flags = ELEMENT_BESPOKE
|
|
argument_hash_start_idx = 2
|
|
///Path of the turf added on top
|
|
var/turf_type
|
|
|
|
/datum/element/movement_turf_changer/Attach(datum/target, turf_type)
|
|
. = ..()
|
|
|
|
if(!ismovable(target))
|
|
return ELEMENT_INCOMPATIBLE
|
|
|
|
src.turf_type = turf_type
|
|
RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(on_moved))
|
|
|
|
/datum/element/movement_turf_changer/Detach(datum/target)
|
|
UnregisterSignal(target, COMSIG_MOVABLE_MOVED)
|
|
. = ..()
|
|
|
|
/datum/element/movement_turf_changer/proc/on_moved(atom/movable/target, atom/origin, direction, forced)
|
|
SIGNAL_HANDLER
|
|
|
|
var/turf/destination = target.loc
|
|
if(!isturf(destination) || istype(destination, turf_type) || isgroundlessturf(destination))
|
|
return
|
|
|
|
destination.place_on_top(turf_type)
|