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
🆑
fix: fixed Item scaling objects not properly scaling in inventory slots.
/🆑
This commit is contained in:
Ed640
2023-01-22 00:04:34 -06:00
committed by GitHub
parent 3a120d53d3
commit 577c39cfaf
+12 -12
View File
@@ -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