stand up action (uses get out shortcut) and less awkward standing animaton

This commit is contained in:
commy2 2015-09-01 21:03:28 +02:00
parent 405d85eaaa
commit 237d5b6536
2 changed files with 33 additions and 2 deletions

View File

@ -16,7 +16,7 @@
*/
#include "script_component.hpp"
private ["_configFile", "_sitDirection", "_sitPosition", "_sitRotation", "_sitDirectionVisual"];
private ["_actionID", "_configFile", "_sitDirection", "_sitPosition", "_sitRotation", "_sitDirectionVisual"];
params ["_seat", "_player"];
@ -26,6 +26,26 @@ GVAR(seat) = _seat;
// Overwrite weird position, because Arma decides to set it differently based on current animation/stance...
_player switchMove "amovpknlmstpsraswrfldnon";
// add scrollwheel action to release object
_actionID = _player getVariable [QGVAR(StandUpActionID), -1];
if (_actionID != -1) then {
_player removeAction _actionID;
};
_actionID = _player addAction [
format ["<t color='#FFFF00'>%1</t>", localize LSTRING(Stand)],
QUOTE((_this select 0) call FUNC(stand)),
nil,
20,
false,
true,
"GetOut",
QUOTE(_this call FUNC(canStand))
];
_player setVariable [QGVAR(StandUpActionID), _actionID];
// Read config
_configFile = configFile >> "CfgVehicles" >> typeOf _seat;
_sitDirection = (getDir _seat) + getNumber (_configFile >> QGVAR(sitDirection));

View File

@ -17,8 +17,19 @@
params ["_player"];
// remove scroll wheel action
_player removeAction (_player getVariable [QGVAR(StandUpActionID), -1]);
// Restore animation
[_player, "", 2] call EFUNC(common,doAnimation);
private "_animation";
_animation = switch (currentWeapon _player) do {
case "": {"amovpercmstpsnonwnondnon"};
case (primaryWeapon _player): {"amovpercmstpslowwrfldnon"};
case (handgunWeapon _player): {"amovpercmstpslowwpstdnon"};
default {"amovpercmstpsnonwnondnon"};
};
[_player, _animation, 2] call EFUNC(common,doAnimation);
// Set variables to nil
_player setVariable [QGVAR(isSitting), nil];