From 95249a4d79b028b60b2c2be9ad3bc472d6ce0f39 Mon Sep 17 00:00:00 2001 From: Ghom <42542238+Ghommie@users.noreply.github.com> Date: Mon, 18 May 2020 13:44:19 +0200 Subject: [PATCH] Fixing some issues with floating movetype & co. (#12262) --- code/game/atoms_movable.dm | 11 +++++++---- code/modules/mob/living/living.dm | 2 +- code/modules/mob/living/living_defense.dm | 3 ++- code/modules/mob/living/update_icons.dm | 2 +- code/modules/movespeed/modifiers/mobs.dm | 3 ++- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 206864d44c..9736f473e8 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -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. diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 9793f598fb..ffc6caded8 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -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 diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index 45b8a35c86..623afaabda 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -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() diff --git a/code/modules/mob/living/update_icons.dm b/code/modules/mob/living/update_icons.dm index b10d78aeb3..f8d5d7e0ba 100644 --- a/code/modules/mob/living/update_icons.dm +++ b/code/modules/mob/living/update_icons.dm @@ -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 diff --git a/code/modules/movespeed/modifiers/mobs.dm b/code/modules/movespeed/modifiers/mobs.dm index aa60966591..d20fc4c6c0 100644 --- a/code/modules/movespeed/modifiers/mobs.dm +++ b/code/modules/movespeed/modifiers/mobs.dm @@ -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