From 88e9b74e0744d0e3997a7c38f47e2b4f577366f2 Mon Sep 17 00:00:00 2001 From: Timberpoes Date: Tue, 29 Sep 2020 10:14:25 +0100 Subject: [PATCH] Fixes Dwarfism matrix transformation issue. (#54027) Give person standing up Dwarfism. Their standing Y axis is scaled down. Have them lie down. Transformation matrix applied to rotate them. Cure Dwarfism. Their lying Y axis is scaled up after they've been rotated. This is the equivalent to scaling up their X axis standing. Repeat the process multiple times and eventually the player is only a couple of pixes tall and as wide as the screen. This fix creates a new matrix, scales that matrix and then multiplies it with the existing transformation matrix. In this way, the scale is applied first and all other transformations stack ontop of it, to create the final transformation matrix. --- code/datums/mutations/body.dm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/datums/mutations/body.dm b/code/datums/mutations/body.dm index 225db1afc8a..fc6da95a489 100644 --- a/code/datums/mutations/body.dm +++ b/code/datums/mutations/body.dm @@ -93,7 +93,9 @@ if(..()) return ADD_TRAIT(owner, TRAIT_DWARF, GENETIC_MUTATION) - owner.transform = owner.transform.Scale(1, 0.8) + var/matrix/new_transform = matrix() + new_transform.Scale(1, 0.8) + owner.transform = new_transform.Multiply(owner.transform) passtable_on(owner, GENETIC_MUTATION) owner.visible_message("[owner] suddenly shrinks!", "Everything around you seems to grow..") @@ -101,11 +103,12 @@ if(..()) return REMOVE_TRAIT(owner, TRAIT_DWARF, GENETIC_MUTATION) - owner.transform = owner.transform.Scale(1, 1.25) + var/matrix/new_transform = matrix() + new_transform.Scale(1, 1.25) + owner.transform = new_transform.Multiply(owner.transform) passtable_off(owner, GENETIC_MUTATION) owner.visible_message("[owner] suddenly grows!", "Everything around you seems to shrink..") - //Clumsiness has a very large amount of small drawbacks depending on item. /datum/mutation/human/clumsy name = "Clumsiness"