mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-31 20:11:56 +00:00
## About The Pull Request Signals were initially only usable with component listeners, which while no longer the case has lead to outdated documentation, names, and a similar location in code. This pr pulls the two apart. Partially because mso thinks we should, but also because they really aren't directly linked anymore, and having them in this midstate just confuses people. [Renames comp_lookup to listen_lookup, since that's what it does](102b79694f) [Moves signal procs over to their own file](33d07d01fd) [Renames the PREQDELETING and QDELETING comsigs to drop the parent bit since they can hook to more then just comps now](335ea4ad08) [Does something similar to the attackby comsigs (PARENT -> ATOM)](210e57051d) [And finally passes over the examine signals](65917658fb) ## Why It's Good For The Game Code makes more sense, things are better teased apart, s just good imo ## Changelog 🆑 refactor: Pulled apart the last vestiges of names/docs directly linking signals to components /🆑
39 lines
1.3 KiB
Plaintext
39 lines
1.3 KiB
Plaintext
///Forced directional movement, but with a twist
|
|
///Let's block pressure and client movements while doing it so we can't be interrupted
|
|
///Supports spinning on each move, for lube related reasons
|
|
/datum/component/force_move
|
|
|
|
/datum/component/force_move/Initialize(atom/target, spin)
|
|
if(!target || !ismob(parent))
|
|
return COMPONENT_INCOMPATIBLE
|
|
|
|
var/mob/mob_parent = parent
|
|
var/dist = get_dist(mob_parent, target)
|
|
var/datum/move_loop/loop = SSmove_manager.move_towards(mob_parent, target, delay = 1, timeout = dist)
|
|
RegisterSignal(mob_parent, COMSIG_MOB_CLIENT_PRE_LIVING_MOVE, PROC_REF(stop_move))
|
|
RegisterSignal(mob_parent, COMSIG_ATOM_PRE_PRESSURE_PUSH, PROC_REF(stop_pressure))
|
|
if(spin)
|
|
RegisterSignal(loop, COMSIG_MOVELOOP_POSTPROCESS, PROC_REF(slip_spin))
|
|
RegisterSignal(loop, COMSIG_QDELETING, PROC_REF(loop_ended))
|
|
|
|
/datum/component/force_move/proc/stop_move(datum/source)
|
|
SIGNAL_HANDLER
|
|
return COMSIG_MOB_CLIENT_BLOCK_PRE_LIVING_MOVE
|
|
|
|
/datum/component/force_move/proc/stop_pressure(datum/source)
|
|
SIGNAL_HANDLER
|
|
return COMSIG_ATOM_BLOCKS_PRESSURE
|
|
|
|
/datum/component/force_move/proc/slip_spin(datum/source)
|
|
SIGNAL_HANDLER
|
|
var/mob/mob_parent = parent
|
|
mob_parent.spin(1, 1)
|
|
|
|
/datum/component/force_move/proc/loop_ended(datum/source)
|
|
SIGNAL_HANDLER
|
|
if(QDELETED(src))
|
|
return
|
|
qdel(src)
|
|
|
|
|