|
12 | 12 | element_flags = ELEMENT_DETACH
|
13 | 13 |
|
14 | 14 | var/list/attached_atoms = list()
|
15 |
| - var/list/paused_floating_anim_atoms = list() |
16 | 15 |
|
17 | 16 | /datum/element/movetype_handler/Attach(datum/target)
|
18 | 17 | . = ..()
|
|
26 | 25 | RegisterSignal(movable_target, GLOB.movement_type_removetrait_signals, PROC_REF(on_movement_type_trait_loss))
|
27 | 26 | RegisterSignal(movable_target, SIGNAL_ADDTRAIT(TRAIT_NO_FLOATING_ANIM), PROC_REF(on_no_floating_anim_trait_gain))
|
28 | 27 | RegisterSignal(movable_target, SIGNAL_REMOVETRAIT(TRAIT_NO_FLOATING_ANIM), PROC_REF(on_no_floating_anim_trait_loss))
|
29 |
| - RegisterSignal(movable_target, COMSIG_PAUSE_FLOATING_ANIM, PROC_REF(pause_floating_anim)) |
30 | 28 | attached_atoms[movable_target] = TRUE
|
31 | 29 |
|
32 | 30 | if(movable_target.movement_type & (FLOATING|FLYING) && !HAS_TRAIT(movable_target, TRAIT_NO_FLOATING_ANIM))
|
|
36 | 34 | var/list/signals_to_remove = list(
|
37 | 35 | SIGNAL_ADDTRAIT(TRAIT_NO_FLOATING_ANIM),
|
38 | 36 | SIGNAL_REMOVETRAIT(TRAIT_NO_FLOATING_ANIM),
|
39 |
| - COMSIG_PAUSE_FLOATING_ANIM |
40 | 37 | )
|
41 | 38 | signals_to_remove += GLOB.movement_type_addtrait_signals
|
42 | 39 | signals_to_remove += GLOB.movement_type_removetrait_signals
|
43 | 40 | UnregisterSignal(source, signals_to_remove)
|
44 | 41 |
|
45 | 42 | attached_atoms -= source
|
46 |
| - paused_floating_anim_atoms -= source |
47 | 43 | stop_floating(source)
|
48 | 44 | return ..()
|
49 | 45 |
|
|
55 | 51 | return
|
56 | 52 | var/old_state = source.movement_type
|
57 | 53 | source.movement_type |= flag
|
58 |
| - if(!(old_state & (FLOATING|FLYING)) && (source.movement_type & (FLOATING|FLYING)) && !paused_floating_anim_atoms[source] && !HAS_TRAIT(source, TRAIT_NO_FLOATING_ANIM)) |
| 54 | + if(!(old_state & (FLOATING|FLYING)) && (source.movement_type & (FLOATING|FLYING)) && !HAS_TRAIT(source, TRAIT_NO_FLOATING_ANIM)) |
59 | 55 | DO_FLOATING_ANIM(source)
|
60 | 56 | SEND_SIGNAL(source, COMSIG_MOVETYPE_FLAG_ENABLED, flag, old_state)
|
61 | 57 |
|
|
80 | 76 | /// Called when the TRAIT_NO_FLOATING_ANIM trait is removed from the mob. Restarts the bobbing animation.
|
81 | 77 | /datum/element/movetype_handler/proc/on_no_floating_anim_trait_loss(atom/movable/source, trait)
|
82 | 78 | SIGNAL_HANDLER
|
83 |
| - if(source.movement_type & (FLOATING|FLYING) && !paused_floating_anim_atoms[source]) |
| 79 | + if(source.movement_type & (FLOATING|FLYING)) |
84 | 80 | DO_FLOATING_ANIM(source)
|
85 | 81 |
|
86 |
| -///Pauses the floating animation for the duration of the timer... plus [tickrate - (world.time + timer) % tickrate] to be precise. |
87 |
| -/datum/element/movetype_handler/proc/pause_floating_anim(atom/movable/source, timer) |
88 |
| - SIGNAL_HANDLER |
89 |
| - if(paused_floating_anim_atoms[source] < world.time + timer) |
90 |
| - stop_floating(source) |
91 |
| - if(!length(paused_floating_anim_atoms)) |
92 |
| - START_PROCESSING(SSdcs, src) //1 second tickrate. |
93 |
| - paused_floating_anim_atoms[source] = world.time + timer |
94 |
| - |
95 |
| -/datum/element/movetype_handler/process() |
96 |
| - for(var/_paused in paused_floating_anim_atoms) |
97 |
| - var/atom/movable/paused = _paused |
98 |
| - if(paused_floating_anim_atoms[paused] < world.time) |
99 |
| - if(paused.movement_type & (FLOATING|FLYING) && !HAS_TRAIT(paused, TRAIT_NO_FLOATING_ANIM)) |
100 |
| - DO_FLOATING_ANIM(paused) |
101 |
| - paused_floating_anim_atoms -= paused |
102 |
| - if(!length(paused_floating_anim_atoms)) |
103 |
| - STOP_PROCESSING(SSdcs, src) |
104 |
| - |
105 | 82 | /// Stops the above. Also not a comsig proc.
|
106 | 83 | /datum/element/movetype_handler/proc/stop_floating(atom/movable/target)
|
107 | 84 | var/final_pixel_y = target.base_pixel_y
|
|
0 commit comments