Fixing some issues with floating movetype & co. (#12262)

This commit is contained in:
Ghom
2020-05-18 13:44:19 +02:00
committed by GitHub
parent fd5c635840
commit 95249a4d79
5 changed files with 13 additions and 8 deletions
+7 -4
View File
@@ -37,6 +37,8 @@
var/throwforce = 0
var/datum/component/orbiter/orbiting
var/can_be_z_moved = TRUE
///If we were without gravity and another animation happened, the bouncing will stop, and we need to restart it in next life().
var/floating_need_update = FALSE
var/zfalling = FALSE
@@ -492,15 +494,16 @@
/atom/movable/proc/float(on)
if(throwing)
return
if(on && !(movement_type & FLOATING))
if(on && (!(movement_type & FLOATING) || floating_need_update))
animate(src, pixel_y = pixel_y + 2, time = 10, loop = -1)
sleep(10)
animate(src, pixel_y = pixel_y - 2, time = 10, loop = -1)
setMovetype(movement_type | FLOATING)
else if (!on && (movement_type & FLOATING))
if(!(movement_type & FLOATING))
setMovetype(movement_type | FLOATING)
else if (!on && movement_type & FLOATING)
animate(src, pixel_y = initial(pixel_y), time = 10)
setMovetype(movement_type & ~FLOATING)
floating_need_update = FALSE
/* Language procs
* Unless you are doing something very specific, these are the ones you want to use.