mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Optimized condition functions, Removed redundant toLower for animation names
This commit is contained in:
parent
4cea9bd1bc
commit
2104e5b45f
@ -19,9 +19,4 @@
|
||||
PARAMS_2(_seat,_player);
|
||||
|
||||
// If seat object and not occupied
|
||||
if (getNumber (configFile >> "CfgVehicles" >> typeOf _seat >> QGVAR(canSit)) == 1 &&
|
||||
{isNil{_seat getVariable QGVAR(seatOccupied)}}
|
||||
) exitWith {true};
|
||||
|
||||
// Default
|
||||
false
|
||||
(getNumber (configFile >> "CfgVehicles" >> typeOf _seat >> QGVAR(canSit)) == 1 && {isNil{_seat getVariable QGVAR(seatOccupied)}})
|
||||
|
@ -15,8 +15,7 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
// If sitting
|
||||
if (_this getVariable [QGVAR(sitting),false]) exitWith {true};
|
||||
PARAMS_1(_player);
|
||||
|
||||
// Default
|
||||
false
|
||||
// If sitting
|
||||
(_player getVariable [QGVAR(sitting),false])
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "script_component.hpp"
|
||||
|
||||
// Animations Pool
|
||||
_animPool = [
|
||||
_animations = [
|
||||
"HubSittingChairUA_idle1",
|
||||
"HubSittingChairUA_idle2",
|
||||
"HubSittingChairUA_idle3",
|
||||
@ -43,13 +43,5 @@ _animPool = [
|
||||
"HubSittingChairC_move1"
|
||||
];
|
||||
|
||||
// Set all animation names to lower-case
|
||||
_animations = [];
|
||||
{
|
||||
_animations pushBack (toLower _x);
|
||||
} forEach _animPool;
|
||||
|
||||
// Select random animation
|
||||
_animation = _animations select (floor (random (count _animations)));
|
||||
|
||||
_animation
|
||||
(_animations select (floor (random (count _animations))))
|
||||
|
@ -33,8 +33,7 @@ _player setDir ((getDir _seat) + _sitDirection);
|
||||
_player setPos (_seat modelToWorld _sitPosition);
|
||||
|
||||
// Get random animation and perform it
|
||||
_animation = call FUNC(getRandomAnimation);
|
||||
[_player, _animation, 2] call EFUNC(common,doAnimation);
|
||||
[_player, call FUNC(getRandomAnimation), 2] call EFUNC(common,doAnimation);
|
||||
|
||||
// Set variables
|
||||
_player setVariable [QGVAR(sitting), true];
|
||||
|
@ -15,9 +15,12 @@
|
||||
*/
|
||||
#include "script_component.hpp"
|
||||
|
||||
PARAMS_1(_player);
|
||||
|
||||
// Restore animation
|
||||
[_this, "", 2] call EFUNC(common,doAnimation);
|
||||
[_player, "", 2] call EFUNC(common,doAnimation);
|
||||
|
||||
// Set variables to nil
|
||||
_this setVariable [QGVAR(sitting), nil];
|
||||
_player setVariable [QGVAR(sitting), nil];
|
||||
GVAR(seat) setVariable [QGVAR(seatOccupied), nil, true];
|
||||
GVAR(seat) = nil;
|
||||
|
Loading…
Reference in New Issue
Block a user