mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Replaced hasChairMoved with isEqualTo, fixed missing variable
This commit is contained in:
parent
c5f9f85d27
commit
d49798144c
@ -6,7 +6,6 @@ PREP(canSit);
|
|||||||
PREP(canStand);
|
PREP(canStand);
|
||||||
PREP(getRandomAnimation);
|
PREP(getRandomAnimation);
|
||||||
PREP(handleInterrupt);
|
PREP(handleInterrupt);
|
||||||
PREP(hasChairMoved);
|
|
||||||
PREP(moduleInit);
|
PREP(moduleInit);
|
||||||
PREP(sit);
|
PREP(sit);
|
||||||
PREP(stand);
|
PREP(stand);
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: Jonpas
|
|
||||||
* Checks if chair moved from original position.
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: Seat <OBJECT>
|
|
||||||
* 1: Seat Position <ARRAY>
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*
|
|
||||||
* Example:
|
|
||||||
* [seat, seatPos] call ace_sitting_fnc_hasChairMoved
|
|
||||||
*
|
|
||||||
* Public: No
|
|
||||||
*/
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
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
|
|
||||||
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
|
|
@ -14,9 +14,10 @@
|
|||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
|
#define DEBUG_MODE_FULL
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
private ["_actionID", "_configFile", "_sitDirection", "_sitPosition", "_sitRotation", "_sitDirectionVisual"];
|
private ["_actionID", "_configFile", "_sitDirection", "_sitPosition", "_sitRotation", "_seatPosOrig"];
|
||||||
|
|
||||||
params ["_seat", "_player"];
|
params ["_seat", "_player"];
|
||||||
|
|
||||||
@ -26,7 +27,7 @@ GVAR(seat) = _seat;
|
|||||||
// Overwrite weird position, because Arma decides to set it differently based on current animation/stance...
|
// Overwrite weird position, because Arma decides to set it differently based on current animation/stance...
|
||||||
_player switchMove "amovpknlmstpsraswrfldnon";
|
_player switchMove "amovpknlmstpsraswrfldnon";
|
||||||
|
|
||||||
// add scrollwheel action to release object
|
// Add scroll-wheel action to release object
|
||||||
_actionID = _player getVariable [QGVAR(StandUpActionID), -1];
|
_actionID = _player getVariable [QGVAR(StandUpActionID), -1];
|
||||||
|
|
||||||
if (_actionID != -1) then {
|
if (_actionID != -1) then {
|
||||||
@ -65,7 +66,9 @@ _player setPos (_seat modelToWorld _sitPosition);
|
|||||||
_player setVariable [QGVAR(isSitting), true];
|
_player setVariable [QGVAR(isSitting), true];
|
||||||
_seat setVariable [QGVAR(seatOccupied), true, true]; // To prevent multiple people sitting on one seat
|
_seat setVariable [QGVAR(seatOccupied), true, true]; // To prevent multiple people sitting on one seat
|
||||||
|
|
||||||
|
|
||||||
// Add PFH to automatically stand up if the chair has moved
|
// Add PFH to automatically stand up if the chair has moved
|
||||||
|
_seatPosOrig = getPosASL _seat;
|
||||||
[{
|
[{
|
||||||
params ["_args", "_pfhId"];
|
params ["_args", "_pfhId"];
|
||||||
_args params ["_player", "_seat", "_seatPosOrig"];
|
_args params ["_player", "_seat", "_seatPosOrig"];
|
||||||
@ -76,8 +79,8 @@ _seat setVariable [QGVAR(seatOccupied), true, true]; // To prevent multiple peop
|
|||||||
TRACE_1("Remove PFH",_player getVariable [ARR_2(QGVAR(isSitting), false)]);
|
TRACE_1("Remove PFH",_player getVariable [ARR_2(QGVAR(isSitting), false)]);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Stand up if chair moves
|
// Stand up if chair moves or gets deleted (getPosASL returns [0,0,0] in that case)
|
||||||
if ([_seat, _seatPosOrig] call FUNC(hasChairMoved)) exitWith {
|
if !((getPosASL _seat) isEqualTo _seatPosOrig) exitWith {
|
||||||
_player call FUNC(stand);
|
_player call FUNC(stand);
|
||||||
TRACE_2("Chair moved",getPosASL _seat,_seatPosOrig);
|
TRACE_2("Chair moved",getPosASL _seat,_seatPosOrig);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user