Pick up fixes (#10922)

Pick up animation now does the little shake at the start correctly.

also cleans up some stuff here and there
This commit is contained in:
Wowzewow (Wezzy)
2021-01-10 12:55:09 +02:00
committed by GitHub
parent 117fb99942
commit e0854fd1e3
7 changed files with 83 additions and 39 deletions
+1
View File
@@ -21,6 +21,7 @@
#include "code\__defines\_macros.dm"
#include "code\__defines\admin.dm"
#include "code\__defines\antagonist.dm"
#include "code\__defines\appearance.dm"
#include "code\__defines\atmos.dm"
#include "code\__defines\battle_monsters.dm"
#include "code\__defines\callback.dm"
+1
View File
@@ -23,6 +23,7 @@
#define FONT_GIANT(X) "<font size='5'>[X]</font>"
#define isAI(A) istype(A, /mob/living/silicon/ai)
#define isDrone(A) istype(A, /mob/living/silicon/robot/drone)
#define isalien(A) istype(A, /mob/living/carbon/alien)
+3
View File
@@ -0,0 +1,3 @@
// Consider these images/atoms as part of the UI/HUD
#define APPEARANCE_UI_IGNORE_ALPHA RESET_COLOR|RESET_TRANSFORM|NO_CLIENT_COLOR|RESET_ALPHA
#define APPEARANCE_UI RESET_COLOR|RESET_TRANSFORM|NO_CLIENT_COLOR
+31 -35
View File
@@ -332,40 +332,40 @@
/atom/movable/proc/get_bullet_impact_effect_type()
return BULLET_IMPACT_NONE
/atom/movable/proc/do_pickup_animation(atom/target)
/atom/movable/proc/do_pickup_animation(atom/target, atom/old_loc)
set waitfor = FALSE
if(!isturf(loc))
if(QDELETED(src))
return
if(QDELETED(target))
return
if(QDELETED(old_loc))
return
var/image/I = image(icon, loc, icon_state, layer + 0.1, dir, pixel_x, pixel_y)
I.transform *= 0.75
I.appearance_flags = (RESET_COLOR|RESET_TRANSFORM|NO_CLIENT_COLOR|RESET_ALPHA|PIXEL_SCALE)
var/turf/T = get_turf(src)
var/direction
var/to_x = 0
var/to_y = 0
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
var/list/viewing = list()
for(var/mob/M in viewers(target))
if(M.client)
viewing |= M.client
flick_overlay(I, viewing, 7)
var/turf/old_turf = get_turf(old_loc)
var/image/I = image(icon = src, loc = old_turf, layer = ABOVE_MOB_LAYER)
I.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
if(ismob(target))
I.dir = target.dir
if(istype(old_loc, /obj/item/storage))
I.pixel_x += old_loc.pixel_x
I.pixel_y += old_loc.pixel_y
flick_overlay(I, clients, 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)
M.Turn(pick(30, -30))
animate(I, transform = M, time = 1)
sleep(1)
animate(I, alpha = 0, transform = matrix(), time = 1)
animate(I, transform = matrix(), time = 1)
sleep(1)
var/to_x = (target.x - old_turf.x) * 32
var/to_y = (target.y - old_turf.y) * 32
animate(I, pixel_x = to_x, pixel_y = to_y, time = 3, transform = matrix() * 0, easing = CUBIC_EASING)
sleep(3)
/atom/movable/proc/do_putdown_animation(atom/target, mob/user)
spawn()
@@ -416,13 +416,9 @@
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)
I.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
var/list/viewing = list()
for(var/mob/M in viewers(target))
if(M.client)
viewing |= M.client
flick_overlay(I, viewing, 4)
flick_overlay(I, clients, 4)
var/to_x = (target.x - old_turf.x) * 32 + pixel_x
var/to_y = (target.y - old_turf.y) * 32 + pixel_y
+5 -3
View File
@@ -324,9 +324,11 @@
// called just as an item is picked up (loc is not yet changed)
/obj/item/proc/pickup(mob/user)
pixel_x = 0
pixel_y = 0
do_pickup_animation(user)
throwing = 0
var/atom/old_loc = loc
if(user.put_in_active_hand(src) && old_loc)
if((user != old_loc) && (user != old_loc.get_holding_mob()))
do_pickup_animation(user, old_loc)
// called when this item is removed from a storage item, which is passed on as S. The loc variable is already set to the new destination before this is called.
/obj/item/proc/on_exit_storage(obj/item/storage/S as obj)
@@ -58,7 +58,7 @@
if(feedback)
to_chat(user, SPAN_NOTICE("You collect \the [I]."))
if(isturf(I.loc) && I.Adjacent(user))
I.do_pickup_animation(user)
I.do_pickup_animation(user, loc)
I.forceMove(src)
wrapped = I
wrapped.pixel_x = 0
+41
View File
@@ -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:
- bugfix: "Fixes pickup animations not playing the shake effect."