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.
This commit is contained in:
Timberpoes
2020-09-29 06:14:25 -03:00
committed by GitHub
parent 8913abac82
commit 88e9b74e07
+6 -3
View File
@@ -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("<span class='danger'>[owner] suddenly shrinks!</span>", "<span class='notice'>Everything around you seems to grow..</span>")
@@ -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("<span class='danger'>[owner] suddenly grows!</span>", "<span class='notice'>Everything around you seems to shrink..</span>")
//Clumsiness has a very large amount of small drawbacks depending on item.
/datum/mutation/human/clumsy
name = "Clumsiness"