Skip to content

Commit

Permalink
Fix player stuck in drill animation (#115)
Browse files Browse the repository at this point in the history
* Fix spelling

* Move check

* Fix animation not transitioning to looped end animation
  • Loading branch information
Timi007 authored Oct 20, 2024
1 parent 66fb5b3 commit 988bb38
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 39 deletions.
2 changes: 0 additions & 2 deletions addons/drill/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include "script_component.hpp"

CHECK(!hasInterface);

#include "initKeybinds.hpp"
74 changes: 40 additions & 34 deletions addons/drill/functions/fnc_playAnimation.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Executes given animation.
*
* Parameter(s):
* 0: STRING - Animation name
* 0: STRING - Animation name. ("mts_drill_StandStill", "mts_drill_AtEase", "mts_drill_Salute", or "mts_drill_FY")
*
* Returns:
* Nothing
Expand All @@ -16,98 +16,104 @@
*
*/

params ["_animName"];
params [["_animName", "", [""]]];

private _player = call CBA_fnc_currentUnit;
private _currAnimState = animationState _player;
private _animationSequence = [];

private _currAnimState = animationState ACE_player;
private _doAnimation = "";
private _doAnimationTwo = "";
TRACE_2("",_animName,_currAnimState);

if (_animName isEqualTo QGVAR(StandStill)) then {
if (_currAnimState == "AmovPercMstpSnonWnonDnon") then {
_doAnimation = QGVAR(AmovPercMstpSnonWnonDnon_StandStill);
_animationSequence = [QGVAR(AmovPercMstpSnonWnonDnon_StandStill), QGVAR(StandStill)];

if (GVAR(UIEnabled)) then {
cutRsc [QGVAR(StandStill),"PLAIN"];
cutRsc [QGVAR(StandStill), "PLAIN"];
};
};
};
if (_currAnimState == QGVAR(StandStill)) then {
_doAnimation = QGVAR(StandStill_AmovPercMstpSnonWnonDnon);
_animationSequence = [QGVAR(StandStill_AmovPercMstpSnonWnonDnon)];

if (GVAR(UIEnabled)) then {
cutText ["", "PLAIN"];
};
};
if (_currAnimState == QGVAR(AtEase)) then {
_doAnimation = QGVAR(AtEase_StandStill);
_animationSequence = [QGVAR(AtEase_StandStill), QGVAR(StandStill)];

if (GVAR(UIEnabled)) then {
cutText ["", "PLAIN"];
cutRsc [QGVAR(StandStill),"PLAIN"];
cutRsc [QGVAR(StandStill), "PLAIN"];
};
};
if (_currAnimState == "AmovPercMstpSnonWnonDnon_Salute") then {
_doAnimation = "AmovPercMstpSnonWnonDnon_SaluteOut";
_doAnimationTwo = QGVAR(AmovPercMstpSnonWnonDnon_StandStill);
_animationSequence = ["AmovPercMstpSnonWnonDnon_SaluteOut", QGVAR(AmovPercMstpSnonWnonDnon_StandStill), QGVAR(StandStill)];

if (GVAR(UIEnabled)) then {
cutRsc [QGVAR(StandStill),"PLAIN"];
cutRsc [QGVAR(StandStill), "PLAIN"];
};
};
};

if (_animName isEqualTo QGVAR(AtEase)) then {
if (_currAnimState == "AmovPercMstpSnonWnonDnon") then {
_doAnimation = QGVAR(AmovPercMstpSnonWnonDnon_AtEase);
_animationSequence = [QGVAR(AmovPercMstpSnonWnonDnon_AtEase), QGVAR(AtEase)];

if (GVAR(UIEnabled)) then {
cutRsc [QGVAR(AtEase),"PLAIN"];
cutRsc [QGVAR(AtEase), "PLAIN"];
};
};
if (_currAnimState == QGVAR(AtEase)) then {
_doAnimation = QGVAR(AtEase_AmovPercMstpSnonWnonDnon);
_animationSequence = [QGVAR(AtEase_AmovPercMstpSnonWnonDnon)];

if (GVAR(UIEnabled)) then {
cutText ["", "PLAIN"];
};
};
if (_currAnimState == QGVAR(StandStill)) then {
_doAnimation = QGVAR(StandStill_AtEase);
_animationSequence = [QGVAR(StandStill_AtEase), QGVAR(AtEase)];

if (GVAR(UIEnabled)) then {
cutText ["", "PLAIN"];
cutRsc [QGVAR(AtEase),"PLAIN"];
cutRsc [QGVAR(AtEase), "PLAIN"];
};
};
if (_currAnimState == "AmovPercMstpSnonWnonDnon_Salute") then {
_doAnimation = "AmovPercMstpSnonWnonDnon_SaluteOut";
_doAnimationTwo = QGVAR(AmovPercMstpSnonWnonDnon_AtEase);
_animationSequence = ["AmovPercMstpSnonWnonDnon_SaluteOut", QGVAR(AmovPercMstpSnonWnonDnon_AtEase), QGVAR(AtEase)];

if (GVAR(UIEnabled)) then {
cutRsc [QGVAR(AtEase),"PLAIN"];
cutRsc [QGVAR(AtEase), "PLAIN"];
};
};
};

if (_animName isEqualTo QGVAR(FY)) then {
if (_currAnimState == "AmovPercMstpSnonWnonDnon") then {
_doAnimation = QGVAR(FY)};
_animationSequence = [QGVAR(FY)];
};
};

if (_animName isEqualTo QGVAR(Salute)) then {
if (_currAnimState == QGVAR(StandStill)) then {
_doAnimation = QGVAR(StandStill_AmovPercMstpSnonWnonDnon);
_doAnimationTwo = "AmovPercMstpSnonWnonDnon_SaluteIn";
_animationSequence = [QGVAR(StandStill_AmovPercMstpSnonWnonDnon), "AmovPercMstpSnonWnonDnon_SaluteIn"];

if (GVAR(UIEnabled)) then {
cutText ["", "PLAIN"];
};
};
if (_currAnimState == QGVAR(AtEase)) then {
_doAnimation = QGVAR(StandStill_AmovPercMstpSnonWnonDnon);
_doAnimationTwo = "AmovPercMstpSnonWnonDnon_SaluteIn";
_animationSequence = [QGVAR(AtEase_AmovPercMstpSnonWnonDnon), "AmovPercMstpSnonWnonDnon_SaluteIn"];

if (GVAR(UIEnabled)) then {
cutText ["", "PLAIN"];
};
};
};

TRACE_1("Animation Sequence",_animationSequence);

if (_doAnimation isNotEqualTo "") then {
[ACE_player, _doAnimation, 2] call ace_common_fnc_doAnimation;
};

if (_doAnimationTwo isNotEqualTo "") then {
[ACE_player, _doAnimationTwo, 0] call ace_common_fnc_doAnimation;
};
{
// First entry is played with switchmove, other with playmove
[_player, _x, [0, 2] select (_forEachIndex isEqualTo 0)] call ace_common_fnc_doAnimation;
} forEach _animationSequence;
2 changes: 2 additions & 0 deletions addons/drill/initKeybinds.hpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
CHECK(!hasInterface);

[
[LELSTRING(main,category), LLSTRING(subCategory)],
QGVAR(StandStill_keybind),
Expand Down
6 changes: 3 additions & 3 deletions addons/drill/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
<German>Rührt euch</German>
</Key>
<Key ID="STR_mts_drill_FY">
<Original>Give the Finger</Original>
<Original>Give the finger</Original>
<German>Stinkefinger zeigen</German>
</Key>
<Key ID="STR_mts_drill_showUI">
<Original>Show Drill stance indicator</Original>
<Original>Show drill stance indicator</Original>
<German>Zeige Formaldienst Haltungsindikator</German>
</Key>
<Key ID="STR_mts_drill_showUI_tooltip">
<Original>Show Drill stance indicator in bottom right corner.</Original>
<Original>Show drill stance indicator in bottom right corner.</Original>
<German>Zeigt die Haltung für den Formaldienst unten rechts.</German>
</Key>
</Package>
Expand Down

0 comments on commit 988bb38

Please sign in to comment.