From 577c39cfaf72ab6a616b4b755d08950ed3f0b68f Mon Sep 17 00:00:00 2001 From: Ed640 Date: Sun, 22 Jan 2023 00:04:34 -0600 Subject: [PATCH] Changes signals In item_scaling to fix inventory scaling (#72696) ## About The Pull Request Fixes #72601 which finally allows item scalable objects to properly scale to large again when inside an inventory. Replaces and removes signals that don't seem to effect the item itself. ## Why It's Good For The Game Can finally see cards in ones binder easily, and allows future items with item_scaling to properly work. ## Changelog :cl: fix: fixed Item scaling objects not properly scaling in inventory slots. /:cl: --- code/datums/elements/item_scaling.dm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/code/datums/elements/item_scaling.dm b/code/datums/elements/item_scaling.dm index ce0af70a0b4..5fcca7c90ab 100644 --- a/code/datums/elements/item_scaling.dm +++ b/code/datums/elements/item_scaling.dm @@ -42,10 +42,8 @@ // Make sure overlays also inherit the scaling. ADD_KEEP_TOGETHER(target, ITEM_SCALING_TRAIT) - // Object scaled when dropped/thrown OR when exiting a storage object. - RegisterSignals(target, list(COMSIG_ITEM_DROPPED, COMSIG_ATOM_EXITED), PROC_REF(scale_overworld)) - // Object scaled when placed in an inventory slot OR when entering a storage component. - RegisterSignals(target, list(COMSIG_ITEM_EQUIPPED, COMSIG_ATOM_ENTERED), PROC_REF(scale_storage)) + // When moved sends a signal. + RegisterSignal(target, COMSIG_MOVABLE_MOVED, PROC_REF(scale_by_loc)) /** * Detach proc for the item_scaling element. @@ -55,12 +53,7 @@ * * target - Datum which the element is attached to. */ /datum/element/item_scaling/Detach(atom/target) - UnregisterSignal(target, list( - COMSIG_ITEM_PICKUP, - COMSIG_ITEM_DROPPED, - COMSIG_ATOM_ENTERED, - COMSIG_ATOM_EXITED, - )) + UnregisterSignal(target, COMSIG_MOVABLE_MOVED) REMOVE_KEEP_TOGETHER(target, ITEM_SCALING_TRAIT) @@ -81,8 +74,15 @@ var/matrix/M = matrix() scalable_object.transform = M.Scale(scaling) +//Grabs any move signals and checks its loc, properly scaling it when in storage,inhand, or in world. +/datum/element/item_scaling/proc/scale_by_loc(atom/scale) + if(isturf(scale.loc)) + scale_overworld(scale) + else + scale_storage(scale) + /** - * Signal handler for COMSIG_ITEM_DROPPED or COMSIG_ATOM_EXITED + * Shrinks when inworld * * Longer detailed paragraph about the proc * including any relevant detail @@ -95,7 +95,7 @@ scale(source, overworld_scaling) /** - * Signal handler for COMSIG_ITEM_EQUIPPED or COMSIG_ATOM_ENTERED. + * Enlarges when inhand or in storage. * * Longer detailed paragraph about the proc * including any relevant detail