Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interaction - Add actions based on animations #6144

Merged
merged 34 commits into from
Aug 11, 2024
Merged
Changes from 2 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c9cdf70
Add actions based on animations
Dystopian Feb 10, 2018
019417a
Add setting
Dystopian Feb 12, 2018
eecc496
Add ability to set items for users
Dystopian Feb 12, 2018
0803c32
Merge remote-tracking branch 'upstream/master' into anim_actions
Dystopian Apr 21, 2018
1e336e0
Add actions for 1.82 changes
Dystopian Apr 22, 2018
982705c
Merge remote-tracking branch 'upstream/master' into anim_actions
Dystopian Aug 14, 2018
a9067c5
Add RHS 0.4.6 ZIL spare
Dystopian Aug 14, 2018
0fa0f1f
Merge remote-tracking branch 'upstream/master' into anim_actions
Dystopian Sep 19, 2018
70d7c9e
Update to new standards
Dystopian Sep 19, 2018
5c2ced1
Handle RHS BTR retread system
Dystopian Sep 19, 2018
30dfa0e
Make init faster: move condition to configClasses
Dystopian Sep 23, 2018
bc7a2e4
Fix CUP fake anims
Dystopian Sep 23, 2018
2711901
Merge remote-tracking branch 'upstream/master' into anim_actions
Dystopian Dec 9, 2018
36c6846
Merge branch 'my2' into anim_actions
Dystopian Mar 17, 2019
b9c73ab
Merge remote-tracking branch 'upstream/master' into anim_actions
Dystopian Apr 22, 2021
d0f3aa5
Refactor
Dystopian Apr 23, 2021
724d127
Rework
Dystopian Apr 25, 2021
233e4c4
Rename init function
Dystopian Apr 25, 2021
34fd0d8
Decrease number of classes to init
Dystopian Apr 25, 2021
d7922b8
Merge branch 'master' into anim_actions
Dystopian Jul 25, 2021
69fb345
Fix merge mistake
Dystopian Jul 25, 2021
7f929bb
Apply suggestions from code review
jonpas Oct 12, 2021
25adfec
Merge branch 'master' into anim_actions
jonpas Oct 12, 2021
be26111
Merge branch 'master' into pr/6144
johnb432 Jul 20, 2024
f291fe1
Updated code for current mod structure
johnb432 Jul 20, 2024
6d80dcc
Multiple fixes & tweaks
johnb432 Jul 20, 2024
b50119f
Merge branch 'master' into pr/6144
johnb432 Jul 20, 2024
b160189
Update CfgVehicles.hpp
johnb432 Jul 22, 2024
2b0faa7
cache config lookup at preStart
PabstMirror Aug 9, 2024
76937f9
Merge branch 'master' into pr/6144
johnb432 Aug 9, 2024
dd7df53
Fix error
johnb432 Aug 9, 2024
dccb240
Add text config entry for progress bar title
johnb432 Aug 9, 2024
e36682a
Restructure interactions, improved some locations & added interaction…
johnb432 Aug 9, 2024
1d0aa16
Reverted preInit change
johnb432 Aug 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 45 additions & 46 deletions addons/interaction/functions/fnc_switchAnimActions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -81,61 +81,60 @@ private _condition = {

GVAR(animActionsEnabled)
&& {isClass _animConfig}
&& {0 != [_animConfig >> "scope", "number", 1] call CBA_fnc_getConfigEntry}
&& {0 != [_vehicleConfig >> QGVAR(anims) >> _anim >> "enabled", "number", 1] call CBA_fnc_getConfigEntry}
&& {0 != [_animConfig >> "scope", "number", 1] call CBA_fnc_getConfigEntry} // anim hidden
&& {isNumber (_animConfig >> "initPhase")} // anim correct - CUP inherits and clears some
&& {0 != [_vehicleConfig >> QGVAR(anims) >> _anim >> "enabled", "number", 1] call CBA_fnc_getConfigEntry} // anim disabled
&& {_target animationPhase _anim != _phase}
&& {[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)}
};

{
if (isClass (_x >> QGVAR(anims))) then {
private _vehicleConfig = _x;
private _vehicle = configName _vehicleConfig;
{
scopeName "animLoop";
private _anim = configName _x;
private _animConfigParent = inheritsFrom _vehicleConfig >> QGVAR(anims) >> _anim;
if (
!isClass _animConfigParent
|| {_x != _animConfigParent && {0 == [_animConfigParent >> "inherit", "number", 1] call CBA_fnc_getConfigEntry}}
) then {
private _positions = [_x >> "position"] call BIS_fnc_getCfgData;
if (!isNil "_positions") then {
if (_positions isEqualType "") then {
_positions = [compile format [
QUOTE(call compile getText (configFile >> 'CfgVehicles' >> typeOf _target >> QQGVAR(anims) >> '%1' >> 'position')),
_anim
]];
};
} else {
if ("" == getText (_x >> "selection")) then {
ERROR_2("No action position for vehicle %1 anim %2",_vehicle,_anim);
breakTo "animLoop";
};
private _vehicleConfig = _x;
private _vehicle = configName _vehicleConfig;
{
scopeName "animLoop";
private _anim = configName _x;
private _animConfigParent = inheritsFrom _vehicleConfig >> QGVAR(anims) >> _anim;
if (
!isClass _animConfigParent
|| {_x != _animConfigParent && {0 == [_animConfigParent >> "inherit", "number", 1] call CBA_fnc_getConfigEntry}}
) then {
private _positions = [_x >> "position"] call BIS_fnc_getCfgData;
if (!isNil "_positions") then {
if (_positions isEqualType "") then {
_positions = [compile format [
QUOTE(_target selectionPosition getText (configFile >> 'CfgVehicles' >> typeOf _target >> QQGVAR(anims) >> '%1' >> 'selection')),
QUOTE(call compile getText (configFile >> 'CfgVehicles' >> typeOf _target >> QQGVAR(anims) >> '%1' >> 'position')),
Dystopian marked this conversation as resolved.
Show resolved Hide resolved
_anim
]];
};

private _phase = [_x >> "phase", "number", 1] call CBA_fnc_getConfigEntry;
private _name = [_x >> "name", "text", localize "str_a3_cfgactions_unmountitem0"] call CBA_fnc_getConfigEntry;
private _icon = [_x >> "icon", "text", "\A3\ui_f\data\igui\cfg\actions\take_ca.paa"] call CBA_fnc_getConfigEntry;
private _duration = [_x >> "duration", "number", 10] call CBA_fnc_getConfigEntry;
private _inherit = 0 != [_x >> "inherit", "number", 1] call CBA_fnc_getConfigEntry;
{
private _action = [
format ["%1%2", _anim, _forEachIndex],
_name, _icon, _statement, _condition, {},
[_anim, _phase, _duration],
_x
] call EFUNC(interact_menu,createAction);
[_vehicle, 0, [], _action, _inherit] call EFUNC(interact_menu,addActionToClass);
TRACE_3("",_vehicle,_anim,_x);
} forEach _positions;
} else {
if ("" == getText (_x >> "selection")) then {
ERROR_2("No action position for vehicle %1 anim %2",_vehicle,_anim);
breakTo "animLoop";
};
_positions = [compile format [
QUOTE(_target selectionPosition getText (configFile >> 'CfgVehicles' >> typeOf _target >> QQGVAR(anims) >> '%1' >> 'selection')),
_anim
]];
};
} forEach ('true' configClasses (_x >> QGVAR(anims)));
};
} forEach ('true' configClasses (configFile >> "CfgVehicles"));

private _phase = [_x >> "phase", "number", 1] call CBA_fnc_getConfigEntry;
private _name = [_x >> "name", "text", localize "str_a3_cfgactions_unmountitem0"] call CBA_fnc_getConfigEntry;
private _icon = [_x >> "icon", "text", "\A3\ui_f\data\igui\cfg\actions\take_ca.paa"] call CBA_fnc_getConfigEntry;
private _duration = [_x >> "duration", "number", 10] call CBA_fnc_getConfigEntry;
private _inherit = 0 != [_x >> "inherit", "number", 1] call CBA_fnc_getConfigEntry;
{
private _action = [
format ["%1%2", _anim, _forEachIndex],
_name, _icon, _statement, _condition, {},
[_anim, _phase, _duration],
_x
] call EFUNC(interact_menu,createAction);
[_vehicle, 0, [], _action, _inherit] call EFUNC(interact_menu,addActionToClass);
TRACE_3("add anim",_vehicle,_anim,_x);
} forEach _positions;
};
} forEach ('true' configClasses (_x >> QGVAR(anims)));
} forEach (QUOTE(isClass (_x >> QQGVAR(anims))) configClasses (configFile >> "CfgVehicles"));

GVAR(animActionsInitialized) = true;