[MIRROR] Refactors how movetype flags are added and removed and the floating animation (#2096)

* Refactors how movetype flags are added and removed and the floating animation (#54963)

I wanted to refactor how movetype flags are added and removed into traits to prevent multiple sources of specific movement types from conflicting one other. I ended up also having to refactor the floating animation loop (the one that bobs up and down) code in the process.
Why It's Good For The Game

A way to avoid conflict from multiple sources of movement types.
This also stops melee attacks, jitteriness and update_transform() from temporarily disabling the floating movetype bitflag altogether until the next life tick.

Tested, but i'm pretty sure improvements could be made.
Changelog

cl
fix: jitteriness, melee attack animations and resting/standing up should no longer momentarily remove the floating movement type.
/cl

* Refactors how movetype flags are added and removed and the floating animation

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-12-09 23:43:42 +01:00
committed by GitHub
parent e976e1345e
commit 2ee5d422ae
31 changed files with 226 additions and 111 deletions
+5 -1
View File
@@ -30,15 +30,19 @@
return
if(!user.mind)
return
var/old_len = linked_minds.len
if(user.mind in linked_minds)
user.visible_message("<span class='notice'>[user] reaches out and pinches the flame of [src].</span>", "<span class='warning'>You sever the connection between yourself and [src].</span>")
linked_minds -= user.mind
if(old_len)
REMOVE_TRAIT(src, TRAIT_MOVE_FLOATING, LIFECANDLE_TRAIT)
else
user.visible_message("<span class='notice'>[user] touches [src]. It seems to respond to [user.p_their()] presence!</span>", "<span class='warning'>You create a connection between you and [src].</span>")
linked_minds |= user.mind
if(!old_len)
ADD_MOVE_TRAIT(src, TRAIT_MOVE_FLOATING, LIFECANDLE_TRAIT)
update_icon()
float(linked_minds.len)
if(linked_minds.len)
START_PROCESSING(SSobj, src)
set_light(lit_luminosity)