diff --git a/code/defines/procs/hud.dm b/code/defines/procs/hud.dm index 1e037d0d929..be88cc67ea3 100644 --- a/code/defines/procs/hud.dm +++ b/code/defines/procs/hud.dm @@ -1,10 +1,16 @@ +// Consider these images/atoms as part of the UI/HUD (apart of the appearance_flags) +/// Used for progress bars and chat messages +#define APPEARANCE_UI_IGNORE_ALPHA (RESET_COLOR|RESET_TRANSFORM|NO_CLIENT_COLOR|RESET_ALPHA|PIXEL_SCALE) +/// Used for HUD objects +#define APPEARANCE_UI (RESET_COLOR|RESET_TRANSFORM|NO_CLIENT_COLOR|PIXEL_SCALE) + /* Using the HUD procs is simple. Call these procs in the life.dm of the intended mob. Use the regular_hud_updates() proc before process_med_hud(mob) or process_sec_hud(mob) so the HUD updates properly! */ //HUD image type used to properly clear client.images precisely /image/hud_overlay - appearance_flags = RESET_COLOR|RESET_ALPHA|RESET_TRANSFORM + appearance_flags = APPEARANCE_UI //Medical HUD outputs. Called by the Life() proc of the mob using it, usually. proc/process_med_hud(var/mob/M, var/local_scanner, var/mob/Alt) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 6a6787384c4..8475351c895 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -370,63 +370,73 @@ return BULLET_IMPACT_NONE /atom/movable/proc/do_pickup_animation(atom/target) - set waitfor = FALSE if(!isturf(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/image/pickup_animation = image(icon, loc, icon_state, layer + 0.1, dir, pixel_x, pixel_y) + pickup_animation.transform.Scale(0.75) + pickup_animation.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA + var/turf/T = get_turf(src) - var/direction - var/to_x = 0 - var/to_y = 0 + var/direction = get_dir(T, target) + var/to_x = target.pixel_x + var/to_y = target.pixel_y - if(!QDELETED(T) && !QDELETED(target)) - direction = get_dir(T, target) if(direction & NORTH) - to_y = 32 + to_y += 32 else if(direction & SOUTH) - to_y = -32 + to_y -= 32 if(direction & EAST) - to_x = 32 + to_x += 32 else if(direction & WEST) - to_x = -32 + 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/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) + to_y += 10 + pickup_animation.pixel_x += 6 * (prob(50) ? 1 : -1) //6 to the right or left, helps break up the straight upward move -/atom/movable/proc/simple_move_animation(atom/target) - set waitfor = FALSE + flick_overlay_view(pickup_animation, target, 4) + var/matrix/animation_matrix = new(pickup_animation.transform) + animation_matrix.Turn(pick(-30, 30)) + animation_matrix.Scale(0.65) - 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) + animate(pickup_animation, alpha = 175, pixel_x = to_x, pixel_y = to_y, time = 3, transform = animation_matrix, easing = CUBIC_EASING) + animate(alpha = 0, transform = matrix().Scale(0.7), time = 1) - 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)) +/atom/movable/proc/do_drop_animation(atom/moving_from) + if(!isturf(loc)) return - invisibility = old_invisibility + var/turf/current_turf = get_turf(src) + var/direction = get_dir(moving_from, current_turf) + var/from_x = 0 + var/from_y = 0 + + if(direction & NORTH) + from_y -= 32 + else if(direction & SOUTH) + from_y += 32 + if(direction & EAST) + from_x -= 32 + else if(direction & WEST) + from_x += 32 + if(!direction) + from_y += 10 + from_x += 6 * (prob(50) ? 1 : -1) //6 to the right or left, helps break up the straight upward move + + //We're moving from these chords to our current ones + var/old_x = pixel_x + var/old_y = pixel_y + var/old_alpha = alpha + var/matrix/old_transform = transform + var/matrix/animation_matrix = new(old_transform) + animation_matrix.Turn(pick(-30, 30)) + animation_matrix.Scale(0.7) // Shrink to start, end up normal sized + + pixel_x = from_x + pixel_y = from_y + alpha = 0 + transform = animation_matrix + + // This is instant on byond's end, but to our clients this looks like a quick drop + animate(src, alpha = old_alpha, pixel_x = old_x, pixel_y = old_y, transform = old_transform, time = 3, easing = CUBIC_EASING) /atom/movable/proc/get_floating_chat_x_offset() return 0 diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 9f184a48978..3b71597e338 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -356,6 +356,7 @@ // 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) + do_drop_animation(S) return // called when this item is added into a storage item, which is passed on as S. The loc variable is already set to the storage item. diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 01562146be4..0f6426115cd 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -183,6 +183,7 @@ var/list/slot_equipment_priority = list( \ if(!(W && W.loc)) return TRUE W.forceMove(target) + W.do_drop_animation(src) update_icon() return TRUE return FALSE diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index dbdd1b963ea..8d2aec7e24e 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -288,7 +288,6 @@ target.client.perspective = EYE_PERSPECTIVE target.client.eye = src - target.simple_move_animation(src) target.forceMove(src) for (var/mob/C in viewers(src)) diff --git a/html/changelogs/wezzy_pickupputdown.yml b/html/changelogs/wezzy_pickupputdown.yml new file mode 100644 index 00000000000..056559b6df0 --- /dev/null +++ b/html/changelogs/wezzy_pickupputdown.yml @@ -0,0 +1,42 @@ +################################ +# 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: "Fixes pick up animation, and adds put down animations." + - rscdel: "Removes broken disposals animation." \ No newline at end of file