Sitting - Add config overwrite for random animation pool (#10120)

* Add config property animation overwrite

* Update addons/sitting/functions/fnc_getRandomAnimation.sqf

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>

* Fix header

* Update addons/sitting/functions/fnc_getRandomAnimation.sqf

* Update function call

---------

Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
This commit is contained in:
Dart 2024-07-18 16:53:34 -05:00 committed by GitHub
parent f4272f0e36
commit 8f84df77d0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 41 additions and 28 deletions

View File

@ -4,7 +4,7 @@
* Gets a random animations from the list. * Gets a random animations from the list.
* *
* Arguments: * Arguments:
* None * 0: Object to get animation pool from <OBJECT> (default: objNull)
* *
* Return Value: * Return Value:
* Random Animation <STRING> * Random Animation <STRING>
@ -15,30 +15,42 @@
* Public: No * Public: No
*/ */
params [["_object", objNull, [objNull]]];
private _animations = [];
if (!isNull _object) then {
_animations = getArray (configOf _object >> QGVAR(animations));
};
if (_animations isEqualTo []) then {
_animations = [
QGVAR(HubSittingChairA_idle1),
QGVAR(HubSittingChairA_idle2),
QGVAR(HubSittingChairA_idle3),
QGVAR(HubSittingChairA_move1),
QGVAR(HubSittingChairB_idle1),
QGVAR(HubSittingChairB_idle2),
QGVAR(HubSittingChairB_idle3),
QGVAR(HubSittingChairB_move1),
QGVAR(HubSittingChairC_idle1),
QGVAR(HubSittingChairC_idle2),
QGVAR(HubSittingChairC_idle3),
QGVAR(HubSittingChairC_move1),
QGVAR(HubSittingChairUA_idle1),
QGVAR(HubSittingChairUA_idle2),
QGVAR(HubSittingChairUA_idle3),
QGVAR(HubSittingChairUA_move1),
QGVAR(HubSittingChairUB_idle1),
QGVAR(HubSittingChairUB_idle2),
QGVAR(HubSittingChairUB_idle3),
QGVAR(HubSittingChairUB_move1),
QGVAR(HubSittingChairUC_idle1),
QGVAR(HubSittingChairUC_idle2),
QGVAR(HubSittingChairUC_idle3),
QGVAR(HubSittingChairUC_move1)
];
};
// Select random animation from Animations Pool // Select random animation from Animations Pool
selectRandom [ selectRandom _animations
QGVAR(HubSittingChairA_idle1),
QGVAR(HubSittingChairA_idle2),
QGVAR(HubSittingChairA_idle3),
QGVAR(HubSittingChairA_move1),
QGVAR(HubSittingChairB_idle1),
QGVAR(HubSittingChairB_idle2),
QGVAR(HubSittingChairB_idle3),
QGVAR(HubSittingChairB_move1),
QGVAR(HubSittingChairC_idle1),
QGVAR(HubSittingChairC_idle2),
QGVAR(HubSittingChairC_idle3),
QGVAR(HubSittingChairC_move1),
QGVAR(HubSittingChairUA_idle1),
QGVAR(HubSittingChairUA_idle2),
QGVAR(HubSittingChairUA_idle3),
QGVAR(HubSittingChairUA_move1),
QGVAR(HubSittingChairUB_idle1),
QGVAR(HubSittingChairUB_idle2),
QGVAR(HubSittingChairUB_idle3),
QGVAR(HubSittingChairUB_move1),
QGVAR(HubSittingChairUC_idle1),
QGVAR(HubSittingChairUC_idle2),
QGVAR(HubSittingChairUC_idle3),
QGVAR(HubSittingChairUC_move1)
]

View File

@ -48,7 +48,7 @@ if (_multiSitting) then {
}; };
// Get random animation and perform it (before moving player to ensure correct placement) // Get random animation and perform it (before moving player to ensure correct placement)
[_player, call FUNC(getRandomAnimation), 2] call EFUNC(common,doAnimation); // Correctly places when using non-transitional animations [_player, [_seat] call FUNC(getRandomAnimation), 2] call EFUNC(common,doAnimation); // Correctly places when using non-transitional animations
[_player, "", 1] call EFUNC(common,doAnimation); // Correctly applies animation's config values (such as disallow throwing of grenades, intercept keybinds... etc). [_player, "", 1] call EFUNC(common,doAnimation); // Correctly applies animation's config values (such as disallow throwing of grenades, intercept keybinds... etc).
TRACE_2("Sit pos and dir",_sitPosition,_sitDirection); TRACE_2("Sit pos and dir",_sitPosition,_sitDirection);

View File

@ -29,6 +29,7 @@ class CfgVehicles {
acex_sitting_sitDirection = 180; // Direction relative to object acex_sitting_sitDirection = 180; // Direction relative to object
acex_sitting_sitPosition[] = {0, -0.1, -0.45}; // Position relative to object (may behave weird with certain objects) acex_sitting_sitPosition[] = {0, -0.1, -0.45}; // Position relative to object (may behave weird with certain objects)
acex_sitting_interactPosition[] = {0, -0.1, -0.45}; acex_sitting_interactPosition[] = {0, -0.1, -0.45};
ace_sitting_animations[] = {"ace_sitting_HubSittingChairA_idle1"}; // Overwrite random animation pool
XEH_ENABLED; // Enable XEH (only necessary if XEH is not yet enabled for this class or the one this inherits from) XEH_ENABLED; // Enable XEH (only necessary if XEH is not yet enabled for this class or the one this inherits from)
}; };
}; };