summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVittorio Romeo <vittorio.romeo@outlook.com>2021-11-04 19:20:52 +0000
committerVittorio Romeo <vittorio.romeo@outlook.com>2021-11-04 19:20:52 +0000
commit9021c2068d0d079237cf180f94482a57b19002c3 (patch)
tree4b0c8311cb53945e2eda91237665acca5f0c7842
parente248dbc507935a178ef76f89d457711795bfb589 (diff)
Fix death animation after swap or large distances
-rw-r--r--src/SSVOpenHexagon/Components/CPlayer.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/SSVOpenHexagon/Components/CPlayer.cpp b/src/SSVOpenHexagon/Components/CPlayer.cpp
index d7b3263c..27bcb239 100644
--- a/src/SSVOpenHexagon/Components/CPlayer.cpp
+++ b/src/SSVOpenHexagon/Components/CPlayer.cpp
@@ -150,9 +150,14 @@ void CPlayer::kill(const bool fatal)
{
_dead = true;
- // Move back position to graphically show the tip of the triangle
- // hitting the wall rather than the center of the triangle.
- _pos = ssvs::getOrbitRad(_lastPos, _angle, -_size);
+ // Avoid moving back position if the player had just swapped or the
+ // player was forcibly moved by a lot via Lua scripting.
+ if(!_justSwapped && ssvs::getDistEuclidean(_pos, _lastPos) < 24.f)
+ {
+ // Move back position to graphically show the tip of the triangle
+ // hitting the wall rather than the center of the triangle.
+ _pos = ssvs::getOrbitRad(_lastPos, _angle, -_size);
+ }
}
}