From 54464df53397c2c1e01c1cdeb05e69c93cc480cf Mon Sep 17 00:00:00 2001 From: UselessTheremin <69374474+UselessTheremin@users.noreply.github.com> Date: Sat, 11 Dec 2021 11:12:53 -0500 Subject: [PATCH] Fancier Throws and Bullet Ejection (#12789) * fixes that shit * Revert "fixes that shit" This reverts commit 8e6b495fa47b13cb90fb4b4ffc02e73009d929cf. * Update items.dm * Update glass.dm * Update drinks.dm * Update drinks.dm * Update bottle.dm * Update inventory.dm * Update _ammunition.dm * Update reagent_containers.dm * Update bottle.dm --- code/game/objects/items.dm | 5 +++++ code/game/objects/items/stacks/sheets/glass.dm | 3 +++ code/modules/food_and_drinks/drinks/drinks.dm | 12 ++++++++++++ code/modules/food_and_drinks/drinks/drinks/bottle.dm | 6 ++++++ code/modules/mob/inventory.dm | 1 + code/modules/projectiles/ammunition/_ammunition.dm | 5 +++++ code/modules/reagents/reagent_containers.dm | 1 + 7 files changed, 33 insertions(+) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index deff8e03426c..3f4b404b5fb3 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -565,6 +565,11 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) if (callback) //call the original callback . = callback.Invoke() item_flags &= ~IN_INVENTORY + var/matrix/M = matrix(transform) + M.Turn(rand(-170, 170)) + transform = M + pixel_x = rand(-12, 12) + pixel_y = rand(-12, 12) /obj/item/proc/remove_item_from_storage(atom/newLoc) //please use this if you're going to snowflake an item out of a obj/item/storage if(!newLoc) diff --git a/code/game/objects/items/stacks/sheets/glass.dm b/code/game/objects/items/stacks/sheets/glass.dm index 4da2e8a79886..5f842223746a 100644 --- a/code/game/objects/items/stacks/sheets/glass.dm +++ b/code/game/objects/items/stacks/sheets/glass.dm @@ -293,6 +293,9 @@ GLOBAL_LIST_INIT(plastitaniumglass_recipes, list( pixel_y = rand(-5, 5) if (icon_prefix) icon_state = "[icon_prefix][icon_state]" + var/matrix/M = matrix(transform) + M.Turn(rand(-170, 170)) + transform = M /obj/item/shard/afterattack(atom/A as mob|obj, mob/user, proximity) . = ..() diff --git a/code/modules/food_and_drinks/drinks/drinks.dm b/code/modules/food_and_drinks/drinks/drinks.dm index 80e953204290..ef748ac21af5 100644 --- a/code/modules/food_and_drinks/drinks/drinks.dm +++ b/code/modules/food_and_drinks/drinks/drinks.dm @@ -121,6 +121,12 @@ I.SwapColor(rgb(255, 0, 220, 255), rgb(0, 0, 0, 0)) B.icon = I B.name = "broken [name]" + if(ranged) + var/matrix/M = matrix(B.transform) + M.Turn(rand(-170, 170)) + B.transform = M + B.pixel_x = rand(-12, 12) + B.pixel_y = rand(-12, 12) if(prob(33)) var/obj/item/shard/S = new(drop_location()) target.Bumped(S) @@ -306,6 +312,12 @@ B.force = 0 B.throwforce = 0 B.desc = "A carton with the bottom half burst open. Might give you a papercut." + if(ranged) + var/matrix/M = matrix(B.transform) + M.Turn(rand(-170, 170)) + B.transform = M + B.pixel_x = rand(-12, 12) + B.pixel_y = rand(-12, 12) transfer_fingerprints_to(B) qdel(src) target.Bumped(B) diff --git a/code/modules/food_and_drinks/drinks/drinks/bottle.dm b/code/modules/food_and_drinks/drinks/drinks/bottle.dm index aa69c3031997..140417711ef5 100644 --- a/code/modules/food_and_drinks/drinks/drinks/bottle.dm +++ b/code/modules/food_and_drinks/drinks/drinks/bottle.dm @@ -58,6 +58,12 @@ var/obj/item/broken_bottle/B = new (loc) if(!ranged && thrower) thrower.put_in_hands(B) + else + var/matrix/M = matrix(B.transform) + M.Turn(rand(-170, 170)) + B.transform = M + B.pixel_x = rand(-12, 12) + B.pixel_y = rand(-12, 12) B.icon_state = icon_state var/icon/I = new('icons/obj/drinks.dmi', src.icon_state) diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 6a15bfdf365e..928e91847382 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -188,6 +188,7 @@ update_inv_hands() I.pixel_x = initial(I.pixel_x) I.pixel_y = initial(I.pixel_y) + I.transform = initial(I.transform) return hand_index || TRUE return FALSE diff --git a/code/modules/projectiles/ammunition/_ammunition.dm b/code/modules/projectiles/ammunition/_ammunition.dm index 0ce8f5b8cafe..b7839a898651 100644 --- a/code/modules/projectiles/ammunition/_ammunition.dm +++ b/code/modules/projectiles/ammunition/_ammunition.dm @@ -73,6 +73,11 @@ /obj/item/ammo_casing/proc/bounce_away(still_warm = FALSE, bounce_delay = 3) update_icon() SpinAnimation(10, 1) + var/matrix/M = matrix(transform) + M.Turn(rand(-170,170)) + transform = M + pixel_x = rand(-12, 12) + pixel_y = rand(-12, 12) var/turf/T = get_turf(src) if(still_warm && T && T.bullet_sizzle) addtimer(CALLBACK(GLOBAL_PROC, .proc/playsound, src, 'sound/items/welder.ogg', 20, 1), bounce_delay) //If the turf is made of water and the shell casing is still hot, make a sizzling sound when it's ejected. diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index e55280167d66..b996701eaf17 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -101,6 +101,7 @@ else if(bartender_check(target) && thrown) visible_message(span_notice("[src] lands onto the [target.name] without spilling a single drop.")) + transform = initial(transform) return else