From c9cdf707d5061e140b023f609575acdd00ea6e35 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sun, 11 Feb 2018 02:44:26 +0300 Subject: [PATCH 01/23] Add actions based on animations --- addons/interaction/CfgVehicles.hpp | 10 ++ addons/interaction/XEH_PREP.hpp | 1 + addons/interaction/XEH_postInit.sqf | 2 + .../functions/fnc_initAnimActions.sqf | 118 ++++++++++++++++++ addons/repair/CfgVehicles.hpp | 19 +++ optionals/compat_rhs_afrf3/CfgVehicles.hpp | 84 +++++++++++-- optionals/compat_rhs_afrf3/XEH_preInit.sqf | 2 + optionals/compat_rhs_usf3/CfgVehicles.hpp | 68 +++++++++- 8 files changed, 289 insertions(+), 15 deletions(-) create mode 100644 addons/interaction/functions/fnc_initAnimActions.sqf diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 9bd70a00dac..e4124fe0ffd 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -368,6 +368,16 @@ class CfgVehicles { }; }; + class Car_F: Car {}; + class Offroad_01_base_F: Car_F { + class GVAR(anims) { + class HideBackpacks { + position[] = {{-1.15,-1.15,-0.2}, {1.1,-1.15,-0.2}, {1.1,-2.5,-0.2}}; + item[] = {"B_TacticalPack_blk", "B_TacticalPack_blk", "B_Carryall_khk", "B_Carryall_khk"}; + }; + }; + }; + class Tank: LandVehicle { class ACE_Actions { class ACE_MainActions { diff --git a/addons/interaction/XEH_PREP.hpp b/addons/interaction/XEH_PREP.hpp index 1a70de88315..91b3a329ca2 100644 --- a/addons/interaction/XEH_PREP.hpp +++ b/addons/interaction/XEH_PREP.hpp @@ -42,4 +42,5 @@ PREP(openDoor); PREP(canPush); PREP(push); +PREP(initAnimActions); PREP(switchLamp); diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 5d2b49f9b16..f0d884c712e 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -116,3 +116,5 @@ GVAR(isOpeningDoor) = false; }]; }; }] call CBA_fnc_addEventHandler; + +call FUNC(initAnimActions); diff --git a/addons/interaction/functions/fnc_initAnimActions.sqf b/addons/interaction/functions/fnc_initAnimActions.sqf new file mode 100644 index 00000000000..8fd09f4149c --- /dev/null +++ b/addons/interaction/functions/fnc_initAnimActions.sqf @@ -0,0 +1,118 @@ +/* + * Author: Dystopian + * Initializes animation based interactions. + * + * Arguments: + * None + * + * Return Value: + * None + * + * Example: + * call ace_interaction_fnc_initAnimActions + * + * Public: No + */ +#include "script_component.hpp" + +private _statement = { + params ["_target", "_player", "_params"]; + _params params ["_anim", "_phase", "_items", "_duration"]; + [ + _duration, + [_target, _player, _anim, _phase, _items], + { + (_this select 0) params ["_target", "_player", "_anim", "_phase", "_items"]; + scopeName "main"; + if !(_items isEqualTo []) then { + private _emptyPosAGL = [_target, _items select 0, _player] call EFUNC(common,findUnloadPosition); + if (_emptyPosAGL isEqualTo []) then { + [localize ELSTRING(common,NoRoomToUnload)] call EFUNC(common,displayTextStructured); + breakOut "main"; + }; + { + (createVehicle [_x, _emptyPosAGL, [], 0, "NONE"]) setPosASL (AGLtoASL _emptyPosAGL); + } forEach _items; + }; + _target animate [_anim, _phase, true]; + }, + {}, + nil, + { + (_this select 0) params ["_target", "", "_anim", "_phase"]; + _target animationPhase _anim != _phase + }, + ["isNotSwimming"] + ] call EFUNC(common,progressBar); +}; + +private _condition = { + params ["_target", "_player", "_params"]; + _params params ["_anim", "_phase"]; + private _vehicleConfig = configFile >> "CfgVehicles" >> typeOf _target; + private _animConfig = _vehicleConfig >> "AnimationSources" >> _anim; + + isClass _animConfig + && {0 != [_animConfig >> "scope", "number", 1] call CBA_fnc_getConfigEntry} + && {0 != [_vehicleConfig >> QGVAR(anims) >> _anim >> "enabled", "number", 1] call CBA_fnc_getConfigEntry} + && {_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 ("" == getText (_x >> "selection")) then { + ERROR_2("No action position for vehicle %1 anim %2",_vehicle,_anim); + breakTo "animLoop"; + } else { + _positions = [compile format [ + QUOTE(_target selectionPosition getText (configFile >> 'CfgVehicles' >> typeOf _target >> QQGVAR(anims) >> '%1' >> 'selection')), + _anim + ]]; + }; + } else { + if (_positions isEqualType "") then { + _positions = [compile format [ + QUOTE(call compile getText (configFile >> 'CfgVehicles' >> typeOf _target >> QQGVAR(anims) >> '%1' >> 'position')), + _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 _items = [_x >> "item"] call BIS_fnc_getCfgData; + if (isNil "_items") then { + _items = []; + } else { + if (_items isEqualType "") then {_items = [_items]}; + }; + 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, _items, _duration], + _x + ] call EFUNC(interact_menu,createAction); + [_vehicle, 0, [], _action, _inherit] call EFUNC(interact_menu,addActionToClass); + TRACE_3("",_vehicle,_anim,_x); + } forEach _positions; + }; + } forEach ('true' configClasses (_x >> QGVAR(anims))); + }; +} forEach ('true' configClasses (configFile >> "CfgVehicles")); diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index 79f46ef753d..5931afe5dc2 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -456,6 +456,15 @@ class CfgVehicles { transportRepair = 0; }; + class Offroad_02_base_F: Car_F { + class EGVAR(interaction,anims) { + class hideSpareWheel { + selection = "spare_wheel"; + item = "ACE_Wheel"; + }; + }; + }; + class MRAP_01_base_F: Car_F { GVAR(hitpointGroups)[] = { {"HitGlass1", {"HitGlass2", "HitGlass3", "HitGlass4", "HitGlass5", "HitGlass6"}} }; }; @@ -492,4 +501,14 @@ class CfgVehicles { class Hatchback_01_base_F: Car_F { GVAR(hitpointPositions)[] = {{"HitBody", {0, 0.7, -0.5}}, {"HitFuel", {0, -1.75, -0.75}}}; }; + + class Truck_F: Car_F {}; + class Van_02_base_F: Truck_F { + class EGVAR(interaction,anims) { + class spare_tyre_hide { + position = "[-0.45,-3.5,-0.4]"; + item = "ACE_Wheel"; + }; + }; + }; }; diff --git a/optionals/compat_rhs_afrf3/CfgVehicles.hpp b/optionals/compat_rhs_afrf3/CfgVehicles.hpp index c1c3c73908b..d18fa7a1d47 100644 --- a/optionals/compat_rhs_afrf3/CfgVehicles.hpp +++ b/optionals/compat_rhs_afrf3/CfgVehicles.hpp @@ -52,10 +52,48 @@ class CfgVehicles { class rhs_bmp3tank_base: Tank_F { EGVAR(refuel,fuelCapacity) = 460; }; + class rhs_btr_base: Wheeled_APC_F { EGVAR(map,vehicleLightColor)[] = {0,0,1,0.1}; EGVAR(refuel,fuelCapacity) = 300; + class EGVAR(interaction,anims) { + class wheel_1_unhide { + position = "[-0.8,-2,0]"; + item = "ACE_Wheel"; + }; + class wheel_2_unhide { + position = "[0.5,-3.3,-0.3]"; + item = "ACE_Wheel"; + }; + }; + }; + class rhs_btr60_base: rhs_btr_base { + EGVAR(refuel,fuelCapacity) = 290; }; + class rhs_btr70_vmf: rhs_btr_base { + EGVAR(refuel,fuelCapacity) = 350; + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class wheel_1_unhide: wheel_1_unhide { + position = "[-1.2,-2.5,0.2]"; + }; + class wheel_2_unhide: wheel_2_unhide { + position = "[0,-4.2,0]"; + }; + }; + }; + class rhs_btr70_msv: rhs_btr70_vmf {}; + class rhs_btr80_msv: rhs_btr70_msv { + EGVAR(refuel,fuelCapacity) = 300; + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class wheel_1_unhide: wheel_1_unhide { + position = "[-1,-2.5,0.7]"; + }; + class wheel_2_unhide: wheel_2_unhide { + enabled = 0; + }; + }; + }; + class rhs_a3spruttank_base: Tank_F { EGVAR(refuel,fuelCapacity) = 400; }; @@ -209,6 +247,12 @@ class CfgVehicles { class Truck_F: Car_F {}; class RHS_Ural_BaseTurret: Truck_F { EGVAR(refuel,fuelCapacity) = 360; + class EGVAR(interaction,anims) { + class spare_hide { + selection = "spare"; + item = "ACE_Wheel"; + }; + }; }; class RHS_Ural_Base: RHS_Ural_BaseTurret {}; @@ -226,6 +270,12 @@ class CfgVehicles { class rhs_truck: Truck_F { EGVAR(refuel,fuelCapacity) = 210; + class EGVAR(interaction,anims) { + class spare_hide { + selection = "spare"; + item = "ACE_Wheel"; + }; + }; }; class rhs_gaz66_vmf: rhs_truck {}; @@ -239,14 +289,36 @@ class CfgVehicles { ace_rearm_defaultSupply = 1200; }; + class O_Truck_02_covered_F; + class rhs_kamaz5350: O_Truck_02_covered_F { + class EGVAR(interaction,anims) { + class spare_hide { + selection = "spare"; + item = "ACE_Wheel"; + }; + }; + }; + class MRAP_02_base_F; class rhs_tigr_base: MRAP_02_base_F { EGVAR(refuel,fuelCapacity) = 138; + class EGVAR(interaction,anims) { + class spare_hide { + selection = "spare"; + item = "ACE_Wheel"; + }; + }; }; class Offroad_01_base_f; class RHS_UAZ_Base: Offroad_01_base_f { EGVAR(refuel,fuelCapacity) = 78; + class EGVAR(interaction,anims) { + class spare_hide { + selection = "spare"; + item = "ACE_Wheel"; + }; + }; }; class APC_Tracked_02_base_F: Tank_F { @@ -259,18 +331,6 @@ class CfgVehicles { EGVAR(refuel,fuelCapacity) = 515; }; - class rhs_btr60_base: rhs_btr_base { - EGVAR(refuel,fuelCapacity) = 290; - }; - class rhs_btr70_vmf: rhs_btr_base { - EGVAR(refuel,fuelCapacity) = 350; - }; - - class rhs_btr70_msv: rhs_btr70_vmf {}; - class rhs_btr80_msv: rhs_btr70_msv { - EGVAR(refuel,fuelCapacity) = 300; - }; - class rhs_2s3tank_base: Tank_F { EGVAR(refuel,fuelCapacity) = 830; }; diff --git a/optionals/compat_rhs_afrf3/XEH_preInit.sqf b/optionals/compat_rhs_afrf3/XEH_preInit.sqf index b47cf6628db..d89d97a6e94 100644 --- a/optionals/compat_rhs_afrf3/XEH_preInit.sqf +++ b/optionals/compat_rhs_afrf3/XEH_preInit.sqf @@ -6,4 +6,6 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +RHS_Retread_Enabled = false; + ADDON = true; diff --git a/optionals/compat_rhs_usf3/CfgVehicles.hpp b/optionals/compat_rhs_usf3/CfgVehicles.hpp index 9e646f40ccd..13d1979eeee 100644 --- a/optionals/compat_rhs_usf3/CfgVehicles.hpp +++ b/optionals/compat_rhs_usf3/CfgVehicles.hpp @@ -232,8 +232,22 @@ class CfgVehicles { class Truck_01_base_F: Truck_F {}; class rhsusf_fmtv_base: Truck_01_base_F { EGVAR(refuel,fuelCapacity) = 219; + class EGVAR(interaction,anims) { + class hide_spare { + position = "[1,1.4,0]"; + item = "ACE_Wheel"; + }; + }; + }; + class rhsusf_M1078A1P2_fmtv_usarmy: rhsusf_fmtv_base {}; + class rhsusf_M1078A1P2_B_fmtv_usarmy: rhsusf_M1078A1P2_fmtv_usarmy {}; + class rhsusf_M1078A1P2_B_M2_fmtv_usarmy: rhsusf_M1078A1P2_B_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + position = "[1,1.4,-0.5]"; + }; + }; }; - class rhsusf_M1078A1P2_B_M2_fmtv_usarmy; class rhsusf_M1078A1R_SOV_M2_D_fmtv_socom: rhsusf_M1078A1P2_B_M2_fmtv_usarmy { transportAmmo = 0; EGVAR(rearm,defaultSupply) = 800; @@ -242,9 +256,51 @@ class CfgVehicles { EGVAR(refuel,fuelCargo) = 900; // 45 jerrycans transportRepair = 0; EGVAR(repair,canRepair) = 1; + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + position = "[1,1,0]"; + }; + }; + }; + class rhsusf_M1083A1P2_fmtv_usarmy: rhsusf_M1078A1P2_fmtv_usarmy {}; + class rhsusf_M1083A1P2_B_fmtv_usarmy: rhsusf_M1083A1P2_fmtv_usarmy {}; + class rhsusf_M1083A1P2_B_M2_fmtv_usarmy: rhsusf_M1083A1P2_B_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + position = "[1,1.4,-0.5]"; + }; + }; + }; + class rhsusf_M1084A1P2_fmtv_usarmy: rhsusf_M1083A1P2_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + position = "[1,1.8,0]"; + }; + }; + }; + class rhsusf_M1084A1P2_B_M2_fmtv_usarmy: rhsusf_M1083A1P2_B_M2_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + position = "[1,1.8,-0.5]"; + }; + }; + }; + class rhsusf_M1085A1P2_B_Medical_fmtv_usarmy: rhsusf_M1083A1P2_B_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + position = "[1,6.1,0]"; + }; + }; }; - class rhsusf_HEMTT_A4_base: Truck_01_base_F {}; + class rhsusf_HEMTT_A4_base: Truck_01_base_F { + class EGVAR(interaction,anims) { + class hide_spare { + position = "[1,2.2,2]"; + item = "ACE_Wheel"; + }; + }; + }; class rhsusf_M977A4_usarmy_wd: rhsusf_HEMTT_A4_base {}; class rhsusf_M977A4_AMMO_usarmy_wd: rhsusf_M977A4_usarmy_wd { transportAmmo = 0; @@ -257,7 +313,13 @@ class CfgVehicles { EGVAR(rearm,defaultSupply) = 1200; }; - class rhsusf_M977A4_BKIT_M2_usarmy_wd: rhsusf_M977A4_usarmy_wd {}; + class rhsusf_M977A4_BKIT_M2_usarmy_wd: rhsusf_M977A4_usarmy_wd { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + position = "[1,2.2,1.2]"; + }; + }; + }; class rhsusf_M977A4_AMMO_BKIT_M2_usarmy_wd: rhsusf_M977A4_BKIT_M2_usarmy_wd { transportAmmo = 0; EGVAR(rearm,defaultSupply) = 1200; From 019417aec38b997f6202e73f1fd729c5a7fdccd5 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Mon, 12 Feb 2018 12:32:38 +0300 Subject: [PATCH 02/23] Add setting --- addons/interaction/XEH_PREP.hpp | 2 +- addons/interaction/XEH_postInit.sqf | 2 -- addons/interaction/XEH_preInit.sqf | 2 ++ ...tAnimActions.sqf => fnc_switchAnimActions.sqf} | 15 +++++++++++---- addons/interaction/initSettings.sqf | 9 +++++++++ addons/interaction/stringtable.xml | 4 ++++ 6 files changed, 27 insertions(+), 7 deletions(-) rename addons/interaction/functions/{fnc_initAnimActions.sqf => fnc_switchAnimActions.sqf} (94%) create mode 100644 addons/interaction/initSettings.sqf diff --git a/addons/interaction/XEH_PREP.hpp b/addons/interaction/XEH_PREP.hpp index 91b3a329ca2..ec45261a7ab 100644 --- a/addons/interaction/XEH_PREP.hpp +++ b/addons/interaction/XEH_PREP.hpp @@ -42,5 +42,5 @@ PREP(openDoor); PREP(canPush); PREP(push); -PREP(initAnimActions); +PREP(switchAnimActions); PREP(switchLamp); diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index f0d884c712e..5d2b49f9b16 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -116,5 +116,3 @@ GVAR(isOpeningDoor) = false; }]; }; }] call CBA_fnc_addEventHandler; - -call FUNC(initAnimActions); diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index b47cf6628db..9361d05015e 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -6,4 +6,6 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +#include "initSettings.sqf" + ADDON = true; diff --git a/addons/interaction/functions/fnc_initAnimActions.sqf b/addons/interaction/functions/fnc_switchAnimActions.sqf similarity index 94% rename from addons/interaction/functions/fnc_initAnimActions.sqf rename to addons/interaction/functions/fnc_switchAnimActions.sqf index 8fd09f4149c..146f1b4baba 100644 --- a/addons/interaction/functions/fnc_initAnimActions.sqf +++ b/addons/interaction/functions/fnc_switchAnimActions.sqf @@ -1,20 +1,24 @@ /* * Author: Dystopian - * Initializes animation based interactions. + * Controls animation based interactions state. * * Arguments: - * None + * 0: Enabled * * Return Value: * None * * Example: - * call ace_interaction_fnc_initAnimActions + * true call ace_interaction_fnc_switchAnimActions * * Public: No */ #include "script_component.hpp" +params ["_enabled"]; + +if (!_enabled || {!isNil QGVAR(animActionsInitialized)}) exitWith {}; + private _statement = { params ["_target", "_player", "_params"]; _params params ["_anim", "_phase", "_items", "_duration"]; @@ -52,7 +56,8 @@ private _condition = { private _vehicleConfig = configFile >> "CfgVehicles" >> typeOf _target; private _animConfig = _vehicleConfig >> "AnimationSources" >> _anim; - isClass _animConfig + 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} && {_target animationPhase _anim != _phase} @@ -116,3 +121,5 @@ private _condition = { } forEach ('true' configClasses (_x >> QGVAR(anims))); }; } forEach ('true' configClasses (configFile >> "CfgVehicles")); + +GVAR(animActionsInitialized) = true; diff --git a/addons/interaction/initSettings.sqf b/addons/interaction/initSettings.sqf new file mode 100644 index 00000000000..3a64ea55ba5 --- /dev/null +++ b/addons/interaction/initSettings.sqf @@ -0,0 +1,9 @@ +[ + QGVAR(animActionsEnabled), + "CHECKBOX", + LSTRING(SettingAnimActionsName), + format ["ACE %1", localize LSTRING(DisplayName)], + true, + true, + LINKFUNC(switchAnimActions) +] call CBA_settings_fnc_init; diff --git a/addons/interaction/stringtable.xml b/addons/interaction/stringtable.xml index f1aa5944d0e..3a92230eb0c 100644 --- a/addons/interaction/stringtable.xml +++ b/addons/interaction/stringtable.xml @@ -1080,5 +1080,9 @@ 身体を引き出す Estrai il corpo + + Interaction with animations + Взаимодействие с анимациями + From eecc496c1d68937c8f23b826312100d9f89a0e33 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Mon, 12 Feb 2018 14:16:34 +0300 Subject: [PATCH 03/23] Add ability to set items for users --- .../functions/fnc_switchAnimActions.sqf | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/addons/interaction/functions/fnc_switchAnimActions.sqf b/addons/interaction/functions/fnc_switchAnimActions.sqf index 146f1b4baba..9e3f34648b1 100644 --- a/addons/interaction/functions/fnc_switchAnimActions.sqf +++ b/addons/interaction/functions/fnc_switchAnimActions.sqf @@ -21,14 +21,16 @@ if (!_enabled || {!isNil QGVAR(animActionsInitialized)}) exitWith {}; private _statement = { params ["_target", "_player", "_params"]; - _params params ["_anim", "_phase", "_items", "_duration"]; + _params params ["_anim", "_phase", "_duration"]; [ _duration, - [_target, _player, _anim, _phase, _items], + [_target, _player, _anim, _phase], { - (_this select 0) params ["_target", "_player", "_anim", "_phase", "_items"]; + (_this select 0) params ["_target", "_player", "_anim", "_phase"]; scopeName "main"; - if !(_items isEqualTo []) then { + private _items = _target getVariable [format [QGVAR(animsItem_%1), _anim], [configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(anims) >> _anim >> "item"] call BIS_fnc_getCfgData]; + if (!isNil "_items") then { + if (_items isEqualType "") then {_items = [_items]}; private _emptyPosAGL = [_target, _items select 0, _player] call EFUNC(common,findUnloadPosition); if (_emptyPosAGL isEqualTo []) then { [localize ELSTRING(common,NoRoomToUnload)] call EFUNC(common,displayTextStructured); @@ -99,19 +101,13 @@ private _condition = { 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 _items = [_x >> "item"] call BIS_fnc_getCfgData; - if (isNil "_items") then { - _items = []; - } else { - if (_items isEqualType "") then {_items = [_items]}; - }; 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, _items, _duration], + [_anim, _phase, _duration], _x ] call EFUNC(interact_menu,createAction); [_vehicle, 0, [], _action, _inherit] call EFUNC(interact_menu,addActionToClass); From 1e336e0532627a896126143dfdc72151ab0b517e Mon Sep 17 00:00:00 2001 From: Dystopian Date: Mon, 23 Apr 2018 00:05:34 +0300 Subject: [PATCH 04/23] Add actions for 1.82 changes Add actions for backpacks, canisters, entrench tool. Move items and backpack to WeaponHolder. --- addons/interaction/CfgVehicles.hpp | 104 ++++++++++++++++++ .../functions/fnc_switchAnimActions.sqf | 46 +++++--- addons/refuel/CfgVehicles.hpp | 30 +++++ addons/repair/CfgVehicles.hpp | 13 ++- addons/trenches/CfgVehicles.hpp | 33 ++++++ 5 files changed, 212 insertions(+), 14 deletions(-) diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 76d37d6d17e..247e86fb430 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -410,6 +410,39 @@ class CfgVehicles { }; }; + class Wheeled_APC_F; + class APC_Wheeled_01_base_F: Wheeled_APC_F { + class GVAR(anims) { + class showBags { + phase = 0; + //selection = "vhc_bags"; + position[] = {{-0.685,-2.863,0.218}, {0.685,-2.863,0.218}}; + item[] = {"B_Carryall_cbr", "B_Carryall_cbr"}; + }; + }; + }; + class APC_Wheeled_02_base_F: Wheeled_APC_F { + class GVAR(anims); + }; + class APC_Wheeled_02_base_v2_F: APC_Wheeled_02_base_F { + class GVAR(anims): GVAR(anims) { + class showBags { + phase = 0; + selection = "vhc_bags"; + item = "B_Carryall_cbr"; + }; + }; + }; + class APC_Wheeled_03_base_F: Wheeled_APC_F { + class GVAR(anims) { + class showBags { + phase = 0; + selection = "vhc_bags"; + item[] = {"B_Carryall_cbr", "B_Carryall_cbr"}; + }; + }; + }; + class Tank: LandVehicle { class ACE_Actions { class ACE_MainActions { @@ -437,6 +470,77 @@ class CfgVehicles { }; }; }; + class Tank_F; + class LT_01_base_F: Tank_F { + class GVAR(anims) { + class showBags { + phase = 0; + selection = "vhc_bags"; + item = "B_Carryall_cbr"; + }; + class showBags2: showBags { + selection = "vhc_bags2"; + }; + }; + }; + + class APC_Tracked_01_base_F: Tank_F { + class GVAR(anims); + }; + class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F { + class GVAR(anims):GVAR(anims) { + class showBags { + phase = 0; + selection = "vhc_bags"; + item[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; + }; + }; + }; + class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { + class GVAR(anims): GVAR(anims) { + class showBags: showBags { + item[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; + }; + }; + }; + + class APC_Tracked_02_base_F: Tank_F { + class GVAR(anims); + }; + class O_APC_Tracked_02_base_F: APC_Tracked_02_base_F {}; + class O_APC_Tracked_02_cannon_F: O_APC_Tracked_02_base_F { + class GVAR(anims): GVAR(anims) { + class showBags { + phase = 0; + selection = "vhc_bags"; + item[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; + }; + }; + }; + + class APC_Tracked_03_base_F: Tank_F { + class GVAR(anims) { + class showBags { + phase = 0; + selection = "vhc_bags"; + item[] = {"B_Carryall_cbr", "B_Carryall_cbr"}; + }; + }; + }; + + class MBT_01_base_F: Tank_F { + class GVAR(anims); + }; + class B_MBT_01_base_F: MBT_01_base_F {}; + class B_MBT_01_cannon_F: B_MBT_01_base_F { + class GVAR(anims): GVAR(anims) { + class showBags { + phase = 0; + selection = "vhc_bags"; + item[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; + }; + }; + }; class Motorcycle: LandVehicle { class ACE_Actions { diff --git a/addons/interaction/functions/fnc_switchAnimActions.sqf b/addons/interaction/functions/fnc_switchAnimActions.sqf index 9e3f34648b1..e5c92055704 100644 --- a/addons/interaction/functions/fnc_switchAnimActions.sqf +++ b/addons/interaction/functions/fnc_switchAnimActions.sqf @@ -22,13 +22,17 @@ if (!_enabled || {!isNil QGVAR(animActionsInitialized)}) exitWith {}; private _statement = { params ["_target", "_player", "_params"]; _params params ["_anim", "_phase", "_duration"]; + TRACE_5("statement",_target,_player,_anim,_phase,_duration); [ _duration, [_target, _player, _anim, _phase], { (_this select 0) params ["_target", "_player", "_anim", "_phase"]; scopeName "main"; - private _items = _target getVariable [format [QGVAR(animsItem_%1), _anim], [configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(anims) >> _anim >> "item"] call BIS_fnc_getCfgData]; + private _items = _target getVariable [ + format [QGVAR(animsItem_%1), _anim], + [configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(anims) >> _anim >> "item"] call BIS_fnc_getCfgData + ]; if (!isNil "_items") then { if (_items isEqualType "") then {_items = [_items]}; private _emptyPosAGL = [_target, _items select 0, _player] call EFUNC(common,findUnloadPosition); @@ -36,8 +40,25 @@ private _statement = { [localize ELSTRING(common,NoRoomToUnload)] call EFUNC(common,displayTextStructured); breakOut "main"; }; + private ["_weaponHolder"]; { - (createVehicle [_x, _emptyPosAGL, [], 0, "NONE"]) setPosASL (AGLtoASL _emptyPosAGL); + switch true do { + case (1 == getNumber (configFile >> "CfgVehicles" >> _x >> "isBackpack")): { + if (isNil "_weaponHolder") then { + _weaponHolder = createVehicle ["GroundWeaponHolder", _emptyPosAGL, [], 0, "CAN_COLLIDE"]; + }; + _weaponHolder addBackpackCargoGlobal [_x, 1]; + }; + case (getNumber (configfile >> "CfgWeapons" >> _x >> "type") in [4096,131072]): { + if (isNil "_weaponHolder") then { + _weaponHolder = createVehicle ["GroundWeaponHolder", _emptyPosAGL, [], 0, "CAN_COLLIDE"]; + }; + _weaponHolder addItemCargoGlobal [_x, 1]; + }; + default { + createVehicle [_x, _emptyPosAGL]; + }; + }; } forEach _items; }; _target animate [_anim, _phase, true]; @@ -79,23 +100,22 @@ private _condition = { || {_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 ("" == getText (_x >> "selection")) then { - ERROR_2("No action position for vehicle %1 anim %2",_vehicle,_anim); - breakTo "animLoop"; - } else { - _positions = [compile format [ - QUOTE(_target selectionPosition getText (configFile >> 'CfgVehicles' >> typeOf _target >> QQGVAR(anims) >> '%1' >> 'selection')), - _anim - ]]; - }; - } else { + 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"; + }; + _positions = [compile format [ + QUOTE(_target selectionPosition getText (configFile >> 'CfgVehicles' >> typeOf _target >> QQGVAR(anims) >> '%1' >> 'selection')), + _anim + ]]; }; private _phase = [_x >> "phase", "number", 1] call CBA_fnc_getConfigEntry; diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index cf4d590df87..ce9203da842 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -209,6 +209,18 @@ class CfgVehicles { // Patria = LAV GVAR(fuelCapacity) = 269; }; + class APC_Wheeled_02_base_F: Wheeled_APC_F { + class EGVAR(interaction,anims); + }; + class APC_Wheeled_02_base_v2_F: APC_Wheeled_02_base_F { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class showCanisters { + phase = 0; + position[] = {{-1.188,-3.87,-0.769}, {1.638,-3.87,-0.769}}; + item[] = {"Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F"}; + }; + }; + }; class Truck_F: Car_F { GVAR(fuelCapacity) = 400; @@ -286,12 +298,14 @@ class CfgVehicles { class MBT_01_base_F: Tank_F { // Merkava IV GVAR(fuelCapacity) = 1400; + class EGVAR(interaction,anims); }; class MBT_02_base_F: Tank_F { // T100 Black Eagle // Assuming T80 GVAR(fuelCapacity) = 1100; + class EGVAR(interaction,anims); }; class MBT_03_base_F: Tank_F { @@ -302,11 +316,27 @@ class CfgVehicles { class MBT_01_arty_base_F: MBT_01_base_F { // Assuming similar 2S3 GVAR(fuelCapacity) = 830; + + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class showCanisters { + phase = 0; + position[] = {{-2,-1.95,-1}, {2,-1.95,-1}, {1.7,-4.898,-0.4}}; + item[] = {"Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F"}; + }; + }; }; class MBT_02_arty_base_F: MBT_02_base_F { // Assuming similar 2S3 GVAR(fuelCapacity) = 830; + + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class showCanisters { + phase = 0; + position[] = {{1.7,-4.8,-0.5}}; + item = "Land_CanisterFuel_F"; + }; + }; }; class Heli_Light_02_base_F: Helicopter_Base_H { diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index 4fdb97d46ae..3ef116ca9d0 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -452,6 +452,17 @@ class CfgVehicles { GVAR(hitpointPositions)[] = {{"HitTurret", {0,-2,0}}}; }; + class Tank_F; + class APC_Tracked_02_base_F: Tank_F { + class EGVAR(interaction,anims) { + class showTracks { + phase = 0; + position[] = {{-1.7,-3.875,-0.7}, {1.7,-3.875,-0.7}}; + item[] = {"ACE_Track", "ACE_Track", "ACE_Track"}; + }; + }; + }; + class Car_F; class Offroad_01_base_F: Car_F {}; class Offroad_01_repair_base_F: Offroad_01_base_F { @@ -509,7 +520,7 @@ class CfgVehicles { class Van_02_base_F: Truck_F { class EGVAR(interaction,anims) { class spare_tyre_hide { - position = "[-0.45,-3.5,-0.4]"; + position[] = {{-0.45,-3.5,-0.4}}; item = "ACE_Wheel"; }; }; diff --git a/addons/trenches/CfgVehicles.hpp b/addons/trenches/CfgVehicles.hpp index 9c93e555ac1..16d92a22ffc 100644 --- a/addons/trenches/CfgVehicles.hpp +++ b/addons/trenches/CfgVehicles.hpp @@ -101,4 +101,37 @@ class CfgVehicles { MACRO_ADDITEM(ACE_EntrenchingTool,50); }; }; + + class Wheeled_APC_F; + class APC_Wheeled_02_base_F: Wheeled_APC_F { + class EGVAR(interaction,anims); + }; + class APC_Wheeled_02_base_v2_F: APC_Wheeled_02_base_F { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class showTools { + phase = 0; + position[] = {{-1.108,-1.47,-0.769}}; + item = "ACE_EntrenchingTool"; + }; + }; + }; + class APC_Wheeled_03_base_F: Wheeled_APC_F { + class EGVAR(interaction,anims) { + class showTools { + phase = 0; + position[] = {{-0.9,-3,-0.5}}; + item = "ACE_EntrenchingTool"; + }; + }; + }; + class Tank_F; + class LT_01_base_F: Tank_F { + class EGVAR(interaction,anims) { + class showTools { + phase = 0; + position[] = {{0.6,0,-0.3}}; + item = "ACE_EntrenchingTool"; + }; + }; + }; }; From a9067c57beff194dc6030aa58eb3552b50f827f9 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Wed, 15 Aug 2018 01:09:50 +0300 Subject: [PATCH 05/23] Add RHS 0.4.6 ZIL spare --- optionals/compat_rhs_afrf3/CfgVehicles.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/optionals/compat_rhs_afrf3/CfgVehicles.hpp b/optionals/compat_rhs_afrf3/CfgVehicles.hpp index 03f6872b235..4a38e99fd3d 100644 --- a/optionals/compat_rhs_afrf3/CfgVehicles.hpp +++ b/optionals/compat_rhs_afrf3/CfgVehicles.hpp @@ -261,6 +261,15 @@ class CfgVehicles { }; }; + class rhs_zil131_base: Truck_F { + class EGVAR(interaction,anims) { + class spare_hide { + selection = "spare"; + item = "ACE_Wheel"; + }; + }; + }; + class APC_Tracked_02_base_F: Tank_F { class Turrets: Turrets { class MainTurret: MainTurret {}; From 70d7c9ea49f659b23f96b4413d10348128d9e4c4 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Wed, 19 Sep 2018 20:54:19 +0300 Subject: [PATCH 06/23] Update to new standards --- addons/interaction/functions/fnc_switchAnimActions.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/interaction/functions/fnc_switchAnimActions.sqf b/addons/interaction/functions/fnc_switchAnimActions.sqf index e5c92055704..59fa4d49fef 100644 --- a/addons/interaction/functions/fnc_switchAnimActions.sqf +++ b/addons/interaction/functions/fnc_switchAnimActions.sqf @@ -1,3 +1,4 @@ +#include "script_component.hpp" /* * Author: Dystopian * Controls animation based interactions state. @@ -13,7 +14,6 @@ * * Public: No */ -#include "script_component.hpp" params ["_enabled"]; @@ -49,7 +49,7 @@ private _statement = { }; _weaponHolder addBackpackCargoGlobal [_x, 1]; }; - case (getNumber (configfile >> "CfgWeapons" >> _x >> "type") in [4096,131072]): { + case (getNumber (configfile >> "CfgWeapons" >> _x >> "type") in [TYPE_BINOCULAR_AND_NVG,TYPE_ITEM]): { if (isNil "_weaponHolder") then { _weaponHolder = createVehicle ["GroundWeaponHolder", _emptyPosAGL, [], 0, "CAN_COLLIDE"]; }; From 5c2ced161cf5f58d2218f08de4139750069d6478 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Wed, 19 Sep 2018 21:21:11 +0300 Subject: [PATCH 07/23] Handle RHS BTR retread system --- optionals/compat_rhs_afrf3/XEH_preInit.sqf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/optionals/compat_rhs_afrf3/XEH_preInit.sqf b/optionals/compat_rhs_afrf3/XEH_preInit.sqf index d89d97a6e94..69f9477712f 100644 --- a/optionals/compat_rhs_afrf3/XEH_preInit.sqf +++ b/optionals/compat_rhs_afrf3/XEH_preInit.sqf @@ -7,5 +7,8 @@ PREP_RECOMPILE_START; PREP_RECOMPILE_END; RHS_Retread_Enabled = false; +rhs_btr70_EnableRetread = false; +rhs_TypeTirePressure = 1; +RHS_BTR_Effects_Init = true; ADDON = true; From 30dfa0e94581204256ac3bef7ed4e732a002dc4a Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sun, 23 Sep 2018 16:12:52 +0300 Subject: [PATCH 08/23] Make init faster: move condition to configClasses --- .../functions/fnc_switchAnimActions.sqf | 86 +++++++++---------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/addons/interaction/functions/fnc_switchAnimActions.sqf b/addons/interaction/functions/fnc_switchAnimActions.sqf index 59fa4d49fef..3128a6de351 100644 --- a/addons/interaction/functions/fnc_switchAnimActions.sqf +++ b/addons/interaction/functions/fnc_switchAnimActions.sqf @@ -88,54 +88,52 @@ private _condition = { }; { - 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')), _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("",_vehicle,_anim,_x); + } forEach _positions; + }; + } forEach ('true' configClasses (_x >> QGVAR(anims))); +} forEach (QUOTE(isClass (_x >> QQGVAR(anims))) configClasses (configFile >> "CfgVehicles")); GVAR(animActionsInitialized) = true; From bc7a2e4afc5db023d6c1f2a8282bd49a6bfb3388 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sun, 23 Sep 2018 16:43:38 +0300 Subject: [PATCH 09/23] Fix CUP fake anims --- addons/interaction/functions/fnc_switchAnimActions.sqf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/interaction/functions/fnc_switchAnimActions.sqf b/addons/interaction/functions/fnc_switchAnimActions.sqf index 3128a6de351..5bc1c6302a9 100644 --- a/addons/interaction/functions/fnc_switchAnimActions.sqf +++ b/addons/interaction/functions/fnc_switchAnimActions.sqf @@ -81,8 +81,9 @@ 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)} }; @@ -130,7 +131,7 @@ private _condition = { _x ] call EFUNC(interact_menu,createAction); [_vehicle, 0, [], _action, _inherit] call EFUNC(interact_menu,addActionToClass); - TRACE_3("",_vehicle,_anim,_x); + TRACE_3("add anim",_vehicle,_anim,_x); } forEach _positions; }; } forEach ('true' configClasses (_x >> QGVAR(anims))); From d0f3aa5bc67525ba1416f87d65090e9a794c33df Mon Sep 17 00:00:00 2001 From: Dystopian Date: Fri, 23 Apr 2021 18:23:43 +0300 Subject: [PATCH 10/23] Refactor --- .../functions/fnc_switchAnimActions.sqf | 88 ++++++++++--------- 1 file changed, 46 insertions(+), 42 deletions(-) diff --git a/addons/interaction/functions/fnc_switchAnimActions.sqf b/addons/interaction/functions/fnc_switchAnimActions.sqf index 5bc1c6302a9..ae30cdce4e9 100644 --- a/addons/interaction/functions/fnc_switchAnimActions.sqf +++ b/addons/interaction/functions/fnc_switchAnimActions.sqf @@ -28,17 +28,17 @@ private _statement = { [_target, _player, _anim, _phase], { (_this select 0) params ["_target", "_player", "_anim", "_phase"]; - scopeName "main"; private _items = _target getVariable [ format [QGVAR(animsItem_%1), _anim], - [configFile >> "CfgVehicles" >> typeOf _target >> QGVAR(anims) >> _anim >> "item"] call BIS_fnc_getCfgData + [configOf _target >> QGVAR(anims) >> _anim >> "item"] call BIS_fnc_getCfgData ]; + private _success = true; if (!isNil "_items") then { if (_items isEqualType "") then {_items = [_items]}; private _emptyPosAGL = [_target, _items select 0, _player] call EFUNC(common,findUnloadPosition); - if (_emptyPosAGL isEqualTo []) then { - [localize ELSTRING(common,NoRoomToUnload)] call EFUNC(common,displayTextStructured); - breakOut "main"; + if (_emptyPosAGL isEqualTo []) exitWith { + [LELSTRING(common,NoRoomToUnload)] call EFUNC(common,displayTextStructured); + _success = false; }; private ["_weaponHolder"]; { @@ -61,6 +61,7 @@ private _statement = { }; } forEach _items; }; + if (!_success) exitWith {}; _target animate [_anim, _phase, true]; }, {}, @@ -76,13 +77,13 @@ private _statement = { private _condition = { params ["_target", "_player", "_params"]; _params params ["_anim", "_phase"]; - private _vehicleConfig = configFile >> "CfgVehicles" >> typeOf _target; + private _vehicleConfig = configOf _target; private _animConfig = _vehicleConfig >> "AnimationSources" >> _anim; GVAR(animActionsEnabled) && {isClass _animConfig} && {0 != [_animConfig >> "scope", "number", 1] call CBA_fnc_getConfigEntry} // anim hidden - && {isNumber (_animConfig >> "initPhase")} // anim correct - CUP inherits and clears some + && {isNumber (_animConfig >> "initPhase")} // anim correct (some CUP anims are inherited and cleared) && {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)} @@ -92,48 +93,51 @@ private _condition = { private _vehicleConfig = _x; private _vehicle = configName _vehicleConfig; { - scopeName "animLoop"; - private _anim = configName _x; + private _animConfig = _x; + private _anim = configName _animConfig; 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"; - }; + isClass _animConfigParent + && { + _animConfig == _animConfigParent + || {0 != [_animConfigParent >> "inherit", "number", 1] call CBA_fnc_getConfigEntry} + } + ) then {continue}; + + private _positions = [_animConfig >> "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 (configOf _target >> QQGVAR(anims) >> '%1' >> 'position')), _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("add anim",_vehicle,_anim,_x); - } forEach _positions; + } else { + if (getText (_animConfig >> "selection") == "") then { + ERROR_2("No action position for vehicle %1 anim %2",_vehicle,_anim); + continue; + }; + _positions = [compile format [ + QUOTE(_target selectionPosition getText (configOf _target >> QQGVAR(anims) >> '%1' >> 'selection')), + _anim + ]]; }; + + private _phase = [_animConfig >> "phase", "number", 1] call CBA_fnc_getConfigEntry; + private _name = [_animConfig >> "name", "text", localize "str_a3_cfgactions_unmountitem0"] call CBA_fnc_getConfigEntry; + private _icon = [_animConfig >> "icon", "text", "\A3\ui_f\data\igui\cfg\actions\take_ca.paa"] call CBA_fnc_getConfigEntry; + private _duration = [_animConfig >> "duration", "number", 10] call CBA_fnc_getConfigEntry; + private _inherit = 0 != [_animConfig >> "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")); From 724d127533b875491a46a11d3ea472d329c5f787 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sun, 25 Apr 2021 11:35:23 +0300 Subject: [PATCH 11/23] Rework --- addons/interaction/CfgVehicles.hpp | 42 +++---- addons/interaction/XEH_PREP.hpp | 2 +- addons/interaction/XEH_postInit.sqf | 5 + addons/interaction/XEH_preInit.sqf | 4 + .../functions/fnc_switchAnimActions.sqf | 113 ++++++++---------- addons/interaction/initSettings.sqf | 3 +- addons/refuel/CfgVehicles.hpp | 12 +- addons/repair/CfgVehicles.hpp | 12 +- addons/trenches/CfgVehicles.hpp | 12 +- optionals/compat_rhs_afrf3/CfgVehicles.hpp | 38 +++--- optionals/compat_rhs_usf3/CfgVehicles.hpp | 28 ++--- 11 files changed, 132 insertions(+), 139 deletions(-) diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index 091d171d6dc..185edd9cc61 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -362,8 +362,8 @@ class CfgVehicles { class Offroad_01_base_F: Car_F { class GVAR(anims) { class HideBackpacks { - position[] = {{-1.15,-1.15,-0.2}, {1.1,-1.15,-0.2}, {1.1,-2.5,-0.2}}; - item[] = {"B_TacticalPack_blk", "B_TacticalPack_blk", "B_Carryall_khk", "B_Carryall_khk"}; + positions[] = {{-1.15,-1.15,-0.2}, {1.1,-1.15,-0.2}, {1.1,-2.5,-0.2}}; + items[] = {"B_TacticalPack_blk", "B_TacticalPack_blk", "B_Carryall_khk", "B_Carryall_khk"}; }; }; }; @@ -406,8 +406,8 @@ class CfgVehicles { class showBags { phase = 0; //selection = "vhc_bags"; - position[] = {{-0.685,-2.863,0.218}, {0.685,-2.863,0.218}}; - item[] = {"B_Carryall_cbr", "B_Carryall_cbr"}; + positions[] = {{-0.685,-2.863,0.218}, {0.685,-2.863,0.218}}; + items[] = {"B_Carryall_cbr", "B_Carryall_cbr"}; }; }; }; @@ -418,8 +418,8 @@ class CfgVehicles { class GVAR(anims): GVAR(anims) { class showBags { phase = 0; - selection = "vhc_bags"; - item = "B_Carryall_cbr"; + selections[] = {"vhc_bags"}; + items[] = {"B_Carryall_cbr"}; }; }; }; @@ -427,8 +427,8 @@ class CfgVehicles { class GVAR(anims) { class showBags { phase = 0; - selection = "vhc_bags"; - item[] = {"B_Carryall_cbr", "B_Carryall_cbr"}; + selections[] = {"vhc_bags"}; + items[] = {"B_Carryall_cbr", "B_Carryall_cbr"}; }; }; }; @@ -465,11 +465,11 @@ class CfgVehicles { class GVAR(anims) { class showBags { phase = 0; - selection = "vhc_bags"; - item = "B_Carryall_cbr"; + selections[] = {"vhc_bags"}; + items[] = {"B_Carryall_cbr"}; }; class showBags2: showBags { - selection = "vhc_bags2"; + selections[] = {"vhc_bags2"}; }; }; }; @@ -478,18 +478,18 @@ class CfgVehicles { class GVAR(anims); }; class B_APC_Tracked_01_base_F: APC_Tracked_01_base_F { - class GVAR(anims):GVAR(anims) { + class GVAR(anims): GVAR(anims) { class showBags { phase = 0; - selection = "vhc_bags"; - item[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; + selections[] = {"vhc_bags"}; + items[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; }; }; }; class B_APC_Tracked_01_CRV_F: B_APC_Tracked_01_base_F { class GVAR(anims): GVAR(anims) { class showBags: showBags { - item[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; + items[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; }; }; }; @@ -502,8 +502,8 @@ class CfgVehicles { class GVAR(anims): GVAR(anims) { class showBags { phase = 0; - selection = "vhc_bags"; - item[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; + selections[] = {"vhc_bags"}; + items[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; }; }; }; @@ -512,8 +512,8 @@ class CfgVehicles { class GVAR(anims) { class showBags { phase = 0; - selection = "vhc_bags"; - item[] = {"B_Carryall_cbr", "B_Carryall_cbr"}; + selections[] = {"vhc_bags"}; + items[] = {"B_Carryall_cbr", "B_Carryall_cbr"}; }; }; }; @@ -526,8 +526,8 @@ class CfgVehicles { class GVAR(anims): GVAR(anims) { class showBags { phase = 0; - selection = "vhc_bags"; - item[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; + selections[] = {"vhc_bags"}; + items[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; }; }; }; diff --git a/addons/interaction/XEH_PREP.hpp b/addons/interaction/XEH_PREP.hpp index 15af87ed9b2..828a833ce01 100644 --- a/addons/interaction/XEH_PREP.hpp +++ b/addons/interaction/XEH_PREP.hpp @@ -49,4 +49,4 @@ PREP(canPush); PREP(push); PREP(canFlip); -PREP(switchAnimActions); +PREP(initAnimActions); diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 933cead137b..c2b7168ce12 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -141,3 +141,8 @@ GVAR(isOpeningDoor) = false; [QGVAR(clearWeaponAttachmentsActionsCache)] call CBA_fnc_localEvent; }] call CBA_fnc_addPlayerEventHandler; } forEach ["loadout", "weapon"]; + +{ + if (count (inheritsFrom _x >> QGVAR(anims)) > 0) then {continue}; + [configName _x, "initPost", {_this call FUNC(initAnimActions)}, true, [], true] call CBA_fnc_addClassEventHandler; +} forEach (QUOTE(count (_x >> QQGVAR(anims)) > 0) configClasses (configFile >> "CfgVehicles")); diff --git a/addons/interaction/XEH_preInit.sqf b/addons/interaction/XEH_preInit.sqf index 855d651d556..ced53e4311a 100644 --- a/addons/interaction/XEH_preInit.sqf +++ b/addons/interaction/XEH_preInit.sqf @@ -15,4 +15,8 @@ DFUNC(repair_Statement) = { // moved from config because of build problems } forEach (curatorSelected select 0) }; +if (hasInterface) then { + GVAR(initializedAnimClasses) = []; +}; + ADDON = true; diff --git a/addons/interaction/functions/fnc_switchAnimActions.sqf b/addons/interaction/functions/fnc_switchAnimActions.sqf index ae30cdce4e9..241f729edcb 100644 --- a/addons/interaction/functions/fnc_switchAnimActions.sqf +++ b/addons/interaction/functions/fnc_switchAnimActions.sqf @@ -1,23 +1,25 @@ #include "script_component.hpp" /* * Author: Dystopian - * Controls animation based interactions state. + * Initializes object interactions based on animations. * * Arguments: - * 0: Enabled + * 0: Target * * Return Value: * None * * Example: - * true call ace_interaction_fnc_switchAnimActions + * cursorObject call ace_interaction_fnc_initAnimActions * * Public: No */ -params ["_enabled"]; +params ["_object"]; -if (!_enabled || {!isNil QGVAR(animActionsInitialized)}) exitWith {}; +private _class = typeOf _object; +if (!GVAR(animActionsEnabled) || {_class in GVAR(initializedAnimClasses)}) exitWith {}; +GVAR(initializedAnimClasses) pushBack _class; private _statement = { params ["_target", "_player", "_params"]; @@ -29,11 +31,11 @@ private _statement = { { (_this select 0) params ["_target", "_player", "_anim", "_phase"]; private _items = _target getVariable [ - format [QGVAR(animsItem_%1), _anim], - [configOf _target >> QGVAR(anims) >> _anim >> "item"] call BIS_fnc_getCfgData + format [QGVAR(animsItems_%1), _anim], + getArray (configOf _target >> QGVAR(anims) >> _anim >> "items") ]; private _success = true; - if (!isNil "_items") then { + if (_items isNotEqualTo []) then { if (_items isEqualType "") then {_items = [_items]}; private _emptyPosAGL = [_target, _items select 0, _player] call EFUNC(common,findUnloadPosition); if (_emptyPosAGL isEqualTo []) exitWith { @@ -49,7 +51,7 @@ private _statement = { }; _weaponHolder addBackpackCargoGlobal [_x, 1]; }; - case (getNumber (configfile >> "CfgWeapons" >> _x >> "type") in [TYPE_BINOCULAR_AND_NVG,TYPE_ITEM]): { + case (getNumber (configfile >> "CfgWeapons" >> _x >> "type") in [TYPE_BINOCULAR_AND_NVG, TYPE_ITEM]): { if (isNil "_weaponHolder") then { _weaponHolder = createVehicle ["GroundWeaponHolder", _emptyPosAGL, [], 0, "CAN_COLLIDE"]; }; @@ -77,68 +79,55 @@ private _statement = { private _condition = { params ["_target", "_player", "_params"]; _params params ["_anim", "_phase"]; - private _vehicleConfig = configOf _target; - private _animConfig = _vehicleConfig >> "AnimationSources" >> _anim; GVAR(animActionsEnabled) - && {isClass _animConfig} - && {0 != [_animConfig >> "scope", "number", 1] call CBA_fnc_getConfigEntry} // anim hidden - && {isNumber (_animConfig >> "initPhase")} // anim correct (some CUP anims are inherited and cleared) - && {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)} }; +private _config = configOf _object; + { - private _vehicleConfig = _x; - private _vehicle = configName _vehicleConfig; - { - private _animConfig = _x; - private _anim = configName _animConfig; - private _animConfigParent = inheritsFrom _vehicleConfig >> QGVAR(anims) >> _anim; - if ( - isClass _animConfigParent - && { - _animConfig == _animConfigParent - || {0 != [_animConfigParent >> "inherit", "number", 1] call CBA_fnc_getConfigEntry} - } - ) then {continue}; + private _animConfig = _x; + private _anim = configName _animConfig; - private _positions = [_animConfig >> "position"] call BIS_fnc_getCfgData; - if (!isNil "_positions") then { - if (_positions isEqualType "") then { - _positions = [compile format [ - QUOTE(call compile getText (configOf _target >> QQGVAR(anims) >> '%1' >> 'position')), - _anim - ]]; - }; + private _animationSourcesConfig = _config >> "AnimationSources" >> _anim; + + if !( + isClass _animationSourcesConfig // anim exist + && {0 != [_animationSourcesConfig >> "scope", "number", 1] call CBA_fnc_getConfigEntry} // anim not hidden + && {isNumber (_animationSourcesConfig >> "initPhase")} // anim correct (some CUP anims are inherited and cleared) + && {0 != [_animConfig >> "enabled", "number", 1] call CBA_fnc_getConfigEntry} // anim enabled + ) then {continue}; + + private _positions = []; + { + if (_x isEqualType "") then { + _positions pushBack compile _x; } else { - if (getText (_animConfig >> "selection") == "") then { - ERROR_2("No action position for vehicle %1 anim %2",_vehicle,_anim); - continue; - }; - _positions = [compile format [ - QUOTE(_target selectionPosition getText (configOf _target >> QQGVAR(anims) >> '%1' >> 'selection')), - _anim - ]]; + _positions pushBack _x; }; + } forEach getArray (_animConfig >> "positions"); - private _phase = [_animConfig >> "phase", "number", 1] call CBA_fnc_getConfigEntry; - private _name = [_animConfig >> "name", "text", localize "str_a3_cfgactions_unmountitem0"] call CBA_fnc_getConfigEntry; - private _icon = [_animConfig >> "icon", "text", "\A3\ui_f\data\igui\cfg\actions\take_ca.paa"] call CBA_fnc_getConfigEntry; - private _duration = [_animConfig >> "duration", "number", 10] call CBA_fnc_getConfigEntry; - private _inherit = 0 != [_animConfig >> "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")); + _positions append getArray (_animConfig >> "selections"); -GVAR(animActionsInitialized) = true; + if (_positions isEqualTo []) then { + ERROR_2("No action position for _class %1 anim %2",_class,_anim); + continue; + }; + + private _phase = [_animConfig >> "phase", "number", 1] call CBA_fnc_getConfigEntry; + private _name = [_animConfig >> "name", "text", localize "str_a3_cfgactions_unmountitem0"] call CBA_fnc_getConfigEntry; + private _icon = [_animConfig >> "icon", "text", "\A3\ui_f\data\igui\cfg\actions\take_ca.paa"] call CBA_fnc_getConfigEntry; + private _duration = [_animConfig >> "duration", "number", 10] call CBA_fnc_getConfigEntry; + { + private _action = [ + format [QGVAR(anim_%1_%2), _anim, _forEachIndex], + _name, _icon, _statement, _condition, {}, + [_anim, _phase, _duration], + _x + ] call EFUNC(interact_menu,createAction); + [_class, 0, [], _action] call EFUNC(interact_menu,addActionToClass); + TRACE_3("add anim",_class,_anim,_x); + } forEach _positions; +} forEach configProperties [_config >> QGVAR(anims), "isClass _x"]; diff --git a/addons/interaction/initSettings.sqf b/addons/interaction/initSettings.sqf index 603378d9a58..77838ae5645 100644 --- a/addons/interaction/initSettings.sqf +++ b/addons/interaction/initSettings.sqf @@ -36,5 +36,6 @@ format ["ACE %1", LLSTRING(DisplayName)], true, true, - LINKFUNC(switchAnimActions) + {}, + true ] call CBA_fnc_addSetting; diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index d9641568005..2faf1f3ad9e 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -216,8 +216,8 @@ class CfgVehicles { class EGVAR(interaction,anims): EGVAR(interaction,anims) { class showCanisters { phase = 0; - position[] = {{-1.188,-3.87,-0.769}, {1.638,-3.87,-0.769}}; - item[] = {"Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F"}; + positions[] = {{-1.188,-3.87,-0.769}, {1.638,-3.87,-0.769}}; + items[] = {"Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F"}; }; }; }; @@ -320,8 +320,8 @@ class CfgVehicles { class EGVAR(interaction,anims): EGVAR(interaction,anims) { class showCanisters { phase = 0; - position[] = {{-2,-1.95,-1}, {2,-1.95,-1}, {1.7,-4.898,-0.4}}; - item[] = {"Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F"}; + positions[] = {{-2,-1.95,-1}, {2,-1.95,-1}, {1.7,-4.898,-0.4}}; + items[] = {"Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F"}; }; }; }; @@ -333,8 +333,8 @@ class CfgVehicles { class EGVAR(interaction,anims): EGVAR(interaction,anims) { class showCanisters { phase = 0; - position[] = {{1.7,-4.8,-0.5}}; - item = "Land_CanisterFuel_F"; + positions[] = {{1.7,-4.8,-0.5}}; + items[] = {"Land_CanisterFuel_F"}; }; }; }; diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index 9409fc3f8b8..9837e3ce448 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -457,8 +457,8 @@ class CfgVehicles { class EGVAR(interaction,anims) { class showTracks { phase = 0; - position[] = {{-1.7,-3.875,-0.7}, {1.7,-3.875,-0.7}}; - item[] = {"ACE_Track", "ACE_Track", "ACE_Track"}; + positions[] = {{-1.7,-3.875,-0.7}, {1.7,-3.875,-0.7}}; + items[] = {"ACE_Track", "ACE_Track", "ACE_Track"}; }; }; }; @@ -475,8 +475,8 @@ class CfgVehicles { class Offroad_02_base_F: Car_F { class EGVAR(interaction,anims) { class hideSpareWheel { - selection = "spare_wheel"; - item = "ACE_Wheel"; + selections[] = {"spare_wheel"}; + items[] = {"ACE_Wheel"}; }; }; }; @@ -532,8 +532,8 @@ class CfgVehicles { class Van_02_base_F: Truck_F { class EGVAR(interaction,anims) { class spare_tyre_hide { - position[] = {{-0.45,-3.5,-0.4}}; - item = "ACE_Wheel"; + positions[] = {{-0.45,-3.5,-0.4}}; + items[] = {"ACE_Wheel"}; }; }; }; diff --git a/addons/trenches/CfgVehicles.hpp b/addons/trenches/CfgVehicles.hpp index 9b861a1c568..4130ce1127c 100644 --- a/addons/trenches/CfgVehicles.hpp +++ b/addons/trenches/CfgVehicles.hpp @@ -106,8 +106,8 @@ class CfgVehicles { class EGVAR(interaction,anims): EGVAR(interaction,anims) { class showTools { phase = 0; - position[] = {{-1.108,-1.47,-0.769}}; - item = "ACE_EntrenchingTool"; + positions[] = {{-1.108,-1.47,-0.769}}; + items[] = {"ACE_EntrenchingTool"}; }; }; }; @@ -115,8 +115,8 @@ class CfgVehicles { class EGVAR(interaction,anims) { class showTools { phase = 0; - position[] = {{-0.9,-3,-0.5}}; - item = "ACE_EntrenchingTool"; + positions[] = {{-0.9,-3,-0.5}}; + items[] = {"ACE_EntrenchingTool"}; }; }; }; @@ -125,8 +125,8 @@ class CfgVehicles { class EGVAR(interaction,anims) { class showTools { phase = 0; - position[] = {{0.6,0,-0.3}}; - item = "ACE_EntrenchingTool"; + positions[] = {{0.6,0,-0.3}}; + items[] = {"ACE_EntrenchingTool"}; }; }; }; diff --git a/optionals/compat_rhs_afrf3/CfgVehicles.hpp b/optionals/compat_rhs_afrf3/CfgVehicles.hpp index 39060189d54..9b9ac185123 100644 --- a/optionals/compat_rhs_afrf3/CfgVehicles.hpp +++ b/optionals/compat_rhs_afrf3/CfgVehicles.hpp @@ -58,12 +58,12 @@ class CfgVehicles { EGVAR(refuel,fuelCapacity) = 300; class EGVAR(interaction,anims) { class wheel_1_unhide { - position = "[-0.8,-2,0]"; - item = "ACE_Wheel"; + positions[] = {{-0.8,-2,0}}; + items[] = {"ACE_Wheel"}; }; class wheel_2_unhide { - position = "[0.5,-3.3,-0.3]"; - item = "ACE_Wheel"; + positions[] = {{0.5,-3.3,-0.3}}; + items[] = {"ACE_Wheel"}; }; }; }; @@ -74,10 +74,10 @@ class CfgVehicles { EGVAR(refuel,fuelCapacity) = 350; class EGVAR(interaction,anims): EGVAR(interaction,anims) { class wheel_1_unhide: wheel_1_unhide { - position = "[-1.2,-2.5,0.2]"; + positions[] = {{-1.2,-2.5,0.2}}; }; class wheel_2_unhide: wheel_2_unhide { - position = "[0,-4.2,0]"; + positions[] = {{0,-4.2,0}}; }; }; }; @@ -86,7 +86,7 @@ class CfgVehicles { EGVAR(refuel,fuelCapacity) = 300; class EGVAR(interaction,anims): EGVAR(interaction,anims) { class wheel_1_unhide: wheel_1_unhide { - position = "[-1,-2.5,0.7]"; + positions[] = {{-1,-2.5,0.7}}; }; class wheel_2_unhide: wheel_2_unhide { enabled = 0; @@ -189,8 +189,8 @@ class CfgVehicles { EGVAR(refuel,fuelCapacity) = 360; class EGVAR(interaction,anims) { class spare_hide { - selection = "spare"; - item = "ACE_Wheel"; + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; }; }; }; @@ -212,8 +212,8 @@ class CfgVehicles { EGVAR(refuel,fuelCapacity) = 210; class EGVAR(interaction,anims) { class spare_hide { - selection = "spare"; - item = "ACE_Wheel"; + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; }; }; }; @@ -233,8 +233,8 @@ class CfgVehicles { class rhs_kamaz5350: O_Truck_02_covered_F { class EGVAR(interaction,anims) { class spare_hide { - selection = "spare"; - item = "ACE_Wheel"; + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; }; }; }; @@ -244,8 +244,8 @@ class CfgVehicles { EGVAR(refuel,fuelCapacity) = 138; class EGVAR(interaction,anims) { class spare_hide { - selection = "spare"; - item = "ACE_Wheel"; + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; }; }; }; @@ -255,8 +255,8 @@ class CfgVehicles { EGVAR(refuel,fuelCapacity) = 78; class EGVAR(interaction,anims) { class spare_hide { - selection = "spare"; - item = "ACE_Wheel"; + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; }; }; }; @@ -264,8 +264,8 @@ class CfgVehicles { class rhs_zil131_base: Truck_F { class EGVAR(interaction,anims) { class spare_hide { - selection = "spare"; - item = "ACE_Wheel"; + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; }; }; }; diff --git a/optionals/compat_rhs_usf3/CfgVehicles.hpp b/optionals/compat_rhs_usf3/CfgVehicles.hpp index f3d0eefbfcf..6316452f3ca 100644 --- a/optionals/compat_rhs_usf3/CfgVehicles.hpp +++ b/optionals/compat_rhs_usf3/CfgVehicles.hpp @@ -199,8 +199,8 @@ class CfgVehicles { EGVAR(refuel,fuelCapacity) = 219; class EGVAR(interaction,anims) { class hide_spare { - position = "[1,1.4,0]"; - item = "ACE_Wheel"; + positions[] = {{1,1.4,0}}; + items[] = {"ACE_Wheel"}; }; }; }; @@ -209,7 +209,7 @@ class CfgVehicles { class rhsusf_M1078A1P2_B_M2_fmtv_usarmy: rhsusf_M1078A1P2_B_fmtv_usarmy { class EGVAR(interaction,anims): EGVAR(interaction,anims) { class hide_spare: hide_spare { - position = "[1,1.4,-0.5]"; + positions[] = {{1,1.4,-0.5}}; }; }; }; @@ -223,7 +223,7 @@ class CfgVehicles { EGVAR(repair,canRepair) = 1; class EGVAR(interaction,anims): EGVAR(interaction,anims) { class hide_spare: hide_spare { - position = "[1,1,0]"; + positions[] = {{1,1,0}}; }; }; }; @@ -232,28 +232,28 @@ class CfgVehicles { class rhsusf_M1083A1P2_B_M2_fmtv_usarmy: rhsusf_M1083A1P2_B_fmtv_usarmy { class EGVAR(interaction,anims): EGVAR(interaction,anims) { class hide_spare: hide_spare { - position = "[1,1.4,-0.5]"; + positions[] = {{1,1.4,-0.5}}; }; }; }; class rhsusf_M1084A1P2_fmtv_usarmy: rhsusf_M1083A1P2_fmtv_usarmy { class EGVAR(interaction,anims): EGVAR(interaction,anims) { class hide_spare: hide_spare { - position = "[1,1.8,0]"; + positions[] = {{1,1.8,0}}; }; }; }; class rhsusf_M1084A1P2_B_M2_fmtv_usarmy: rhsusf_M1083A1P2_B_M2_fmtv_usarmy { class EGVAR(interaction,anims): EGVAR(interaction,anims) { class hide_spare: hide_spare { - position = "[1,1.8,-0.5]"; + positions[] = {{1,1.8,-0.5}}; }; }; }; class rhsusf_M1085A1P2_B_Medical_fmtv_usarmy: rhsusf_M1083A1P2_B_fmtv_usarmy { class EGVAR(interaction,anims): EGVAR(interaction,anims) { class hide_spare: hide_spare { - position = "[1,6.1,0]"; + positions[] = {{1,6.1,0}}; }; }; }; @@ -261,8 +261,8 @@ class CfgVehicles { class rhsusf_HEMTT_A4_base: Truck_01_base_F { class EGVAR(interaction,anims) { class hide_spare { - position = "[1,2.2,2]"; - item = "ACE_Wheel"; + positions[] = {"_target selectionPosition 'sparewheel' vectorAdd [0.6,0.6,-0.4]"}; + items[] = {"ACE_Wheel"}; }; }; }; @@ -278,13 +278,7 @@ class CfgVehicles { EGVAR(rearm,defaultSupply) = 1200; }; - class rhsusf_M977A4_BKIT_M2_usarmy_wd: rhsusf_M977A4_usarmy_wd { - class EGVAR(interaction,anims): EGVAR(interaction,anims) { - class hide_spare: hide_spare { - position = "[1,2.2,1.2]"; - }; - }; - }; + class rhsusf_M977A4_BKIT_M2_usarmy_wd: rhsusf_M977A4_usarmy_wd {}; class rhsusf_M977A4_AMMO_BKIT_M2_usarmy_wd: rhsusf_M977A4_BKIT_M2_usarmy_wd { transportAmmo = 0; EGVAR(rearm,defaultSupply) = 1200; From 233e4c48ba2ab8f6e020be0e0e1bd83ba701a964 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sun, 25 Apr 2021 23:37:57 +0300 Subject: [PATCH 12/23] Rename init function --- .../{fnc_switchAnimActions.sqf => fnc_initAnimActions.sqf} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename addons/interaction/functions/{fnc_switchAnimActions.sqf => fnc_initAnimActions.sqf} (100%) diff --git a/addons/interaction/functions/fnc_switchAnimActions.sqf b/addons/interaction/functions/fnc_initAnimActions.sqf similarity index 100% rename from addons/interaction/functions/fnc_switchAnimActions.sqf rename to addons/interaction/functions/fnc_initAnimActions.sqf From 34fd0d8980ddfc246cbce723b2183c04ab14ddb9 Mon Sep 17 00:00:00 2001 From: Dystopian Date: Mon, 26 Apr 2021 00:14:41 +0300 Subject: [PATCH 13/23] Decrease number of classes to init --- addons/interaction/XEH_postInit.sqf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index c2b7168ce12..ec9904a4d2d 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -143,6 +143,6 @@ GVAR(isOpeningDoor) = false; } forEach ["loadout", "weapon"]; { - if (count (inheritsFrom _x >> QGVAR(anims)) > 0) then {continue}; + if (isClass (inheritsFrom _x >> QGVAR(anims))) then {continue}; [configName _x, "initPost", {_this call FUNC(initAnimActions)}, true, [], true] call CBA_fnc_addClassEventHandler; -} forEach (QUOTE(count (_x >> QQGVAR(anims)) > 0) configClasses (configFile >> "CfgVehicles")); +} forEach (QUOTE(isClass (_x >> QQGVAR(anims))) configClasses (configFile >> "CfgVehicles")); From 69fb345480c5c49a673f46f69f66fd50cacf009e Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sun, 25 Jul 2021 03:56:05 +0300 Subject: [PATCH 14/23] Fix merge mistake --- optionals/compat_rhs_afrf3/CfgVehicles.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/optionals/compat_rhs_afrf3/CfgVehicles.hpp b/optionals/compat_rhs_afrf3/CfgVehicles.hpp index e50140c62dc..24769faf986 100644 --- a/optionals/compat_rhs_afrf3/CfgVehicles.hpp +++ b/optionals/compat_rhs_afrf3/CfgVehicles.hpp @@ -241,6 +241,7 @@ class CfgVehicles { items[] = {"ACE_Wheel"}; }; }; + }; class rhs_kamaz5350_ammo_base: rhs_kamaz5350 { transportAmmo = 0; ace_rearm_defaultSupply = 1200; From 7f929bb0449a8cdd91eb6dee096a9491e6698034 Mon Sep 17 00:00:00 2001 From: jonpas Date: Tue, 12 Oct 2021 11:23:52 +0200 Subject: [PATCH 15/23] Apply suggestions from code review --- addons/interaction/functions/fnc_initAnimActions.sqf | 4 ++-- addons/interaction/initSettings.sqf | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/interaction/functions/fnc_initAnimActions.sqf b/addons/interaction/functions/fnc_initAnimActions.sqf index 241f729edcb..4f37d91051b 100644 --- a/addons/interaction/functions/fnc_initAnimActions.sqf +++ b/addons/interaction/functions/fnc_initAnimActions.sqf @@ -18,7 +18,7 @@ params ["_object"]; private _class = typeOf _object; -if (!GVAR(animActionsEnabled) || {_class in GVAR(initializedAnimClasses)}) exitWith {}; +if (!GVAR(enableAnimActions) || {_class in GVAR(initializedAnimClasses)}) exitWith {}; GVAR(initializedAnimClasses) pushBack _class; private _statement = { @@ -80,7 +80,7 @@ private _condition = { params ["_target", "_player", "_params"]; _params params ["_anim", "_phase"]; - GVAR(animActionsEnabled) + GVAR(enableAnimActions) && {_target animationPhase _anim != _phase} && {[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)} }; diff --git a/addons/interaction/initSettings.sqf b/addons/interaction/initSettings.sqf index 77838ae5645..ea30066be98 100644 --- a/addons/interaction/initSettings.sqf +++ b/addons/interaction/initSettings.sqf @@ -31,7 +31,7 @@ ] call CBA_fnc_addSetting; [ - QGVAR(animActionsEnabled), "CHECKBOX", + QGVAR(enableAnimActions), "CHECKBOX", LSTRING(SettingAnimActionsName), format ["ACE %1", LLSTRING(DisplayName)], true, From f291fe17ea536333a2f854643eacb7eccfe39b7a Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sat, 20 Jul 2024 16:37:02 +0200 Subject: [PATCH 16/23] Updated code for current mod structure --- addons/compat_rhs_afrf3/CfgVehicles.hpp | 70 ++++++++++++++++++- addons/compat_rhs_afrf3/XEH_preInit.sqf | 5 ++ addons/compat_rhs_usf3/CfgVehicles.hpp | 60 +++++++++++++++- .../functions/fnc_initAnimActions.sqf | 2 +- addons/xm157/XEH_preInit.sqf | 5 -- 5 files changed, 133 insertions(+), 9 deletions(-) diff --git a/addons/compat_rhs_afrf3/CfgVehicles.hpp b/addons/compat_rhs_afrf3/CfgVehicles.hpp index 1cf5029bc34..af1d1dd15c1 100644 --- a/addons/compat_rhs_afrf3/CfgVehicles.hpp +++ b/addons/compat_rhs_afrf3/CfgVehicles.hpp @@ -60,6 +60,17 @@ class CfgVehicles { EGVAR(vehicle_damage,turretFireProb) = 0.7; EGVAR(vehicle_damage,engineFireProb) = 0.7; EGVAR(vehicle_damage,detonationDuringFireProb) = 0.5; + + class EGVAR(interaction,anims) { + class wheel_1_unhide { + positions[] = {{-0.8,-2,0}}; + items[] = {"ACE_Wheel"}; + }; + class wheel_2_unhide { + positions[] = {{0.5,-3.3,-0.3}}; + items[] = {"ACE_Wheel"}; + }; + }; }; class rhs_infantry_msv_base; @@ -97,6 +108,12 @@ class CfgVehicles { class Truck_F: Car_F {}; class RHS_Ural_BaseTurret: Truck_F { EGVAR(refuel,fuelCapacity) = 360; + class EGVAR(interaction,anims) { + class spare_hide { + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; + }; + }; }; class RHS_Ural_Base: RHS_Ural_BaseTurret {}; @@ -110,6 +127,15 @@ class CfgVehicles { EGVAR(rearm,defaultSupply) = 1200; }; + class rhs_zil131_base: Truck_F { + class EGVAR(interaction,anims) { + class spare_hide { + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; + }; + }; + }; + class rhs_kraz255b1_base; class rhs_kraz255b1_fuel_base: rhs_kraz255b1_base { EGVAR(refuel,hooks)[] = {{-0.05,-3.6,-0.45}}; @@ -118,6 +144,12 @@ class CfgVehicles { class rhs_truck: Truck_F { EGVAR(refuel,fuelCapacity) = 210; + class EGVAR(interaction,anims) { + class spare_hide { + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; + }; + }; }; class rhs_gaz66_vmf; @@ -125,7 +157,15 @@ class CfgVehicles { EGVAR(rearm,defaultSupply) = 1200; }; - class rhs_kamaz5350; + class O_Truck_02_covered_F; + class rhs_kamaz5350: O_Truck_02_covered_F { + class EGVAR(interaction,anims) { + class spare_hide { + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; + }; + }; + }; class rhs_kamaz5350_ammo_base: rhs_kamaz5350 { EGVAR(rearm,defaultSupply) = 1200; }; @@ -133,11 +173,23 @@ class CfgVehicles { class MRAP_02_base_F; class rhs_tigr_base: MRAP_02_base_F { EGVAR(refuel,fuelCapacity) = 138; + class EGVAR(interaction,anims) { + class spare_hide { + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; + }; + }; }; class Offroad_01_base_f; class RHS_UAZ_Base: Offroad_01_base_f { EGVAR(refuel,fuelCapacity) = 78; + class EGVAR(interaction,anims) { + class spare_hide { + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; + }; + }; }; class APC_Tracked_02_base_F: Tank_F { @@ -177,6 +229,14 @@ class CfgVehicles { roles[]={"cargo"}; }; }; + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class wheel_1_unhide: wheel_1_unhide { + positions[] = {{-1.2,-2.5,0.2}}; + }; + class wheel_2_unhide: wheel_2_unhide { + positions[] = {{0,-4.2,0}}; + }; + }; }; class rhs_btr70_msv: rhs_btr70_vmf {}; @@ -220,6 +280,14 @@ class CfgVehicles { roles[]={"cargo"}; }; }; + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class wheel_1_unhide: wheel_1_unhide { + positions[] = {{-1,-2.5,0.7}}; + }; + class wheel_2_unhide: wheel_2_unhide { + enabled = 0; + }; + }; }; class rhs_btr80a_msv: rhs_btr80_msv { class ace_viewports { diff --git a/addons/compat_rhs_afrf3/XEH_preInit.sqf b/addons/compat_rhs_afrf3/XEH_preInit.sqf index b47cf6628db..69f9477712f 100644 --- a/addons/compat_rhs_afrf3/XEH_preInit.sqf +++ b/addons/compat_rhs_afrf3/XEH_preInit.sqf @@ -6,4 +6,9 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +RHS_Retread_Enabled = false; +rhs_btr70_EnableRetread = false; +rhs_TypeTirePressure = 1; +RHS_BTR_Effects_Init = true; + ADDON = true; diff --git a/addons/compat_rhs_usf3/CfgVehicles.hpp b/addons/compat_rhs_usf3/CfgVehicles.hpp index 0593c5a868a..114c5ace550 100644 --- a/addons/compat_rhs_usf3/CfgVehicles.hpp +++ b/addons/compat_rhs_usf3/CfgVehicles.hpp @@ -47,15 +47,71 @@ class CfgVehicles { class Truck_01_base_F: Truck_F {}; class rhsusf_fmtv_base: Truck_01_base_F { EGVAR(refuel,fuelCapacity) = 219; + class EGVAR(interaction,anims) { + class hide_spare { + positions[] = {{1,1.4,0}}; + items[] = {"ACE_Wheel"}; + }; + }; + }; + class rhsusf_M1078A1P2_fmtv_usarmy: rhsusf_fmtv_base {}; + class rhsusf_M1078A1P2_B_fmtv_usarmy: rhsusf_M1078A1P2_fmtv_usarmy {}; + class rhsusf_M1078A1P2_B_M2_fmtv_usarmy: rhsusf_M1078A1P2_B_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + positions[] = {{1,1.4,-0.5}}; + }; + }; }; - class rhsusf_M1078A1P2_B_M2_fmtv_usarmy; class rhsusf_M1078A1R_SOV_M2_D_fmtv_socom: rhsusf_M1078A1P2_B_M2_fmtv_usarmy { EGVAR(rearm,defaultSupply) = 800; EGVAR(refuel,hooks)[] = {{1.1,0.9,-1.2}}; EGVAR(refuel,fuelCargo) = 900; // 45 jerrycans + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + positions[] = {{1,1,0}}; + }; + }; + }; + class rhsusf_M1083A1P2_fmtv_usarmy: rhsusf_M1078A1P2_fmtv_usarmy {}; + class rhsusf_M1083A1P2_B_fmtv_usarmy: rhsusf_M1083A1P2_fmtv_usarmy {}; + class rhsusf_M1083A1P2_B_M2_fmtv_usarmy: rhsusf_M1083A1P2_B_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + positions[] = {{1,1.4,-0.5}}; + }; + }; + }; + class rhsusf_M1084A1P2_fmtv_usarmy: rhsusf_M1083A1P2_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + positions[] = {{1,1.8,0}}; + }; + }; + }; + class rhsusf_M1084A1P2_B_M2_fmtv_usarmy: rhsusf_M1083A1P2_B_M2_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + positions[] = {{1,1.8,-0.5}}; + }; + }; + }; + class rhsusf_M1085A1P2_B_Medical_fmtv_usarmy: rhsusf_M1083A1P2_B_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + positions[] = {{1,6.1,0}}; + }; + }; }; - class rhsusf_HEMTT_A4_base: Truck_01_base_F {}; + class rhsusf_HEMTT_A4_base: Truck_01_base_F { + class EGVAR(interaction,anims) { + class hide_spare { + positions[] = {"_target selectionPosition 'sparewheel' vectorAdd [0.6,0.6,-0.4]"}; + items[] = {"ACE_Wheel"}; + }; + }; + }; class rhsusf_M977A4_usarmy_wd: rhsusf_HEMTT_A4_base {}; class rhsusf_M977A4_AMMO_usarmy_wd: rhsusf_M977A4_usarmy_wd { EGVAR(rearm,defaultSupply) = 1200; diff --git a/addons/interaction/functions/fnc_initAnimActions.sqf b/addons/interaction/functions/fnc_initAnimActions.sqf index 4f37d91051b..087765c7dfe 100644 --- a/addons/interaction/functions/fnc_initAnimActions.sqf +++ b/addons/interaction/functions/fnc_initAnimActions.sqf @@ -1,4 +1,4 @@ -#include "script_component.hpp" +#include "..\script_component.hpp" /* * Author: Dystopian * Initializes object interactions based on animations. diff --git a/addons/xm157/XEH_preInit.sqf b/addons/xm157/XEH_preInit.sqf index 69f9477712f..b47cf6628db 100644 --- a/addons/xm157/XEH_preInit.sqf +++ b/addons/xm157/XEH_preInit.sqf @@ -6,9 +6,4 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; -RHS_Retread_Enabled = false; -rhs_btr70_EnableRetread = false; -rhs_TypeTirePressure = 1; -RHS_BTR_Effects_Init = true; - ADDON = true; From 6d80dcc7ee7218ee4c571c3ed8b944e9f1a0a5a7 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Sat, 20 Jul 2024 20:51:37 +0200 Subject: [PATCH 17/23] 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 --- addons/compat_rhs_afrf3/CfgVehicles.hpp | 1 - addons/compat_rhs_afrf3/XEH_preInit.sqf | 11 +- addons/compat_rhs_afrf3/config.cpp | 2 +- addons/interaction/XEH_postInit.sqf | 14 ++- .../functions/fnc_initAnimActions.sqf | 114 +++++++++++++----- addons/interaction/initSettings.inc.sqf | 4 +- 6 files changed, 106 insertions(+), 40 deletions(-) diff --git a/addons/compat_rhs_afrf3/CfgVehicles.hpp b/addons/compat_rhs_afrf3/CfgVehicles.hpp index af1d1dd15c1..ea82b24e62f 100644 --- a/addons/compat_rhs_afrf3/CfgVehicles.hpp +++ b/addons/compat_rhs_afrf3/CfgVehicles.hpp @@ -60,7 +60,6 @@ class CfgVehicles { EGVAR(vehicle_damage,turretFireProb) = 0.7; EGVAR(vehicle_damage,engineFireProb) = 0.7; EGVAR(vehicle_damage,detonationDuringFireProb) = 0.5; - class EGVAR(interaction,anims) { class wheel_1_unhide { positions[] = {{-0.8,-2,0}}; diff --git a/addons/compat_rhs_afrf3/XEH_preInit.sqf b/addons/compat_rhs_afrf3/XEH_preInit.sqf index 69f9477712f..2ca4338e90c 100644 --- a/addons/compat_rhs_afrf3/XEH_preInit.sqf +++ b/addons/compat_rhs_afrf3/XEH_preInit.sqf @@ -6,9 +6,12 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; -RHS_Retread_Enabled = false; -rhs_btr70_EnableRetread = false; -rhs_TypeTirePressure = 1; -RHS_BTR_Effects_Init = true; +// Disable RHS' wheel replacement mechanic +if (["ace_repair"] call EFUNC(common,isModLoaded)) then { + RHS_Retread_Enabled = false; + rhs_btr70_EnableRetread = false; + rhs_TypeTirePressure = 1; + RHS_BTR_Effects_Init = true; +}; ADDON = true; diff --git a/addons/compat_rhs_afrf3/config.cpp b/addons/compat_rhs_afrf3/config.cpp index 44fcd30fcbe..0b3c990ced8 100644 --- a/addons/compat_rhs_afrf3/config.cpp +++ b/addons/compat_rhs_afrf3/config.cpp @@ -7,7 +7,7 @@ class CfgPatches { units[] = {}; weapons[] = {}; requiredVersion = REQUIRED_VERSION; - requiredAddons[] = {"rhs_main_loadorder"}; + requiredAddons[] = {"ace_common", "rhs_main_loadorder"}; author = ECSTRING(common,ACETeam); authors[] = {"Ruthberg", "GitHawk", "BaerMitUmlaut", "commy2", "Skengman2"}; url = ECSTRING(main,URL); diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 796f86244bd..e3f60309c30 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -149,11 +149,20 @@ GVAR(isOpeningDoor) = false; ["isNotOnLadder", {getNumber (configFile >> "CfgMovesMaleSdr" >> "States" >> animationState (_this select 0) >> "ACE_isLadder") != 1}] call EFUNC(common,addCanInteractWithCondition); ["CBA_settingsInitialized", { + TRACE_2("settingsInitialized",GVAR(disableNegativeRating),GVAR(enableAnimActions)); + if (GVAR(disableNegativeRating)) then { player addEventHandler ["HandleRating", { (_this select 1) max 0 }]; }; + + if (!GVAR(enableAnimActions)) exitWith {}; + + // Don't add inherited anim actions (but actions are added to child classes) + { + [configName _x, "InitPost", LINKFUNC(initAnimActions), true, [], true] call CBA_fnc_addClassEventHandler; + } forEach (QUOTE(isClass (_x >> QQGVAR(anims)) && {!isClass (inheritsFrom _x >> QQGVAR(anims))}) configClasses (configFile >> "CfgVehicles")); }] call CBA_fnc_addEventHandler; { @@ -178,8 +187,3 @@ private _action = [ { [_x, 0, ["ACE_MainActions"], _action, true] call EFUNC(interact_menu,addActionToClass); } forEach ["WeaponHolder", "WeaponHolderSimulated"]; - -{ - if (isClass (inheritsFrom _x >> QGVAR(anims))) then {continue}; - [configName _x, "initPost", {_this call FUNC(initAnimActions)}, true, [], true] call CBA_fnc_addClassEventHandler; -} forEach (QUOTE(isClass (_x >> QQGVAR(anims))) configClasses (configFile >> "CfgVehicles")); diff --git a/addons/interaction/functions/fnc_initAnimActions.sqf b/addons/interaction/functions/fnc_initAnimActions.sqf index 087765c7dfe..733f393af61 100644 --- a/addons/interaction/functions/fnc_initAnimActions.sqf +++ b/addons/interaction/functions/fnc_initAnimActions.sqf @@ -18,58 +18,118 @@ params ["_object"]; private _class = typeOf _object; -if (!GVAR(enableAnimActions) || {_class in GVAR(initializedAnimClasses)}) exitWith {}; + +if (_class in GVAR(initializedAnimClasses)) exitWith {}; + GVAR(initializedAnimClasses) pushBack _class; private _statement = { params ["_target", "_player", "_params"]; _params params ["_anim", "_phase", "_duration"]; TRACE_5("statement",_target,_player,_anim,_phase,_duration); + [ _duration, [_target, _player, _anim, _phase], { (_this select 0) params ["_target", "_player", "_anim", "_phase"]; + private _items = _target getVariable [ format [QGVAR(animsItems_%1), _anim], getArray (configOf _target >> QGVAR(anims) >> _anim >> "items") ]; - private _success = true; + + // If 1 object was spawned in, consider it a success + private _success = false; + if (_items isNotEqualTo []) then { - if (_items isEqualType "") then {_items = [_items]}; - private _emptyPosAGL = [_target, _items select 0, _player] call EFUNC(common,findUnloadPosition); - if (_emptyPosAGL isEqualTo []) exitWith { - [LELSTRING(common,NoRoomToUnload)] call EFUNC(common,displayTextStructured); - _success = false; + if (_items isEqualType "") then { + _items = [_items]; }; - private ["_weaponHolder"]; + + private _weaponHolder = objNull; + { - switch true do { - case (1 == getNumber (configFile >> "CfgVehicles" >> _x >> "isBackpack")): { - if (isNil "_weaponHolder") then { - _weaponHolder = createVehicle ["GroundWeaponHolder", _emptyPosAGL, [], 0, "CAN_COLLIDE"]; + private _type = (_x call EFUNC(common,getItemType)) select 0; + + if (_type == "") then { + private _emptyPosAGL = []; + + // This covers testing vehicle stability and finding a safe position + for "_i" from 1 to 3 do { + _emptyPosAGL = [_target, _x, _player] call EFUNC(common,findUnloadPosition); + + if (_emptyPosAGL isNotEqualTo []) exitWith {}; + }; + + // If still no valid position, try the next item + if (_emptyPosAGL isEqualTo []) then { + [LELSTRING(common,NoRoomToUnload)] call EFUNC(common,displayTextStructured); + + continue; + }; + + private _object = createVehicle [_x, _emptyPosAGL, [], 0, "CAN_COLLIDE"]; + + if (!isNull _object) then { + // Prevent items from taking damage when unloaded + [_object, "blockDamage", QUOTE(ADDON), true] call EFUNC(common,statusEffect_set); + [EFUNC(common,statusEffect_set), [_object, "blockDamage", QUOTE(ADDON), false], 2] call CBA_fnc_waitAndExecute; + + _success = true; + } else { + WARNING_1("Failed to create object of type '%1'",_x); + }; + + continue; + }; + + // Functions/code below are guaranteed to spawn in objects + _success = true; + + // getItemType considers backpacks as weapons, so handle them first + if (getNumber (configFile >> "CfgVehicles" >> _x >> "isBackpack") == 1) then { + if (backpack _player == "") then { + _player addBackpackGlobal _x; + } else { + if (isNull _weaponHolder) then { + _weaponHolder = nearestObject [_player, "WeaponHolder"]; + + if (isNull _weaponHolder || {_player distance _weaponHolder > 2}) then { + _weaponHolder = createVehicle ["GroundWeaponHolder", [0, 0, 0], [], 0, "NONE"]; + _weaponHolder setPosASL getPosASL _player; + }; }; + _weaponHolder addBackpackCargoGlobal [_x, 1]; }; - case (getNumber (configfile >> "CfgWeapons" >> _x >> "type") in [TYPE_BINOCULAR_AND_NVG, TYPE_ITEM]): { - if (isNil "_weaponHolder") then { - _weaponHolder = createVehicle ["GroundWeaponHolder", _emptyPosAGL, [], 0, "CAN_COLLIDE"]; - }; - _weaponHolder addItemCargoGlobal [_x, 1]; + + continue; + }; + + switch (_type) do { + case "weapon": { + [_player, _x, true] call CBA_fnc_addWeapon; + }; + case "item": { + [_player, _x, true] call CBA_fnc_addItem; }; - default { - createVehicle [_x, _emptyPosAGL]; + case "magazine": { + [_player, _x, -1, true] call CBA_fnc_addMagazine; }; }; } forEach _items; }; + if (!_success) exitWith {}; + _target animate [_anim, _phase, true]; }, {}, nil, { (_this select 0) params ["_target", "", "_anim", "_phase"]; + _target animationPhase _anim != _phase }, ["isNotSwimming"] @@ -80,8 +140,7 @@ private _condition = { params ["_target", "_player", "_params"]; _params params ["_anim", "_phase"]; - GVAR(enableAnimActions) - && {_target animationPhase _anim != _phase} + _target animationPhase _anim != _phase && {[_player, _target, ["isNotSwimming"]] call EFUNC(common,canInteractWith)} }; @@ -95,9 +154,9 @@ private _config = configOf _object; if !( isClass _animationSourcesConfig // anim exist - && {0 != [_animationSourcesConfig >> "scope", "number", 1] call CBA_fnc_getConfigEntry} // anim not hidden + && {0 != [_animationSourcesConfig >> "scope", "NUMBER", 1] call CBA_fnc_getConfigEntry} // anim not hidden && {isNumber (_animationSourcesConfig >> "initPhase")} // anim correct (some CUP anims are inherited and cleared) - && {0 != [_animConfig >> "enabled", "number", 1] call CBA_fnc_getConfigEntry} // anim enabled + && {0 != [_animConfig >> "enabled", "NUMBER", 1] call CBA_fnc_getConfigEntry} // anim enabled ) then {continue}; private _positions = []; @@ -116,10 +175,11 @@ private _config = configOf _object; continue; }; - private _phase = [_animConfig >> "phase", "number", 1] call CBA_fnc_getConfigEntry; - private _name = [_animConfig >> "name", "text", localize "str_a3_cfgactions_unmountitem0"] call CBA_fnc_getConfigEntry; - private _icon = [_animConfig >> "icon", "text", "\A3\ui_f\data\igui\cfg\actions\take_ca.paa"] call CBA_fnc_getConfigEntry; - private _duration = [_animConfig >> "duration", "number", 10] call CBA_fnc_getConfigEntry; + private _phase = [_animConfig >> "phase", "NUMBER", 1] call CBA_fnc_getConfigEntry; + private _name = [_animConfig >> "name", "TEXT", localize "str_a3_cfgactions_unmountitem0"] call CBA_fnc_getConfigEntry; + private _icon = [_animConfig >> "icon", "TEXT", "\A3\ui_f\data\igui\cfg\actions\take_ca.paa"] call CBA_fnc_getConfigEntry; + private _duration = [_animConfig >> "duration", "NUMBER", 10] call CBA_fnc_getConfigEntry; + { private _action = [ format [QGVAR(anim_%1_%2), _anim, _forEachIndex], diff --git a/addons/interaction/initSettings.inc.sqf b/addons/interaction/initSettings.inc.sqf index 284232f0d73..4adc5a6dafd 100644 --- a/addons/interaction/initSettings.inc.sqf +++ b/addons/interaction/initSettings.inc.sqf @@ -44,8 +44,8 @@ format ["ACE %1", LLSTRING(DisplayName)], true, true, - {}, - true + {[QGVAR(enableAnimActions), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_fnc_addSetting; [ From b160189fde8892c7b8f4ed42a48f97a1d8c9fb9b Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Mon, 22 Jul 2024 10:02:50 +0200 Subject: [PATCH 18/23] Update CfgVehicles.hpp --- addons/interaction/CfgVehicles.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index cdad1eac4c3..caf8fd8b6f7 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -418,7 +418,6 @@ class CfgVehicles { class GVAR(anims) { class showBags { phase = 0; - //selection = "vhc_bags"; positions[] = {{-0.685,-2.863,0.218}, {0.685,-2.863,0.218}}; items[] = {"B_Carryall_cbr", "B_Carryall_cbr"}; }; From 2b0faa72519d3245ef13d5c13fb3bf2294275474 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 8 Aug 2024 22:50:27 -0500 Subject: [PATCH 19/23] cache config lookup at preStart --- addons/interaction/XEH_postInit.sqf | 2 +- addons/interaction/XEH_preStart.sqf | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index e3f60309c30..3041d7331bc 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -162,7 +162,7 @@ GVAR(isOpeningDoor) = false; // Don't add inherited anim actions (but actions are added to child classes) { [configName _x, "InitPost", LINKFUNC(initAnimActions), true, [], true] call CBA_fnc_addClassEventHandler; - } forEach (QUOTE(isClass (_x >> QQGVAR(anims)) && {!isClass (inheritsFrom _x >> QQGVAR(anims))}) configClasses (configFile >> "CfgVehicles")); + } forEach (keys (uiNamespace getVariable QGVAR(animActionsClasses))); }] call CBA_fnc_addEventHandler; { diff --git a/addons/interaction/XEH_preStart.sqf b/addons/interaction/XEH_preStart.sqf index 331b5c6d36c..39da54b3b58 100644 --- a/addons/interaction/XEH_preStart.sqf +++ b/addons/interaction/XEH_preStart.sqf @@ -23,3 +23,13 @@ private _cacheReplaceTerrainModels = createHashMap; } 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 [])]; From dd7df53c3ce9721a4f3b8a260789573f990cc46c Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Fri, 9 Aug 2024 12:05:21 +0200 Subject: [PATCH 20/23] Fix error --- addons/interaction/XEH_postInit.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/interaction/XEH_postInit.sqf b/addons/interaction/XEH_postInit.sqf index 3041d7331bc..dc1c167d7c1 100644 --- a/addons/interaction/XEH_postInit.sqf +++ b/addons/interaction/XEH_postInit.sqf @@ -161,7 +161,7 @@ GVAR(isOpeningDoor) = false; // Don't add inherited anim actions (but actions are added to child classes) { - [configName _x, "InitPost", LINKFUNC(initAnimActions), true, [], true] call CBA_fnc_addClassEventHandler; + [_x, "InitPost", LINKFUNC(initAnimActions), true, [], true] call CBA_fnc_addClassEventHandler; } forEach (keys (uiNamespace getVariable QGVAR(animActionsClasses))); }] call CBA_fnc_addEventHandler; From dccb240b66973b9fd392cee9c29eb8f5c05f50c0 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Fri, 9 Aug 2024 17:34:04 +0200 Subject: [PATCH 21/23] Add text config entry for progress bar title --- addons/interaction/functions/fnc_initAnimActions.sqf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/interaction/functions/fnc_initAnimActions.sqf b/addons/interaction/functions/fnc_initAnimActions.sqf index 733f393af61..673946a2e16 100644 --- a/addons/interaction/functions/fnc_initAnimActions.sqf +++ b/addons/interaction/functions/fnc_initAnimActions.sqf @@ -25,7 +25,7 @@ GVAR(initializedAnimClasses) pushBack _class; private _statement = { params ["_target", "_player", "_params"]; - _params params ["_anim", "_phase", "_duration"]; + _params params ["_anim", "_phase", "_duration", "_text"]; TRACE_5("statement",_target,_player,_anim,_phase,_duration); [ @@ -126,7 +126,7 @@ private _statement = { _target animate [_anim, _phase, true]; }, {}, - nil, + _text, { (_this select 0) params ["_target", "", "_anim", "_phase"]; @@ -179,12 +179,13 @@ private _config = configOf _object; private _name = [_animConfig >> "name", "TEXT", localize "str_a3_cfgactions_unmountitem0"] call CBA_fnc_getConfigEntry; private _icon = [_animConfig >> "icon", "TEXT", "\A3\ui_f\data\igui\cfg\actions\take_ca.paa"] call CBA_fnc_getConfigEntry; private _duration = [_animConfig >> "duration", "NUMBER", 10] call CBA_fnc_getConfigEntry; + private _text = getText (_animConfig >> "text"); { private _action = [ format [QGVAR(anim_%1_%2), _anim, _forEachIndex], _name, _icon, _statement, _condition, {}, - [_anim, _phase, _duration], + [_anim, _phase, _duration, _text], _x ] call EFUNC(interact_menu,createAction); [_class, 0, [], _action] call EFUNC(interact_menu,addActionToClass); From e36682afabaf04a1f6256a8cbfd2f57626d63c64 Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Fri, 9 Aug 2024 19:55:23 +0200 Subject: [PATCH 22/23] Restructure interactions, improved some locations & added interaction to some missing vehicles --- addons/compat_rhs_afrf3/CfgVehicles.hpp | 69 +--------- addons/compat_rhs_afrf3/XEH_preInit.sqf | 8 -- .../CfgEventHandlers.hpp | 5 + .../compat_rhs_afrf3_repair/CfgVehicles.hpp | 123 +++++++++++++++++ .../compat_rhs_afrf3_repair/XEH_preInit.sqf | 11 ++ .../compat_rhs_afrf3_repair/config.cpp | 22 +++ .../script_component.hpp | 3 + addons/compat_rhs_usf3/CfgVehicles.hpp | 64 +-------- .../compat_rhs_usf3_refuel/CfgVehicles.hpp | 52 ++++++++ .../compat_rhs_usf3_refuel/config.cpp | 1 + .../compat_rhs_usf3_repair/CfgVehicles.hpp | 126 ++++++++++++++++++ .../compat_rhs_usf3_repair/config.cpp | 23 ++++ .../script_component.hpp | 3 + .../compat_rhs_usf3_trenches/CfgVehicles.hpp | 48 +++++++ .../compat_rhs_usf3_trenches/config.cpp | 23 ++++ .../script_component.hpp | 3 + addons/interaction/CfgVehicles.hpp | 28 +++- addons/refuel/CfgVehicles.hpp | 18 ++- addons/repair/CfgVehicles.hpp | 32 ++++- addons/trenches/CfgVehicles.hpp | 13 +- 20 files changed, 528 insertions(+), 147 deletions(-) create mode 100644 addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/CfgEventHandlers.hpp create mode 100644 addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/CfgVehicles.hpp create mode 100644 addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/XEH_preInit.sqf create mode 100644 addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/config.cpp create mode 100644 addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/script_component.hpp create mode 100644 addons/compat_rhs_usf3/compat_rhs_usf3_refuel/CfgVehicles.hpp create mode 100644 addons/compat_rhs_usf3/compat_rhs_usf3_repair/CfgVehicles.hpp create mode 100644 addons/compat_rhs_usf3/compat_rhs_usf3_repair/config.cpp create mode 100644 addons/compat_rhs_usf3/compat_rhs_usf3_repair/script_component.hpp create mode 100644 addons/compat_rhs_usf3/compat_rhs_usf3_trenches/CfgVehicles.hpp create mode 100644 addons/compat_rhs_usf3/compat_rhs_usf3_trenches/config.cpp create mode 100644 addons/compat_rhs_usf3/compat_rhs_usf3_trenches/script_component.hpp diff --git a/addons/compat_rhs_afrf3/CfgVehicles.hpp b/addons/compat_rhs_afrf3/CfgVehicles.hpp index ea82b24e62f..1cf5029bc34 100644 --- a/addons/compat_rhs_afrf3/CfgVehicles.hpp +++ b/addons/compat_rhs_afrf3/CfgVehicles.hpp @@ -60,16 +60,6 @@ class CfgVehicles { EGVAR(vehicle_damage,turretFireProb) = 0.7; EGVAR(vehicle_damage,engineFireProb) = 0.7; EGVAR(vehicle_damage,detonationDuringFireProb) = 0.5; - class EGVAR(interaction,anims) { - class wheel_1_unhide { - positions[] = {{-0.8,-2,0}}; - items[] = {"ACE_Wheel"}; - }; - class wheel_2_unhide { - positions[] = {{0.5,-3.3,-0.3}}; - items[] = {"ACE_Wheel"}; - }; - }; }; class rhs_infantry_msv_base; @@ -107,12 +97,6 @@ class CfgVehicles { class Truck_F: Car_F {}; class RHS_Ural_BaseTurret: Truck_F { EGVAR(refuel,fuelCapacity) = 360; - class EGVAR(interaction,anims) { - class spare_hide { - selections[] = {"spare"}; - items[] = {"ACE_Wheel"}; - }; - }; }; class RHS_Ural_Base: RHS_Ural_BaseTurret {}; @@ -126,15 +110,6 @@ class CfgVehicles { EGVAR(rearm,defaultSupply) = 1200; }; - class rhs_zil131_base: Truck_F { - class EGVAR(interaction,anims) { - class spare_hide { - selections[] = {"spare"}; - items[] = {"ACE_Wheel"}; - }; - }; - }; - class rhs_kraz255b1_base; class rhs_kraz255b1_fuel_base: rhs_kraz255b1_base { EGVAR(refuel,hooks)[] = {{-0.05,-3.6,-0.45}}; @@ -143,12 +118,6 @@ class CfgVehicles { class rhs_truck: Truck_F { EGVAR(refuel,fuelCapacity) = 210; - class EGVAR(interaction,anims) { - class spare_hide { - selections[] = {"spare"}; - items[] = {"ACE_Wheel"}; - }; - }; }; class rhs_gaz66_vmf; @@ -156,15 +125,7 @@ class CfgVehicles { EGVAR(rearm,defaultSupply) = 1200; }; - class O_Truck_02_covered_F; - class rhs_kamaz5350: O_Truck_02_covered_F { - class EGVAR(interaction,anims) { - class spare_hide { - selections[] = {"spare"}; - items[] = {"ACE_Wheel"}; - }; - }; - }; + class rhs_kamaz5350; class rhs_kamaz5350_ammo_base: rhs_kamaz5350 { EGVAR(rearm,defaultSupply) = 1200; }; @@ -172,23 +133,11 @@ class CfgVehicles { class MRAP_02_base_F; class rhs_tigr_base: MRAP_02_base_F { EGVAR(refuel,fuelCapacity) = 138; - class EGVAR(interaction,anims) { - class spare_hide { - selections[] = {"spare"}; - items[] = {"ACE_Wheel"}; - }; - }; }; class Offroad_01_base_f; class RHS_UAZ_Base: Offroad_01_base_f { EGVAR(refuel,fuelCapacity) = 78; - class EGVAR(interaction,anims) { - class spare_hide { - selections[] = {"spare"}; - items[] = {"ACE_Wheel"}; - }; - }; }; class APC_Tracked_02_base_F: Tank_F { @@ -228,14 +177,6 @@ class CfgVehicles { roles[]={"cargo"}; }; }; - class EGVAR(interaction,anims): EGVAR(interaction,anims) { - class wheel_1_unhide: wheel_1_unhide { - positions[] = {{-1.2,-2.5,0.2}}; - }; - class wheel_2_unhide: wheel_2_unhide { - positions[] = {{0,-4.2,0}}; - }; - }; }; class rhs_btr70_msv: rhs_btr70_vmf {}; @@ -279,14 +220,6 @@ class CfgVehicles { roles[]={"cargo"}; }; }; - class EGVAR(interaction,anims): EGVAR(interaction,anims) { - class wheel_1_unhide: wheel_1_unhide { - positions[] = {{-1,-2.5,0.7}}; - }; - class wheel_2_unhide: wheel_2_unhide { - enabled = 0; - }; - }; }; class rhs_btr80a_msv: rhs_btr80_msv { class ace_viewports { diff --git a/addons/compat_rhs_afrf3/XEH_preInit.sqf b/addons/compat_rhs_afrf3/XEH_preInit.sqf index 2ca4338e90c..b47cf6628db 100644 --- a/addons/compat_rhs_afrf3/XEH_preInit.sqf +++ b/addons/compat_rhs_afrf3/XEH_preInit.sqf @@ -6,12 +6,4 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; -// Disable RHS' wheel replacement mechanic -if (["ace_repair"] call EFUNC(common,isModLoaded)) then { - RHS_Retread_Enabled = false; - rhs_btr70_EnableRetread = false; - rhs_TypeTirePressure = 1; - RHS_BTR_Effects_Init = true; -}; - ADDON = true; diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/CfgEventHandlers.hpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/CfgEventHandlers.hpp new file mode 100644 index 00000000000..9b160c16000 --- /dev/null +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/CfgEventHandlers.hpp @@ -0,0 +1,5 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + }; +}; diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/CfgVehicles.hpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/CfgVehicles.hpp new file mode 100644 index 00000000000..1acd977b990 --- /dev/null +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/CfgVehicles.hpp @@ -0,0 +1,123 @@ +class CfgVehicles { + class Wheeled_APC_F; + class rhs_btr_base: Wheeled_APC_F { + class EGVAR(interaction,anims) { + class wheel_1_unhide { + positions[] = {{-0.8, -1.7, 0}}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + class wheel_2_unhide { + positions[] = {{0.35, -2.9, -0.1}}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; + class rhs_btr70_vmf: rhs_btr_base { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class wheel_1_unhide: wheel_1_unhide { + positions[] = {{-1.2, -2.6, 0.2}}; + }; + class wheel_2_unhide: wheel_2_unhide { + positions[] = {{-0.3, -3.8, 0}}; + }; + }; + }; + + class rhs_btr70_msv: rhs_btr70_vmf {}; + class rhs_btr80_msv: rhs_btr70_msv { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class wheel_1_unhide: wheel_1_unhide { + positions[] = {{-1, -2.5, 0.6}}; + }; + class wheel_2_unhide: wheel_2_unhide { + enabled = 0; + }; + }; + }; + + class Truck_F; + class rhs_truck: Truck_F { + class EGVAR(interaction,anims) { + class spare_hide { + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; + + class RHS_Ural_BaseTurret: Truck_F { + class EGVAR(interaction,anims) { + class spare_hide { + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; + + class rhs_zil131_base: Truck_F { + class EGVAR(interaction,anims) { + class spare_hide { + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; + + class rhs_kraz255_base; + class rhs_kraz255b1_base: rhs_kraz255_base { + class EGVAR(interaction,anims) { + class spare_hide { + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; + + class O_Truck_02_covered_F; + class rhs_kamaz5350: O_Truck_02_covered_F { + class EGVAR(interaction,anims) { + class spare_hide { + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; + + class MRAP_02_base_F; + class rhs_tigr_base: MRAP_02_base_F { + class EGVAR(interaction,anims) { + class spare_hide { + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; + + class Offroad_01_base_f; + class RHS_UAZ_Base: Offroad_01_base_f { + class EGVAR(interaction,anims) { + class spare_hide { + selections[] = {"spare"}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; +}; diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/XEH_preInit.sqf b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/XEH_preInit.sqf new file mode 100644 index 00000000000..13de860b534 --- /dev/null +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/XEH_preInit.sqf @@ -0,0 +1,11 @@ +#include "script_component.hpp" + +ADDON = false; + +// Disable RHS' wheel replacement mechanic +RHS_Retread_Enabled = false; +rhs_btr70_EnableRetread = false; +rhs_TypeTirePressure = 1; +RHS_BTR_Effects_Init = true; + +ADDON = true; diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/config.cpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/config.cpp new file mode 100644 index 00000000000..65f2af1aa4e --- /dev/null +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/config.cpp @@ -0,0 +1,22 @@ +#include "script_component.hpp" + +class CfgPatches { + class SUBADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "rhs_main_loadorder", + "ace_repair" + }; + skipWhenMissingDependencies = 1; + author = ECSTRING(common,ACETeam); + authors[] = {"Dystopian", "johnb43"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/script_component.hpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/script_component.hpp new file mode 100644 index 00000000000..1af928486c3 --- /dev/null +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/script_component.hpp @@ -0,0 +1,3 @@ +#define SUBCOMPONENT repair +#define SUBCOMPONENT_BEAUTIFIED Repair +#include "..\script_component.hpp" diff --git a/addons/compat_rhs_usf3/CfgVehicles.hpp b/addons/compat_rhs_usf3/CfgVehicles.hpp index 114c5ace550..3933e543ecf 100644 --- a/addons/compat_rhs_usf3/CfgVehicles.hpp +++ b/addons/compat_rhs_usf3/CfgVehicles.hpp @@ -43,76 +43,18 @@ class CfgVehicles { EGVAR(refuel,fuelCapacity) = 302; }; - class Truck_F; - class Truck_01_base_F: Truck_F {}; + class Truck_01_base_F; class rhsusf_fmtv_base: Truck_01_base_F { EGVAR(refuel,fuelCapacity) = 219; - class EGVAR(interaction,anims) { - class hide_spare { - positions[] = {{1,1.4,0}}; - items[] = {"ACE_Wheel"}; - }; - }; - }; - class rhsusf_M1078A1P2_fmtv_usarmy: rhsusf_fmtv_base {}; - class rhsusf_M1078A1P2_B_fmtv_usarmy: rhsusf_M1078A1P2_fmtv_usarmy {}; - class rhsusf_M1078A1P2_B_M2_fmtv_usarmy: rhsusf_M1078A1P2_B_fmtv_usarmy { - class EGVAR(interaction,anims): EGVAR(interaction,anims) { - class hide_spare: hide_spare { - positions[] = {{1,1.4,-0.5}}; - }; - }; }; + class rhsusf_M1078A1P2_B_M2_fmtv_usarmy; class rhsusf_M1078A1R_SOV_M2_D_fmtv_socom: rhsusf_M1078A1P2_B_M2_fmtv_usarmy { EGVAR(rearm,defaultSupply) = 800; EGVAR(refuel,hooks)[] = {{1.1,0.9,-1.2}}; EGVAR(refuel,fuelCargo) = 900; // 45 jerrycans - class EGVAR(interaction,anims): EGVAR(interaction,anims) { - class hide_spare: hide_spare { - positions[] = {{1,1,0}}; - }; - }; - }; - class rhsusf_M1083A1P2_fmtv_usarmy: rhsusf_M1078A1P2_fmtv_usarmy {}; - class rhsusf_M1083A1P2_B_fmtv_usarmy: rhsusf_M1083A1P2_fmtv_usarmy {}; - class rhsusf_M1083A1P2_B_M2_fmtv_usarmy: rhsusf_M1083A1P2_B_fmtv_usarmy { - class EGVAR(interaction,anims): EGVAR(interaction,anims) { - class hide_spare: hide_spare { - positions[] = {{1,1.4,-0.5}}; - }; - }; - }; - class rhsusf_M1084A1P2_fmtv_usarmy: rhsusf_M1083A1P2_fmtv_usarmy { - class EGVAR(interaction,anims): EGVAR(interaction,anims) { - class hide_spare: hide_spare { - positions[] = {{1,1.8,0}}; - }; - }; - }; - class rhsusf_M1084A1P2_B_M2_fmtv_usarmy: rhsusf_M1083A1P2_B_M2_fmtv_usarmy { - class EGVAR(interaction,anims): EGVAR(interaction,anims) { - class hide_spare: hide_spare { - positions[] = {{1,1.8,-0.5}}; - }; - }; - }; - class rhsusf_M1085A1P2_B_Medical_fmtv_usarmy: rhsusf_M1083A1P2_B_fmtv_usarmy { - class EGVAR(interaction,anims): EGVAR(interaction,anims) { - class hide_spare: hide_spare { - positions[] = {{1,6.1,0}}; - }; - }; }; - class rhsusf_HEMTT_A4_base: Truck_01_base_F { - class EGVAR(interaction,anims) { - class hide_spare { - positions[] = {"_target selectionPosition 'sparewheel' vectorAdd [0.6,0.6,-0.4]"}; - items[] = {"ACE_Wheel"}; - }; - }; - }; - class rhsusf_M977A4_usarmy_wd: rhsusf_HEMTT_A4_base {}; + class rhsusf_M977A4_usarmy_wd; class rhsusf_M977A4_AMMO_usarmy_wd: rhsusf_M977A4_usarmy_wd { EGVAR(rearm,defaultSupply) = 1200; }; diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_refuel/CfgVehicles.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_refuel/CfgVehicles.hpp new file mode 100644 index 00000000000..445cab8226a --- /dev/null +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_refuel/CfgVehicles.hpp @@ -0,0 +1,52 @@ +class CfgVehicles { + class rhsusf_stryker_base; + class rhsusf_stryker_m1126_base: rhsusf_stryker_base { + class EGVAR(interaction,anims) { + class Hide_FCans { + positions[] = {{-0.7, -3, -0.4}}; + items[] = {"Land_CanisterFuel_F", "Land_CanisterFuel_F"}; + name = ECSTRING(refuel,TakeFuelCanister); + text = ECSTRING(refuel,TakeFuelCanisterAction); + }; + }; + }; + class rhsusf_stryker_m1127_base: rhsusf_stryker_m1126_base { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class Hide_FCans: Hide_FCans { + positions[] = {{-0.5, -3, -0.4}}; + }; + }; + }; + + class rhsusf_stryker_m1126_m2_base: rhsusf_stryker_m1126_base {}; + class rhsusf_stryker_m1132_m2_base: rhsusf_stryker_m1126_m2_base { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class Hide_FCans: Hide_FCans { + positions[] = {{-1, -4, -0.4}}; + }; + }; + }; + class rhsusf_stryker_m1134_base: rhsusf_stryker_m1132_m2_base { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class Hide_FCans: Hide_FCans { + positions[] = {{-0.7, -3, -0.7}}; + }; + }; + }; + + class rhsusf_m1a2tank_base; + class rhsusf_m1a2sep2_base: rhsusf_m1a2tank_base { + class EGVAR(interaction,anims) { + class fuelcans_hide { + // Rotate interactions with turret rotation + positions[] = { + "[0.23, -0.6, 0] vectorAdd ([[1.1, -3.6, 0.6], [0, 0, 1], deg (_target animationPhase 'MainTurret')] call CBA_fnc_vectRotate3D)", + "[0.23, -0.6, 0] vectorAdd ([[-1.1, -3.6, 0.6], [0, 0, 1], deg (_target animationPhase 'MainTurret')] call CBA_fnc_vectRotate3D)" + }; + items[] = {"Land_CanisterFuel_F", "Land_CanisterFuel_F"}; + name = ECSTRING(refuel,TakeFuelCanister); + text = ECSTRING(refuel,TakeFuelCanisterAction); + }; + }; + }; +}; diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_refuel/config.cpp b/addons/compat_rhs_usf3/compat_rhs_usf3_refuel/config.cpp index bf600d5d5ae..391e22d95e8 100644 --- a/addons/compat_rhs_usf3/compat_rhs_usf3_refuel/config.cpp +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_refuel/config.cpp @@ -21,3 +21,4 @@ class CfgPatches { }; #include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_repair/CfgVehicles.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_repair/CfgVehicles.hpp new file mode 100644 index 00000000000..26341db1da4 --- /dev/null +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_repair/CfgVehicles.hpp @@ -0,0 +1,126 @@ +class CfgVehicles { + class Truck_01_base_F; + class rhsusf_fmtv_base: Truck_01_base_F { + class EGVAR(interaction,anims) { + class hide_spare { + positions[] = {{1, 1.4, 0}}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; + class rhsusf_M1078A1P2_fmtv_usarmy: rhsusf_fmtv_base {}; + class rhsusf_M1078A1P2_B_fmtv_usarmy: rhsusf_M1078A1P2_fmtv_usarmy {}; + class rhsusf_M1078A1P2_B_M2_fmtv_usarmy: rhsusf_M1078A1P2_B_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + positions[] = {{1, 1.4, -0.5}}; + }; + }; + }; + class rhsusf_M1078A1R_SOV_M2_D_fmtv_socom: rhsusf_M1078A1P2_B_M2_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + positions[] = {{1, 1, -0.5}}; + }; + }; + }; + class rhsusf_M1083A1P2_fmtv_usarmy: rhsusf_M1078A1P2_fmtv_usarmy {}; + class rhsusf_M1083A1P2_B_fmtv_usarmy: rhsusf_M1083A1P2_fmtv_usarmy {}; + class rhsusf_M1083A1P2_B_M2_fmtv_usarmy: rhsusf_M1083A1P2_B_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + positions[] = {{1, 1.4, -0.5}}; + }; + }; + }; + class rhsusf_M1084A1P2_fmtv_usarmy: rhsusf_M1083A1P2_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + positions[] = {{1, 1.8, 0}}; + }; + }; + }; + class rhsusf_M1084A1P2_B_M2_fmtv_usarmy: rhsusf_M1083A1P2_B_M2_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + positions[] = {{1, 1.8, -0.5}}; + }; + }; + }; + class rhsusf_M1085A1P2_B_Medical_fmtv_usarmy: rhsusf_M1083A1P2_B_fmtv_usarmy { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class hide_spare: hide_spare { + positions[] = {{1, 6.1, 0}}; + }; + }; + }; + + class rhsusf_HEMTT_A4_base: Truck_01_base_F { + class EGVAR(interaction,anims) { + class hide_spare { + positions[] = {"_target selectionPosition 'sparewheel' vectorAdd [0.6, 0.6, -0.4]"}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; + + class MRAP_01_base_F; + class rhsusf_m1151_base: MRAP_01_base_F { + class EGVAR(interaction,anims) { + class hide_spare { + positions[] = {"_target selectionPosition 'sparewheel' vectorAdd [-0.465, 0, 0]"}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; + // Don't inherit, as it's easier for the trenches compat + class rhsusf_M1165A1_GMV_SAG2_base: rhsusf_m1151_base { + class EGVAR(interaction,anims) { + class hide_spare { + positions[] = {"_target selectionPosition 'sparewheel_gmv' vectorAdd [0, -0.44, 0]"}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; + + class rhsusf_rg33_base: MRAP_01_base_F { + class EGVAR(interaction,anims) { + class hide_spare { + selections[] = {"sparewheel"}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; + + class rhsusf_M1239_base: MRAP_01_base_F { + class EGVAR(interaction,anims) { + class hide_spare { + selections[] = {"sparewheel"}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; + + class rhsusf_MATV_base: MRAP_01_base_F { + class EGVAR(interaction,anims) { + class hide_spare { + selections[] = {"sparewheel"}; + items[] = {"ACE_Wheel"}; + name = ECSTRING(repair,RemoveWheel); + text = ECSTRING(repair,RemovingWheel); + }; + }; + }; +}; diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_repair/config.cpp b/addons/compat_rhs_usf3/compat_rhs_usf3_repair/config.cpp new file mode 100644 index 00000000000..b204f64166a --- /dev/null +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_repair/config.cpp @@ -0,0 +1,23 @@ +#include "script_component.hpp" + +class CfgPatches { + class SUBADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "rhsusf_main_loadorder", + "ace_repair" + }; + skipWhenMissingDependencies = 1; + author = ECSTRING(common,ACETeam); + authors[] = {"johnb43"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + + addonRootClass = QUOTE(ADDON); + }; +}; + +#include "CfgVehicles.hpp" diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_repair/script_component.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_repair/script_component.hpp new file mode 100644 index 00000000000..1af928486c3 --- /dev/null +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_repair/script_component.hpp @@ -0,0 +1,3 @@ +#define SUBCOMPONENT repair +#define SUBCOMPONENT_BEAUTIFIED Repair +#include "..\script_component.hpp" diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_trenches/CfgVehicles.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_trenches/CfgVehicles.hpp new file mode 100644 index 00000000000..ba4dd16cd72 --- /dev/null +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_trenches/CfgVehicles.hpp @@ -0,0 +1,48 @@ +class CfgVehicles { + class rhsusf_stryker_base; + class rhsusf_stryker_m1126_base: rhsusf_stryker_base { + class EGVAR(interaction,anims) { + class Hide_PioKit { + positions[] = {{-1, -2.2, -0.5}}; + items[] = {"ACE_EntrenchingTool"}; + name = ECSTRING(trenches,EntrenchingToolName); + text = ECSTRING(trenches,EntrenchingToolName); + }; + }; + }; + class rhsusf_stryker_m1127_base: rhsusf_stryker_m1126_base { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class Hide_PioKit: Hide_PioKit { + positions[] = {{-0.8, -2.2, -0.5}}; + }; + }; + }; + + class rhsusf_stryker_m1126_m2_base: rhsusf_stryker_m1126_base {}; + class rhsusf_stryker_m1132_m2_base: rhsusf_stryker_m1126_m2_base { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class Hide_PioKit: Hide_PioKit { + positions[] = {{-1.3, -3.3, -0.5}}; + }; + }; + }; + class rhsusf_stryker_m1134_base: rhsusf_stryker_m1132_m2_base { + class EGVAR(interaction,anims): EGVAR(interaction,anims) { + class Hide_PioKit: Hide_PioKit { + positions[] = {{-1, -2.2, -0.8}}; + }; + }; + }; + + class rhsusf_m1151_base; + class rhsusf_M1165A1_GMV_SAG2_base: rhsusf_m1151_base { + class EGVAR(interaction,anims) { + class tools_hide { + positions[] = {{0.365, 1.5, -0.4}}; + items[] = {"ACE_EntrenchingTool"}; + name = ECSTRING(trenches,EntrenchingToolName); + text = ECSTRING(trenches,EntrenchingToolName); + }; + }; + }; +}; diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_trenches/config.cpp b/addons/compat_rhs_usf3/compat_rhs_usf3_trenches/config.cpp new file mode 100644 index 00000000000..aea4c9daeb0 --- /dev/null +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_trenches/config.cpp @@ -0,0 +1,23 @@ +#include "script_component.hpp" + +class CfgPatches { + class SUBADDON { + name = COMPONENT_NAME; + units[] = {}; + weapons[] = {}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "rhsusf_main_loadorder", + "ace_trenches" + }; + skipWhenMissingDependencies = 1; + author = ECSTRING(common,ACETeam); + authors[] = {"johnb43"}; + url = ECSTRING(main,URL); + VERSION_CONFIG; + + addonRootClass = QUOTE(ADDON); + }; +}; + +#include "CfgVehicles.hpp" diff --git a/addons/compat_rhs_usf3/compat_rhs_usf3_trenches/script_component.hpp b/addons/compat_rhs_usf3/compat_rhs_usf3_trenches/script_component.hpp new file mode 100644 index 00000000000..10b90eb71e5 --- /dev/null +++ b/addons/compat_rhs_usf3/compat_rhs_usf3_trenches/script_component.hpp @@ -0,0 +1,3 @@ +#define SUBCOMPONENT trenches +#define SUBCOMPONENT_BEAUTIFIED Trenches +#include "..\script_component.hpp" diff --git a/addons/interaction/CfgVehicles.hpp b/addons/interaction/CfgVehicles.hpp index caf8fd8b6f7..b3a0c1d37e1 100644 --- a/addons/interaction/CfgVehicles.hpp +++ b/addons/interaction/CfgVehicles.hpp @@ -375,8 +375,10 @@ class CfgVehicles { class Offroad_01_base_F: Car_F { class GVAR(anims) { class HideBackpacks { - positions[] = {{-1.15,-1.15,-0.2}, {1.1,-1.15,-0.2}, {1.1,-2.5,-0.2}}; + positions[] = {{-1.15, -1.15, -0.2}, {1.1, -1.15, -0.2}, {1.1, -2.5, -0.2}}; items[] = {"B_TacticalPack_blk", "B_TacticalPack_blk", "B_Carryall_khk", "B_Carryall_khk"}; + name = "$STR_a3_cfgvehicleclasses_backpacks0"; + text = "$STR_a3_cfgvehicleclasses_backpacks0"; }; }; }; @@ -418,8 +420,15 @@ class CfgVehicles { class GVAR(anims) { class showBags { phase = 0; - positions[] = {{-0.685,-2.863,0.218}, {0.685,-2.863,0.218}}; + // Rotate interactions with turret rotation + positions[] = { + "[0, -1.6, 0] vectorAdd ([[1, -1, 0.1], [0, 0, 1], deg (_target animationPhase 'MainTurret')] call CBA_fnc_vectRotate3D)", + "[0, -1.6, 0] vectorAdd ([[-1, -1, 0.1], [0, 0, 1], deg (_target animationPhase 'MainTurret')] call CBA_fnc_vectRotate3D)" + }; + selections[] = {"vhc_bags"}; items[] = {"B_Carryall_cbr", "B_Carryall_cbr"}; + name = "$STR_a3_cfgvehicleclasses_backpacks0"; + text = "$STR_a3_cfgvehicleclasses_backpacks0"; }; }; }; @@ -432,6 +441,8 @@ class CfgVehicles { phase = 0; selections[] = {"vhc_bags"}; items[] = {"B_Carryall_cbr"}; + name = "$STR_BACKPACK_CONTAINER_NAME"; + text = "$STR_BACKPACK_CONTAINER_NAME"; }; }; }; @@ -441,6 +452,8 @@ class CfgVehicles { phase = 0; selections[] = {"vhc_bags"}; items[] = {"B_Carryall_cbr", "B_Carryall_cbr"}; + name = "$STR_a3_cfgvehicleclasses_backpacks0"; + text = "$STR_a3_cfgvehicleclasses_backpacks0"; }; }; }; @@ -479,6 +492,8 @@ class CfgVehicles { phase = 0; selections[] = {"vhc_bags"}; items[] = {"B_Carryall_cbr"}; + name = "$STR_BACKPACK_CONTAINER_NAME"; + text = "$STR_BACKPACK_CONTAINER_NAME"; }; class showBags2: showBags { selections[] = {"vhc_bags2"}; @@ -494,7 +509,10 @@ class CfgVehicles { class showBags { phase = 0; selections[] = {"vhc_bags"}; + positions[] = {"private _pos = _target selectionPosition 'vhc_bags'; _pos set [0, -(_pos select 0)]; _pos"}; // Mirror position to other side of vehicle items[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; + name = "$STR_a3_cfgvehicleclasses_backpacks0"; + text = "$STR_a3_cfgvehicleclasses_backpacks0"; }; }; }; @@ -516,6 +534,8 @@ class CfgVehicles { phase = 0; selections[] = {"vhc_bags"}; items[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; + name = "$STR_a3_cfgvehicleclasses_backpacks0"; + text = "$STR_a3_cfgvehicleclasses_backpacks0"; }; }; }; @@ -526,6 +546,8 @@ class CfgVehicles { phase = 0; selections[] = {"vhc_bags"}; items[] = {"B_Carryall_cbr", "B_Carryall_cbr"}; + name = "$STR_a3_cfgvehicleclasses_backpacks0"; + text = "$STR_a3_cfgvehicleclasses_backpacks0"; }; }; }; @@ -540,6 +562,8 @@ class CfgVehicles { phase = 0; selections[] = {"vhc_bags"}; items[] = {"B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr", "B_Carryall_cbr"}; + name = "$STR_a3_cfgvehicleclasses_backpacks0"; + text = "$STR_a3_cfgvehicleclasses_backpacks0"; }; }; }; diff --git a/addons/refuel/CfgVehicles.hpp b/addons/refuel/CfgVehicles.hpp index 35d4fe8d67a..dbbcaf04d1c 100644 --- a/addons/refuel/CfgVehicles.hpp +++ b/addons/refuel/CfgVehicles.hpp @@ -245,8 +245,10 @@ class CfgVehicles { class EGVAR(interaction,anims): EGVAR(interaction,anims) { class showCanisters { phase = 0; - positions[] = {{-1.188,-3.87,-0.769}, {1.638,-3.87,-0.769}}; + positions[] = {{-1.188, -3.87, -0.769}, {1.638, -3.87, -0.769}}; items[] = {"Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F"}; + name = CSTRING(TakeFuelCanister); + text = CSTRING(TakeFuelCanisterAction); }; }; }; @@ -342,8 +344,15 @@ class CfgVehicles { class EGVAR(interaction,anims): EGVAR(interaction,anims) { class showCanisters { phase = 0; - positions[] = {{-2,-1.95,-1}, {2,-1.95,-1}, {1.7,-4.898,-0.4}}; + // Rotate interactions with turret rotation + positions[] = { + "[0, -2.5, 0] vectorAdd ([[1.6, -2.4, -0.3], [0, 0, 1], deg (_target animationPhase 'MainTurret')] call CBA_fnc_vectRotate3D)", + "[0, -2.5, 0] vectorAdd ([[1.8, 0.55, -0.7], [0, 0, 1], deg (_target animationPhase 'MainTurret')] call CBA_fnc_vectRotate3D)", + "[0, -2.5, 0] vectorAdd ([[-1.8, 0.55, -0.7], [0, 0, 1], deg (_target animationPhase 'MainTurret')] call CBA_fnc_vectRotate3D)" + }; items[] = {"Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F", "Land_CanisterFuel_F"}; + name = CSTRING(TakeFuelCanister); + text = CSTRING(TakeFuelCanisterAction); }; }; }; @@ -355,8 +364,11 @@ class CfgVehicles { class EGVAR(interaction,anims): EGVAR(interaction,anims) { class showCanisters { phase = 0; - positions[] = {{1.7,-4.8,-0.5}}; + // Rotate interactions with turret rotation + positions[] = {"[0, -2.1, 0] vectorAdd ([[1.6, -2.65, -0.3], [0, 0, 1], deg (_target animationPhase 'MainTurret')] call CBA_fnc_vectRotate3D)"}; items[] = {"Land_CanisterFuel_F"}; + name = CSTRING(TakeFuelCanister); + text = CSTRING(TakeFuelCanisterAction); }; }; }; diff --git a/addons/repair/CfgVehicles.hpp b/addons/repair/CfgVehicles.hpp index 634cf9fac60..6172b726797 100644 --- a/addons/repair/CfgVehicles.hpp +++ b/addons/repair/CfgVehicles.hpp @@ -434,8 +434,10 @@ class CfgVehicles { class EGVAR(interaction,anims) { class showTracks { phase = 0; - positions[] = {{-1.7,-3.875,-0.7}, {1.7,-3.875,-0.7}}; + positions[] = {{-1.7, -3.875, -0.7}, {1.7, -3.875, -0.7}}; items[] = {"ACE_Track", "ACE_Track", "ACE_Track"}; + name = CSTRING(RemoveTrack); + text = CSTRING(RemovingTrack); }; }; }; @@ -448,6 +450,8 @@ class CfgVehicles { class hideSpareWheel { selections[] = {"spare_wheel"}; items[] = {"ACE_Wheel"}; + name = CSTRING(RemoveWheel); + text = CSTRING(RemovingWheel); }; }; }; @@ -469,6 +473,28 @@ class CfgVehicles { }; }; + class Truck_01_viv_base_F; + class Truck_01_cargo_base_F: Truck_01_viv_base_F { + class EGVAR(interaction,anims) { + class Tyre1_hide { + selections[] = {"tyre1_hide"}; + items[] = {"ACE_Wheel"}; + name = CSTRING(RemoveWheel); + text = CSTRING(RemovingWheel); + }; + }; + }; + class Truck_01_flatbed_base_F: Truck_01_viv_base_F { + class EGVAR(interaction,anims) { + class Tyre1_hide { + selections[] = {"tyre1_hide"}; + items[] = {"ACE_Wheel"}; + name = CSTRING(RemoveWheel); + text = CSTRING(RemovingWheel); + }; + }; + }; + class Quadbike_01_base_F: Car_F { GVAR(hitpointPositions)[] = { {"HitEngine", {0, 0.5, -0.7}}, {"HitFuel", {0, 0, -0.5}} }; }; @@ -479,8 +505,10 @@ class CfgVehicles { class Van_02_base_F: Truck_F { class EGVAR(interaction,anims) { class spare_tyre_hide { - positions[] = {{-0.45,-3.5,-0.4}}; + positions[] = {"[[-1.2, -3.7, -0.4], [-0.45, -3.5, -0.4]] select (_target animationPhase 'Door_4_source' == 0)"}; items[] = {"ACE_Wheel"}; + name = CSTRING(RemoveWheel); + text = CSTRING(RemovingWheel); }; }; }; diff --git a/addons/trenches/CfgVehicles.hpp b/addons/trenches/CfgVehicles.hpp index fb644697a34..554a75149b8 100644 --- a/addons/trenches/CfgVehicles.hpp +++ b/addons/trenches/CfgVehicles.hpp @@ -115,8 +115,10 @@ class CfgVehicles { class EGVAR(interaction,anims): EGVAR(interaction,anims) { class showTools { phase = 0; - positions[] = {{-1.108,-1.47,-0.769}}; + positions[] = {{-1.108, -1.47, -0.769}}; items[] = {"ACE_EntrenchingTool"}; + name = CSTRING(EntrenchingToolName); + text = CSTRING(EntrenchingToolName); }; }; }; @@ -124,18 +126,23 @@ class CfgVehicles { class EGVAR(interaction,anims) { class showTools { phase = 0; - positions[] = {{-0.9,-3,-0.5}}; + positions[] = {{-0.9, -3, -0.5}}; items[] = {"ACE_EntrenchingTool"}; + name = CSTRING(EntrenchingToolName); + text = CSTRING(EntrenchingToolName); }; }; }; + class Tank_F; class LT_01_base_F: Tank_F { class EGVAR(interaction,anims) { class showTools { phase = 0; - positions[] = {{0.6,0,-0.3}}; + positions[] = {{0.6, 0, -0.3}}; items[] = {"ACE_EntrenchingTool"}; + name = CSTRING(EntrenchingToolName); + text = CSTRING(EntrenchingToolName); }; }; }; From 1d0aa16b737cd4c5ed98ed3d5a96db0d2dac373e Mon Sep 17 00:00:00 2001 From: johnb432 <58661205+johnb432@users.noreply.github.com> Date: Fri, 9 Aug 2024 22:12:11 +0200 Subject: [PATCH 23/23] Reverted preInit change --- addons/compat_rhs_afrf3/XEH_preInit.sqf | 8 ++++++++ .../compat_rhs_afrf3_repair/CfgEventHandlers.hpp | 5 ----- .../compat_rhs_afrf3_repair/XEH_preInit.sqf | 11 ----------- .../compat_rhs_afrf3_repair/config.cpp | 1 - 4 files changed, 8 insertions(+), 17 deletions(-) delete mode 100644 addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/CfgEventHandlers.hpp delete mode 100644 addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/XEH_preInit.sqf diff --git a/addons/compat_rhs_afrf3/XEH_preInit.sqf b/addons/compat_rhs_afrf3/XEH_preInit.sqf index b47cf6628db..2ca4338e90c 100644 --- a/addons/compat_rhs_afrf3/XEH_preInit.sqf +++ b/addons/compat_rhs_afrf3/XEH_preInit.sqf @@ -6,4 +6,12 @@ PREP_RECOMPILE_START; #include "XEH_PREP.hpp" PREP_RECOMPILE_END; +// Disable RHS' wheel replacement mechanic +if (["ace_repair"] call EFUNC(common,isModLoaded)) then { + RHS_Retread_Enabled = false; + rhs_btr70_EnableRetread = false; + rhs_TypeTirePressure = 1; + RHS_BTR_Effects_Init = true; +}; + ADDON = true; diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/CfgEventHandlers.hpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/CfgEventHandlers.hpp deleted file mode 100644 index 9b160c16000..00000000000 --- a/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/CfgEventHandlers.hpp +++ /dev/null @@ -1,5 +0,0 @@ -class Extended_PreInit_EventHandlers { - class ADDON { - init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); - }; -}; diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/XEH_preInit.sqf b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/XEH_preInit.sqf deleted file mode 100644 index 13de860b534..00000000000 --- a/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/XEH_preInit.sqf +++ /dev/null @@ -1,11 +0,0 @@ -#include "script_component.hpp" - -ADDON = false; - -// Disable RHS' wheel replacement mechanic -RHS_Retread_Enabled = false; -rhs_btr70_EnableRetread = false; -rhs_TypeTirePressure = 1; -RHS_BTR_Effects_Init = true; - -ADDON = true; diff --git a/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/config.cpp b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/config.cpp index 65f2af1aa4e..d6d4fab1077 100644 --- a/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/config.cpp +++ b/addons/compat_rhs_afrf3/compat_rhs_afrf3_repair/config.cpp @@ -18,5 +18,4 @@ class CfgPatches { }; }; -#include "CfgEventHandlers.hpp" #include "CfgVehicles.hpp"