mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
Refactors move procs to support multitle objects (#59658)
Enter(), Entered(), Exit() and Exited() all passed the old loc forward, but everything except a single a case cared about the direction of the movement more than about the specific source. Since moving multi-tile objects will have multiple sources of movement but a single direction, this change makes it easier to track their movement. Cleaned up a lot of code around and made proc inputs compatible. I'll add opacity support for multi-tile objects in a different PR after this is merged, as this has grown large enough and I don't want to compromise the reviewability. Tested this locally and as expected it didn't impair movement nor produced any runtimes.
This commit is contained in:
@@ -83,7 +83,7 @@
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_PRE_MOVE, .proc/moved)
|
||||
RegisterSignal(parent, COMSIG_ATOM_BUMPED, .proc/consume)
|
||||
var/static/list/loc_connections = list(
|
||||
COMSIG_ATOM_ENTERED = .proc/consume,
|
||||
COMSIG_ATOM_ENTERED = .proc/on_entered,
|
||||
)
|
||||
AddElement(/datum/element/connect_loc, parent, loc_connections)
|
||||
|
||||
@@ -129,7 +129,13 @@
|
||||
|
||||
return COMPONENT_CANCEL_BLOB_ACT
|
||||
|
||||
/// Triggered when something enters the component's parent.
|
||||
/datum/component/singularity/proc/on_entered(datum/source, atom/movable/arrived, direction)
|
||||
SIGNAL_HANDLER
|
||||
consume(source, arrived)
|
||||
|
||||
/datum/component/singularity/proc/consume(datum/source, atom/thing)
|
||||
SIGNAL_HANDLER
|
||||
if (thing == parent)
|
||||
stack_trace("Singularity tried to consume itself.")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user