From e26abb70470c49bb229254c550b5fa1b3e2a3aba Mon Sep 17 00:00:00 2001 From: Mickyan <38563876+Mickyan@users.noreply.github.com> Date: Tue, 16 Jul 2019 09:51:17 +0200 Subject: [PATCH] Random pixel shift for dropped/thrown objects (#45155) * pixels * offset for any throw, critical bedsheet bugfix * nyeh * might as well (autodoc) * renamed proc * removed redundant src * moved call from dropped() to dropItemToGround() * handles storage dumping, customizable max offset * adjusted values * inline --- code/datums/components/storage/storage.dm | 2 ++ code/game/objects/items.dm | 4 ++++ code/game/objects/structures/bedsheet_bin.dm | 2 ++ code/modules/mob/inventory.dm | 2 ++ 4 files changed, 10 insertions(+) diff --git a/code/datums/components/storage/storage.dm b/code/datums/components/storage/storage.dm index f85a5d7ea71..93dbe589795 100644 --- a/code/datums/components/storage/storage.dm +++ b/code/datums/components/storage/storage.dm @@ -284,6 +284,8 @@ if(I.loc != real_location) continue remove_from_storage(I, target) + I.pixel_x = rand(-10,10) + I.pixel_y = rand(-10,10) if(trigger_on_found && I.on_found()) return FALSE if(TICK_CHECK) diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index b68b6537d19..1e3fef64698 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -537,6 +537,10 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE) if (callback) //call the original callback . = callback.Invoke() item_flags &= ~IN_INVENTORY + if(!pixel_y && !pixel_x) + pixel_x = rand(-8,8) + pixel_y = rand(-8,8) + /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/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index 6b930db5b57..3c99145dced 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -34,6 +34,8 @@ LINEN BINS if(layer == initial(layer)) layer = ABOVE_MOB_LAYER to_chat(user, "You cover yourself with [src].") + pixel_x = 0 + pixel_y = 0 else layer = initial(layer) to_chat(user, "You smooth [src] out beneath you.") diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index b6737aed2db..b44b35b05c0 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -292,6 +292,8 @@ //for when you want the item to end up on the ground //will force move the item to the ground and call the turf's Entered /mob/proc/dropItemToGround(obj/item/I, force = FALSE) + I.pixel_x = rand(-6,6) + I.pixel_y = rand(-6,6) return doUnEquip(I, force, drop_location(), FALSE) //for when the item will be immediately placed in a loc other than the ground