From 8d1c48a78ec23c97ef851c19bb90e7629f347ea1 Mon Sep 17 00:00:00 2001 From: Iamgoofball Date: Wed, 25 Jul 2018 17:54:35 -0700 Subject: [PATCH] Anim bugfixes (#39311) * Adds juice to picking up stuff Stolen completely from https://github.com/OracleStation/OracleStation/pull/1072 * perfection * Pickup animation now tweens to the correct spot if you move * mutable appearance * Fixes the item pickup animation * eh whatever * Update atoms_movable.dm --- code/game/atoms_movable.dm | 17 +++++++---------- code/game/objects/items.dm | 4 ++-- code/modules/mob/inventory.dm | 8 ++++---- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 92739e76f7e7..dca52b04f759 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -781,6 +781,8 @@ /obj/item/proc/do_pickup_animation(atom/target) set waitfor = FALSE + if(!istype(loc, /turf)) + return var/image/I = image(icon = src, loc = loc, layer = layer + 0.1) I.plane = GAME_PLANE I.transform *= 0.75 @@ -790,14 +792,6 @@ var/to_x = 0 var/to_y = 0 - flick_overlay(I, GLOB.clients, 6) - var/matrix/M = new - M.Turn(pick(-30, 30)) - - animate(I, transform = M, time = 1) - sleep(1) - animate(I, transform = matrix(), time = 1) - sleep(1) if(!QDELETED(T) && !QDELETED(target)) direction = get_dir(T, target) if(direction & NORTH) @@ -810,6 +804,9 @@ to_x = -32 if(!direction) to_y = 16 - animate(I, alpha = 175, pixel_x = to_x, pixel_y = to_y, time = 3, easing = CUBIC_EASING) + flick_overlay(I, GLOB.clients, 6) + var/matrix/M = new + M.Turn(pick(-30, 30)) + animate(I, alpha = 175, pixel_x = to_x, pixel_y = to_y, time = 3, transform = M, easing = CUBIC_EASING) sleep(1) - animate(I, alpha = 0, time = 1) + animate(I, alpha = 0, transform = matrix(), time = 1) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 09c891d6e704..7604d4074b96 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -295,7 +295,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) pickup(user) add_fingerprint(user) - if(!user.put_in_active_hand(src)) + if(!user.put_in_active_hand(src, FALSE, FALSE)) user.dropItemToGround(src) /obj/item/proc/allow_attack_hand_drop(mob/user) @@ -317,7 +317,7 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) pickup(user) add_fingerprint(user) - if(!user.put_in_active_hand(src)) + if(!user.put_in_active_hand(src, FALSE, FALSE)) user.dropItemToGround(src) /obj/item/attack_alien(mob/user) diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 3498281a552e..a1ec3b734fb8 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -170,9 +170,9 @@ return FALSE return !held_items[hand_index] -/mob/proc/put_in_hand(obj/item/I, hand_index, forced = FALSE) +/mob/proc/put_in_hand(obj/item/I, hand_index, forced = FALSE, ignore_anim = TRUE) if(forced || can_put_in_hand(I, hand_index)) - if(isturf(I.loc)) + if(isturf(I.loc) && !ignore_anim) I.do_pickup_animation(src) if(hand_index == null) return FALSE @@ -210,8 +210,8 @@ //Puts the item into our active hand if possible. returns TRUE on success. -/mob/proc/put_in_active_hand(obj/item/I, forced = FALSE) - return put_in_hand(I, active_hand_index, forced) +/mob/proc/put_in_active_hand(obj/item/I, forced = FALSE, ignore_animation = TRUE) + return put_in_hand(I, active_hand_index, forced, ignore_animation) //Puts the item into our inactive hand if possible, returns TRUE on success