Adds juice to picking up stuff (#39231)

* 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
This commit is contained in:
Iamgoofball
2018-07-21 11:23:15 +12:00
committed by oranges
parent d70839dc8f
commit 4fefb9aa27
2 changed files with 38 additions and 0 deletions
+36
View File
@@ -771,3 +771,39 @@
if(anchored || throwing)
return FALSE
return TRUE
/obj/item/proc/do_pickup_animation(atom/target)
set waitfor = FALSE
var/mutable_appearance/I = new(icon = src, loc = loc, layer = layer + 0.1)
I.plane = GAME_PLANE
I.transform *= 0.75
I.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
var/turf/T = get_turf(src)
var/direction
var/to_x = 0
var/to_y = 0
flick_overlay(I, GLOB.clients, 6)
var/static/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)
to_y = 32
else if(direction & SOUTH)
to_y = -32
if(direction & EAST)
to_x = 32
else if(direction & WEST)
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)
sleep(1)
animate(I, alpha = 0, time = 1)
+2
View File
@@ -172,6 +172,8 @@
/mob/proc/put_in_hand(obj/item/I, hand_index, forced = FALSE)
if(forced || can_put_in_hand(I, hand_index))
if(isturf(I.loc))
I.do_pickup_animation(src)
if(hand_index == null)
return FALSE
if(get_item_for_held_index(hand_index) != null)