Putting down and disposals animation (#10873)

This commit is contained in:
Wowzewow (Wezzy)
2021-01-05 04:21:12 +08:00
committed by GitHub
parent 9d9a9d47f8
commit 5149a8fe60
5 changed files with 114 additions and 6 deletions

View File

@@ -332,7 +332,7 @@
/atom/movable/proc/get_bullet_impact_effect_type()
return BULLET_IMPACT_NONE
/obj/item/proc/do_pickup_animation(atom/target)
/atom/movable/proc/do_pickup_animation(atom/target)
set waitfor = FALSE
if(!isturf(loc))
return
@@ -357,15 +357,80 @@
if(!direction)
to_y = 16
var/list/viewing = list()
for (var/mob/M in viewers(target))
if (M.client)
for(var/mob/M in viewers(target))
if(M.client)
viewing |= M.client
flick_overlay(I, viewing, 6)
flick_overlay(I, viewing, 7)
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, transform = matrix(), time = 1)
/atom/movable/proc/do_putdown_animation(atom/target, mob/user)
if(QDELETED(src))
return
if(QDELETED(target))
return
if(QDELETED(user))
return
var/old_invisibility = invisibility // I don't know, it may be used. Basically turns the actual object invisible while the animation plays.
invisibility = 100
var/turf/old_turf = get_turf(user)
if(QDELETED(old_turf))
return
var/image/I = image(icon = src, loc = old_turf, layer = layer + 0.1)
I.transform = matrix() * 0
I.appearance_flags = (RESET_COLOR|RESET_TRANSFORM|NO_CLIENT_COLOR|RESET_ALPHA|PIXEL_SCALE)
I.pixel_x = 0
I.pixel_y = 0
if (istype(target,/mob))
I.dir = target.dir
var/list/viewing = list()
for (var/mob/M in viewers(target))
if (M.client)
viewing |= M.client
flick_overlay(I, viewing, 4)
var/to_x = (target.x - old_turf.x) * 32 + pixel_x
var/to_y = (target.y - old_turf.y) * 32 + pixel_y
var/old_x = pixel_x
var/old_y = pixel_y
pixel_x = 0
pixel_y = 0
animate(I, pixel_x = to_x, pixel_y = to_y, time = 3, transform = matrix(), easing = CUBIC_EASING)
sleep(3)
if(QDELETED(src))
return
invisibility = old_invisibility
pixel_x = old_x
pixel_y = old_y
/atom/movable/proc/simple_move_animation(atom/target)
set waitfor = FALSE
var/old_invisibility = invisibility // I don't know, it may be used.
invisibility = 100
var/turf/old_turf = get_turf(src)
var/image/I = image(icon = src, loc = src.loc, layer = layer + 0.1)
I.appearance_flags = (RESET_COLOR|RESET_TRANSFORM|NO_CLIENT_COLOR|RESET_ALPHA|PIXEL_SCALE)
var/list/viewing = list()
for(var/mob/M in viewers(target))
if(M.client)
viewing |= M.client
flick_overlay(I, viewing, 4)
var/to_x = (target.x - old_turf.x) * 32 + pixel_x
var/to_y = (target.y - old_turf.y) * 32 + pixel_y
animate(I, pixel_x = to_x, pixel_y = to_y, time = 3, easing = CUBIC_EASING)
sleep(3)
if(QDELETED(src))
return
invisibility = old_invisibility
/atom/movable/proc/get_floating_chat_x_offset()
return 0
return 0

View File

@@ -319,7 +319,7 @@
// Linker proc: mob/proc/prepare_for_slotmove, which is referenced in proc/handle_item_insertion and obj/item/attack_hand.
// This shit exists so that dropped() could almost exclusively be called when an item is dropped.
/obj/item/proc/on_slotmove(var/mob/user)
if (zoom)
if(zoom)
zoom(user)
// called just as an item is picked up (loc is not yet changed)

View File

@@ -194,6 +194,7 @@ var/list/slot_equipment_priority = list( \
remove_from_mob(W)
if(!(W && W.loc))
return 1
INVOKE_ASYNC(W, /atom/movable/proc/do_putdown_animation, target, src)
W.forceMove(target)
update_icon()
return 1

View File

@@ -267,6 +267,7 @@
target.client.perspective = EYE_PERSPECTIVE
target.client.eye = src
target.simple_move_animation(src)
target.forceMove(src)
for (var/mob/C in viewers(src))