Putting down and disposals animation (#10873)

This commit is contained in:
Wowzewow (Wezzy)
2021-01-04 21:21:12 +01:00
committed by GitHub
parent 9d9a9d47f8
commit 5149a8fe60
5 changed files with 114 additions and 6 deletions
+70 -5
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
+1 -1
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)
+1
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
+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))
@@ -0,0 +1,41 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
# balance
# admin
# backend
# security
# refactor
#################################
# Your name.
author: Wowzewow (Wezzy)
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Adds animations to putting stuff down as well as putting things in disposals."