diff --git a/addons/sitting/functions/fnc_canSit.sqf b/addons/sitting/functions/fnc_canSit.sqf index c34281e496..fef36b4bbd 100644 --- a/addons/sitting/functions/fnc_canSit.sqf +++ b/addons/sitting/functions/fnc_canSit.sqf @@ -10,17 +10,16 @@ * Can Sit Down * * Example: - * [seat, player] call ace_sitting_fnc_canSit; + * [seat, player] call ace_sitting_fnc_canSit * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_2(_seat,_player); +params ["_seat", "_player"]; // Sitting enabled, is seat object, not occupied and standing up (or not on a big slope) GVAR(enable) && {getNumber (configFile >> "CfgVehicles" >> typeOf _seat >> QGVAR(canSit)) == 1} && -{isNil{_seat getVariable QGVAR(seatOccupied)}} && +{isNil {_seat getVariable QGVAR(seatOccupied)}} && {round (vectorUp _seat select 0) == 0 && {round (vectorUp _seat select 1) == 0} && {round (vectorUp _seat select 2) == 1}} diff --git a/addons/sitting/functions/fnc_canStand.sqf b/addons/sitting/functions/fnc_canStand.sqf index 4549b9891b..c516485a82 100644 --- a/addons/sitting/functions/fnc_canStand.sqf +++ b/addons/sitting/functions/fnc_canStand.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_player); +params ["_player"]; // Sitting -(_player getVariable [QGVAR(isSitting),false]) +(_player getVariable [QGVAR(isSitting), false]) diff --git a/addons/sitting/functions/fnc_getRandomAnimation.sqf b/addons/sitting/functions/fnc_getRandomAnimation.sqf index b4d6455694..ca9a9ccfb1 100644 --- a/addons/sitting/functions/fnc_getRandomAnimation.sqf +++ b/addons/sitting/functions/fnc_getRandomAnimation.sqf @@ -9,13 +9,13 @@ * Random Animation * * Example: - * _animation = call ace_sitting_fnc_getRandomAnimation; + * _animation = call ace_sitting_fnc_getRandomAnimation * * Public: No */ #include "script_component.hpp" -private ["_animations"]; +private "_animations"; // Animations Pool _animations = [ diff --git a/addons/sitting/functions/fnc_handleInterrupt.sqf b/addons/sitting/functions/fnc_handleInterrupt.sqf index fb32635195..328675c172 100644 --- a/addons/sitting/functions/fnc_handleInterrupt.sqf +++ b/addons/sitting/functions/fnc_handleInterrupt.sqf @@ -9,13 +9,13 @@ * None * * Example: - * player call ace_sitting_fnc_handleInterrupt; + * player call ace_sitting_fnc_handleInterrupt * * Public: No */ #include "script_component.hpp" -PARAMS_1(_player); +params ["_player"]; if (_player getVariable [QGVAR(isSitting), false]) then { _player call FUNC(stand); diff --git a/addons/sitting/functions/fnc_hasChairMoved.sqf b/addons/sitting/functions/fnc_hasChairMoved.sqf index fe56438878..de3a38e0ce 100644 --- a/addons/sitting/functions/fnc_hasChairMoved.sqf +++ b/addons/sitting/functions/fnc_hasChairMoved.sqf @@ -10,18 +10,21 @@ * None * * Example: - * [seat, seatPos] call ace_sitting_fnc_hasChairMoved; + * [seat, seatPos] call ace_sitting_fnc_hasChairMoved * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" -PARAMS_2(_seat,_seatPosOrig); +params ["_seat", "_seatPosOrig"]; TRACE_2("Chair position",_seatPosOrig,getPosASL _seat); +(getPosASL _seat) params ["_seatX", "_seatY", "_seatZ"]; +_seatPosOrig params ["_seatOrigX", "_seatOrigY", "_seatOrigZ"]; + // Check each coordinate due to possibility of tiny movements in simulation -(getPosASL _seat) select 0 < (_seatPosOrig select 0) - 0.01 || {(getPosASL _seat) select 0 > (_seatPosOrig select 0) + 0.01} || -{(getPosASL _seat) select 1 < (_seatPosOrig select 1) - 0.01 || {(getPosASL _seat) select 1 > (_seatPosOrig select 1) + 0.01}} || -{(getPosASL _seat) select 2 < (_seatPosOrig select 2) - 0.01 || {(getPosASL _seat) select 2 > (_seatPosOrig select 2) + 0.01}} +if (abs (_seatX - _seatOrigX) > 0.01) exitWith {true}; +if (abs (_seatY - _seatOrigY) > 0.01) exitWith {true}; +if (abs (_seatZ - _seatOrigZ) > 0.01) exitWith {true}; +false diff --git a/addons/sitting/functions/fnc_moduleInit.sqf b/addons/sitting/functions/fnc_moduleInit.sqf index 25da5be347..ae476317db 100644 --- a/addons/sitting/functions/fnc_moduleInit.sqf +++ b/addons/sitting/functions/fnc_moduleInit.sqf @@ -3,18 +3,22 @@ * Initializes the Sitting module. * * Arguments: - * Whatever the module provides. + * 0: The module logic + * 1: Units + * 2: Activated * * Return Value: * None + * + * Public: No */ #include "script_component.hpp" if !(isServer) exitWith {}; -PARAMS_3(_logic,_units,_activated); +params ["_logic", "_units", "_activated"]; -if !(_activated) exitWith {}; +if (!_activated) exitWith {}; [_logic, QGVAR(enable), "enable"] call EFUNC(common,readSettingFromModule); diff --git a/addons/sitting/functions/fnc_sit.sqf b/addons/sitting/functions/fnc_sit.sqf index b8cbcfc56b..0c6825ed58 100644 --- a/addons/sitting/functions/fnc_sit.sqf +++ b/addons/sitting/functions/fnc_sit.sqf @@ -14,12 +14,11 @@ * * Public: No */ -//#define DEBUG_MODE_FULL #include "script_component.hpp" private ["_configFile", "_sitDirection", "_sitPosition", "_sitRotation", "_sitDirectionVisual"]; -PARAMS_2(_seat,_player); +params ["_seat", "_player"]; // Set global variable for standing up GVAR(seat) = _seat; @@ -50,12 +49,13 @@ _seat setVariable [QGVAR(seatOccupied), true, true]; // To prevent multiple peop _sitDirectionVisual = getDirVisual _player; // Needed for precision and issues with using above directly _seatPosOrig = getPosASL _seat; [{ - EXPLODE_5_PVT(_this select 0,_player,_sitDirectionVisual,_sitRotation,_seat,_seatPosOrig); - + params ["_args", "_pfhId"]; + _args params ["_player", "_sitDirectionVisual", "_sitRotation", "_seat", "_seatPosOrig"]; + // Remove PFH if not sitting any more if !(_player getVariable [QGVAR(isSitting), false]) exitWith { - [_this select 1] call cba_fnc_removePerFrameHandler; - TRACE_1("Remove PFH",_player getVariable [ARR_2(QGVAR(isSitting),false)]); + [_pfhId] call cba_fnc_removePerFrameHandler; + TRACE_1("Remove PFH",_player getVariable [ARR_2(QGVAR(isSitting), false)]); }; // Stand up if chair moves diff --git a/addons/sitting/functions/fnc_stand.sqf b/addons/sitting/functions/fnc_stand.sqf index df1ee6f169..978bcaf279 100644 --- a/addons/sitting/functions/fnc_stand.sqf +++ b/addons/sitting/functions/fnc_stand.sqf @@ -15,7 +15,7 @@ */ #include "script_component.hpp" -PARAMS_1(_player); +params ["_player"]; // Restore animation [_player, "", 2] call EFUNC(common,doAnimation);