Skip to content

Commit

Permalink
Merge pull request #2338 from acemod/322sit
Browse files Browse the repository at this point in the history
Sitting improvements
  • Loading branch information
commy2 committed Sep 3, 2015
2 parents c213c0e + 237d5b6 commit 529c85d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
5 changes: 4 additions & 1 deletion addons/sitting/CfgMoves.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Enable visual head movement while free-looking
#define MACRO_ANIMATION \
head = "headDefault";
head = "headDefault"; \
aimingBody = "aimingNo"; \
forceAim = 1; \
static = 1;

class CfgMovesBasic;
class CfgMovesMaleSdr: CfgMovesBasic {
Expand Down
22 changes: 21 additions & 1 deletion addons/sitting/functions/fnc_sit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
#include "script_component.hpp"

private ["_configFile", "_sitDirection", "_sitPosition", "_sitRotation", "_sitDirectionVisual"];
private ["_actionID", "_configFile", "_sitDirection", "_sitPosition", "_sitRotation", "_sitDirectionVisual"];

params ["_seat", "_player"];

Expand All @@ -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));
Expand Down
13 changes: 12 additions & 1 deletion addons/sitting/functions/fnc_stand.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit 529c85d

Please sign in to comment.