From 236af6ae2bd06d765c37d964ea8991c889476ba7 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Fri, 11 Jan 2019 12:44:27 -0500 Subject: [PATCH 1/4] backpack jiggles - various interactions with backpacks will now make the backpack play an animation --- code/__HELPERS/unsorted.dm | 14 ++++++++++++++ code/datums/components/storage/storage.dm | 11 +++++++++++ 2 files changed, 25 insertions(+) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 620c592d93..87524c4ae6 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1239,6 +1239,20 @@ GLOBAL_REAL_VAR(list/stack_trace_storage) pixel_x = initialpixelx pixel_y = initialpixely +/atom/proc/do_jiggle(targetangle = 45) + var/matrix/OM = matrix(transform) + var/matrix/M = matrix(transform) + M.Turn(pick(-targetangle, targetangle)) + animate(src, transform = M, time = 10, easing = ELASTIC_EASING) + animate(src, transform = OM, time = 10, easing = ELASTIC_EASING) + +/atom/proc/do_squish(squishx = -1, squishy = 2) + var/matrix/OM = matrix(transform) + var/matrix/M = matrix(transform) + M.Scale(squishx, squishy) + animate(src, transform = M, time = 10, easing = ELASTIC_EASING) + animate(src, transform = OM, time = 10, easing = ELASTIC_EASING) + /proc/weightclass2text(var/w_class) switch(w_class) if(WEIGHT_CLASS_TINY) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index 55af26b6b2..b969f35972 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -169,10 +169,12 @@ if(locked) to_chat(M, "[parent] seems to be locked!") return FALSE + var/atom/A = parent var/obj/item/I = O if(collection_mode == COLLECT_ONE) if(can_be_inserted(I, null, M)) handle_item_insertion(I, null, M) + A.do_squish() return if(!isturf(I.loc)) return @@ -189,6 +191,7 @@ stoplag(1) qdel(progress) to_chat(M, "You put everything you could [insert_preposition] [parent].") + A.do_squish(-1, 3) /datum/component/storage/proc/handle_mass_item_insertion(list/things, datum/component/storage/src_object, mob/user, datum/progressbar/progress) var/atom/source_real_location = src_object.real_location() @@ -246,6 +249,7 @@ while (do_after(M, 10, TRUE, T, FALSE, CALLBACK(src, .proc/mass_remove_from_storage, T, things, progress))) stoplag(1) qdel(progress) + A.do_squish(2, 0) /datum/component/storage/proc/mass_remove_from_storage(atom/target, list/things, datum/progressbar/progress, trigger_on_found = TRUE) var/atom/real_location = real_location() @@ -455,6 +459,7 @@ return FALSE if(dump_destination.storage_contents_dump_act(src, M)) playsound(A, "rustle", 50, 1, -5) + A.do_squish(2, 0) return TRUE return FALSE @@ -473,6 +478,8 @@ return TRUE return FALSE handle_item_insertion(I, FALSE, M) + var/atom/A = parent + A.do_squish() /datum/component/storage/proc/return_inv(recursive) var/list/ret = list() @@ -514,6 +521,7 @@ if(A.loc != M) return playsound(A, "rustle", 50, 1, -5) + A.do_jiggle() if(istype(over_object, /obj/screen/inventory/hand)) var/obj/screen/inventory/hand/H = over_object M.putItemFromInventoryInHandIfPossible(A, H.held_index) @@ -539,6 +547,8 @@ if(!L.incapacitated() && I == L.get_active_held_item()) if(!SEND_SIGNAL(I, COMSIG_CONTAINS_STORAGE) && can_be_inserted(I, FALSE)) //If it has storage it should be trying to dump, not insert. handle_item_insertion(I, FALSE, L) + var/atom/A = parent + A.do_squish() //This proc return 1 if the item can be picked up and 0 if it can't. //Set the stop_messages to stop it from printing messages @@ -712,6 +722,7 @@ to_chat(user, "[parent] seems to be locked!") else show_to(user) + A.do_jiggle() /datum/component/storage/proc/signal_on_pickup(datum/source, mob/user) var/atom/A = parent From db0af68bf14da23b04f0121df6b29b6e554e87d1 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Sat, 12 Jan 2019 00:29:29 -0500 Subject: [PATCH 2/4] hold on what was i thinking let me adjust these values --- code/__HELPERS/unsorted.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 87524c4ae6..8c9873d8c8 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1246,7 +1246,7 @@ GLOBAL_REAL_VAR(list/stack_trace_storage) animate(src, transform = M, time = 10, easing = ELASTIC_EASING) animate(src, transform = OM, time = 10, easing = ELASTIC_EASING) -/atom/proc/do_squish(squishx = -1, squishy = 2) +/atom/proc/do_squish(squishx = 1.2, squishy = 0.6) var/matrix/OM = matrix(transform) var/matrix/M = matrix(transform) M.Scale(squishx, squishy) @@ -1544,4 +1544,4 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new) . = list() for(var/i in L) if(condition.Invoke(i)) - . |= i \ No newline at end of file + . |= i From 27653fe4ac82eff19e6382fb6be3801f18684e40 Mon Sep 17 00:00:00 2001 From: deathride58 Date: Sat, 12 Jan 2019 00:31:24 -0500 Subject: [PATCH 3/4] grmbl grmbl --- code/datums/components/storage/storage.dm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index b969f35972..e2861d0a2b 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -191,7 +191,7 @@ stoplag(1) qdel(progress) to_chat(M, "You put everything you could [insert_preposition] [parent].") - A.do_squish(-1, 3) + A.do_squish(1.4, 0.4) /datum/component/storage/proc/handle_mass_item_insertion(list/things, datum/component/storage/src_object, mob/user, datum/progressbar/progress) var/atom/source_real_location = src_object.real_location() @@ -249,7 +249,7 @@ while (do_after(M, 10, TRUE, T, FALSE, CALLBACK(src, .proc/mass_remove_from_storage, T, things, progress))) stoplag(1) qdel(progress) - A.do_squish(2, 0) + A.do_squish(0.8, 1.2) /datum/component/storage/proc/mass_remove_from_storage(atom/target, list/things, datum/progressbar/progress, trigger_on_found = TRUE) var/atom/real_location = real_location() @@ -459,7 +459,7 @@ return FALSE if(dump_destination.storage_contents_dump_act(src, M)) playsound(A, "rustle", 50, 1, -5) - A.do_squish(2, 0) + A.do_squish(0.8, 1.2) return TRUE return FALSE From ee19fa5ea374c8a3ee75158228e3f466a6fa9abf Mon Sep 17 00:00:00 2001 From: deathride58 Date: Sat, 12 Jan 2019 00:49:07 -0500 Subject: [PATCH 4/4] OH THERE WE GO --- code/__HELPERS/unsorted.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 8c9873d8c8..2f69b63ae9 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -1250,8 +1250,8 @@ GLOBAL_REAL_VAR(list/stack_trace_storage) var/matrix/OM = matrix(transform) var/matrix/M = matrix(transform) M.Scale(squishx, squishy) - animate(src, transform = M, time = 10, easing = ELASTIC_EASING) - animate(src, transform = OM, time = 10, easing = ELASTIC_EASING) + animate(src, transform = M, time = 10, easing = BOUNCE_EASING) + animate(src, transform = OM, time = 10, easing = BOUNCE_EASING) /proc/weightclass2text(var/w_class) switch(w_class)