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

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.

View File

@@ -899,7 +899,7 @@
var/final_pixel_y = get_standard_pixel_y_offset(lying)
animate(src, pixel_x = pixel_x + pixel_x_diff, pixel_y = pixel_y + pixel_y_diff , time = 2, loop = 6)
animate(pixel_x = final_pixel_x , pixel_y = final_pixel_y , time = 2)
setMovetype(movement_type & ~FLOATING) // If we were without gravity, the bouncing animation got stopped, so we make sure to restart it in next life().
floating_need_update = TRUE
/mob/living/proc/get_temperature(datum/gas_mixture/environment)
var/loc_temp = environment ? environment.temperature : T0C

View File

@@ -510,7 +510,8 @@
if(!used_item)
used_item = get_active_held_item()
..()
setMovetype(movement_type & ~FLOATING) // If we were without gravity, the bouncing animation got stopped, so we make sure we restart the bouncing after the next movement.
floating_need_update = TRUE
/mob/living/proc/getBruteLoss_nonProsthetic()
return getBruteLoss()

View File

@@ -22,4 +22,4 @@
if(changed)
animate(src, transform = ntransform, time = 2, pixel_y = final_pixel_y, easing = EASE_IN|EASE_OUT)
setMovetype(movement_type & ~FLOATING) // If we were without gravity, the bouncing animation got stopped, so we make sure we restart it in next life().
floating_need_update = TRUE

View File

@@ -24,7 +24,8 @@
variable = TRUE
/datum/movespeed_modifier/damage_slowdown_flying
movetypes = FLOATING
movetypes = FLYING
blacklisted_movetypes = FLOATING
variable = TRUE
/datum/movespeed_modifier/equipment_speedmod