ACE3/addons/interaction/XEH_preStart.sqf
Dystopian 96f81f1c9b
Interaction - Add actions based on animations (#6144)
* Add actions based on animations

* Add setting

* Add ability to set items for users

* Add actions for 1.82 changes

Add actions for backpacks, canisters, entrench tool.
Move items and backpack to WeaponHolder.

* Add RHS 0.4.6 ZIL spare

* Update to new standards

* Handle RHS BTR retread system

* Make init faster: move condition to configClasses

* Fix CUP fake anims

* Refactor

* Rework

* Rename init function

* Decrease number of classes to init

* Fix merge mistake

* Apply suggestions from code review

* Updated code for current mod structure

* Multiple fixes & tweaks

- Made anim setting require a mission restart
- Handle more types of items that can be spawned
- Prioritise adding items to inventory and only drop on ground if no inventory space
- Add more position checks to make certain no valid position are present before stopping
- If 1 item was spawned in, it's considered as success
- Disable RHS' wheel replacement only if ace_repair is loaded

* Update CfgVehicles.hpp

* cache config lookup at preStart

* Fix error

* Add text config entry for progress bar title

* Restructure interactions, improved some locations & added interaction to some missing vehicles

* Reverted preInit change

---------

Co-authored-by: jonpas <jonpas33@gmail.com>
Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com>
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2024-08-10 23:29:50 -05:00

36 lines
1.4 KiB
Plaintext

#include "script_component.hpp"
#include "XEH_PREP.hpp"
if (!hasInterface) exitWith {};
private _replaceTerrainClasses = QUOTE(
getNumber (_x >> QQGVAR(replaceTerrainObject)) > 0
&& {getNumber (_x >> 'scope') == 2}
) configClasses (configFile >> "CfgVehicles");
private _cacheReplaceTerrainModels = createHashMap;
{
private _model = toLowerANSI getText (_x >> "model");
if (_model select [0, 1] == "\") then {
_model = _model select [1];
};
if ((_model select [count _model - 4]) != ".p3d") then {
_model = _model + ".p3d"
};
if (_model in _cacheReplaceTerrainModels) then {continue};
_cacheReplaceTerrainModels set [_model, configName _x];
} forEach _replaceTerrainClasses;
uiNamespace setVariable [QGVAR(cacheReplaceTerrainModels), compileFinal str _cacheReplaceTerrainModels];
// Cache classes with anim actions
private _animActionsClasses = (QUOTE(isClass (_x >> QQGVAR(anims)) && {!isClass (inheritsFrom _x >> QQGVAR(anims))}) configClasses (configFile >> "CfgVehicles"));
_animActionsClasses = _animActionsClasses apply { configName _x };
_animActionsClasses = _animActionsClasses select {
private _class = _x;
(_animActionsClasses findIf {(_class != _x) && {_class isKindOf _x}}) == -1 // filter classes that already have a parent in the list
};
uiNamespace setVariable [QGVAR(animActionsClasses), compileFinal (_animActionsClasses createHashMapFromArray [])];