diff --git a/addons/tripod/$PBOPREFIX$ b/addons/tripod/$PBOPREFIX$ new file mode 100644 index 0000000000..0ca718ad15 --- /dev/null +++ b/addons/tripod/$PBOPREFIX$ @@ -0,0 +1 @@ +z\ace\addons\concertina_wire \ No newline at end of file diff --git a/addons/tripod/CfgEventHandlers.hpp b/addons/tripod/CfgEventHandlers.hpp new file mode 100644 index 0000000000..ed5027f094 --- /dev/null +++ b/addons/tripod/CfgEventHandlers.hpp @@ -0,0 +1,19 @@ +class Extended_PreInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_preInit) ); + }; +}; + +class Extended_PostInit_EventHandlers { + class ADDON { + init = QUOTE( call COMPILE_FILE(XEH_postInit) ); + }; +}; + +class Extended_Init_EventHandlers { + class ACE_TripodObject { + class ADDON { + init = QUOTE(_this call DEFUNC(dragging,initObject)); + }; + }; +}; diff --git a/addons/tripod/CfgVehicles.hpp b/addons/tripod/CfgVehicles.hpp new file mode 100644 index 0000000000..36ea3f10e4 --- /dev/null +++ b/addons/tripod/CfgVehicles.hpp @@ -0,0 +1,93 @@ + +class CfgVehicles { + class Man; + class CAManBase: Man { + class ACE_SelfActions { + class ACE_Equipment { + class GVAR(place) { + displayName = CSTRING(Placedown); + condition = QUOTE([ARR_2(_player,'ACE_Tripod')] call EFUNC(common,hasItem)); + statement = QUOTE([ARR_2(_player,'ACE_Tripod')] call FUNC(place)); + showDisabled = 0; + priority = 2; + icon = PATHTOF(UI\w_sniper_tripod_ca.paa); + exceptions[] = {"isNotInside"}; + }; + }; + }; + }; + + class Item_Base_F; + class ACE_Item_Tripod: Item_Base_F { + author[] = {"Rocko", "Scubaman3D"}; + scope = 2; + scopeCurator = 2; + displayName = CSTRING(DisplayName); + vehicleClass = "Items"; + class TransportItems { + class ACE_Tripod { + name = "ACE_Tripod"; + count = 1; + }; + }; + }; + + class Box_NATO_Support_F; + class ACE_Box_Misc: Box_NATO_Support_F { + class TransportItems { + MACRO_ADDITEM(ACE_Tripod,2); + }; + }; + + class thingX; + class ACE_TripodObject: thingX { + XEH_ENABLED; + scope = 2; + displayName = CSTRING(DisplayName); + model = PATHTOF(data\sniper_tripod.p3d); + class AnimationSources { + class slide_down_tripod { + source = "user"; + animPeriod = 0.02; + initPhase = 0; + minValue = 0; + maxValue = 1; + }; + class retract_leg_1: slide_down_tripod {}; + class retract_leg_2: retract_leg_1 {}; + class retract_leg_3: retract_leg_2 {}; + }; + EGVAR(dragging,canDrag) = 1; + EGVAR(dragging,dragPosition[]) = {0,1,1.5}; + EGVAR(dragging,dragDirection) = 0; + class ACE_Actions { + class ACE_MainActions { + selection = ""; + distance = 5; + condition = "true"; + class ACE_Pickup { + selection = ""; + displayName = CSTRING(PickUp); + distance = 5; + condition = "true"; + statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickup)); + showDisabled = 0; + exceptions[] = {}; + priority = 5; + icon = PATHTOF(UI\w_sniper_tripod_ca.paa); + }; + class ACE_Adjust { + selection = ""; + displayName = CSTRING(Adjust); + distance = 5; + condition = "true"; + statement = QUOTE(_target call FUNC(adjust)); + showDisabled = 0; + exceptions[] = {}; + priority = 5; + icon = PATHTOF(UI\w_sniper_tripod_ca.paa); + }; + }; + }; + }; +}; diff --git a/addons/tripod/CfgWeapons.hpp b/addons/tripod/CfgWeapons.hpp new file mode 100644 index 0000000000..cc7521f0f2 --- /dev/null +++ b/addons/tripod/CfgWeapons.hpp @@ -0,0 +1,18 @@ + +class CfgWeapons { + class ACE_ItemCore; + class InventoryItem_Base_F; + + class ACE_Tripod: ACE_ItemCore { + author[] = {"Rocko", "Scubaman3D"}; + scope = 2; + displayName = CSTRING(DisplayName); + descriptionShort = ""; + model = PATHTOF(data\w_sniper_tripod.p3d); + picture = PATHTOF(UI\w_sniper_tripod_ca.paa); + + class ItemInfo: InventoryItem_Base_F { + mass = 40; + }; + }; +}; diff --git a/addons/tripod/README.md b/addons/tripod/README.md new file mode 100644 index 0000000000..1f4282f1ab --- /dev/null +++ b/addons/tripod/README.md @@ -0,0 +1,10 @@ +ace_tripod +=============== + +Adds a packable tripod. + +## Maintainers + +The people responsible for merging changes to this component or answering potential questions. + +- [Ruthberg] (http://github.com/Ulteq) \ No newline at end of file diff --git a/addons/tripod/UI/w_sniper_tripod_ca.paa b/addons/tripod/UI/w_sniper_tripod_ca.paa new file mode 100644 index 0000000000..a7ea6b0c31 Binary files /dev/null and b/addons/tripod/UI/w_sniper_tripod_ca.paa differ diff --git a/addons/tripod/XEH_postInit.sqf b/addons/tripod/XEH_postInit.sqf new file mode 100644 index 0000000000..706aaecae9 --- /dev/null +++ b/addons/tripod/XEH_postInit.sqf @@ -0,0 +1,16 @@ +#include "script_component.hpp" + +GVAR(adjuster) = objNull; +GVAR(adjusting) = false; +GVAR(adjustPFH) = -1; + +GVAR(height) = 0; + +// Cancel adjustment if interact menu opens +["interactMenuOpened", { + if (GVAR(adjustPFH) != -1 && GVAR(adjusting)) then { + GVAR(adjusting) = false; + }; +}] call EFUNC(common,addEventHandler); + +[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler); diff --git a/addons/tripod/XEH_preInit.sqf b/addons/tripod/XEH_preInit.sqf new file mode 100644 index 0000000000..f27b707936 --- /dev/null +++ b/addons/tripod/XEH_preInit.sqf @@ -0,0 +1,10 @@ +#include "script_component.hpp" + +ADDON = false; + +PREP(adjust); +PREP(handleScrollWheel); +PREP(pickup); +PREP(place); + +ADDON = true; diff --git a/addons/tripod/config.cpp b/addons/tripod/config.cpp new file mode 100644 index 0000000000..80379019c3 --- /dev/null +++ b/addons/tripod/config.cpp @@ -0,0 +1,16 @@ +#include "script_component.hpp" + +class CfgPatches { + class ADDON { + units[] = {"ACE_Item_Tripod"}; + weapons[] = {"ACE_Tripod"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = {"ace_interaction"}; + author[] = {"Rocko", "Scubaman3D", "Ruthberg"}; + VERSION_CONFIG; + }; +}; + +#include "CfgEventHandlers.hpp" +#include "CfgVehicles.hpp" +#include "CfgWeapons.hpp" \ No newline at end of file diff --git a/addons/tripod/data/model.cfg b/addons/tripod/data/model.cfg new file mode 100644 index 0000000000..ee81d26c8e --- /dev/null +++ b/addons/tripod/data/model.cfg @@ -0,0 +1,64 @@ +class CfgSkeletons +{ + class Default { + isDiscrete = 1; + skeletonInherit = ""; + skeletonBones[] = {}; + }; + class ace_snipertripod_skeleton: Default { + isDiscrete = 1; + skeletonInherit = "Default"; + skeletonBones[] = { + "tripod","", + "leg_1","tripod", + "leg_2","tripod", + "leg_3","tripod", + "leg_slide_1","leg_1", + "leg_slide_2","leg_2", + "leg_slide_3","leg_3" + }; + }; +}; +class CfgModels { + class Default { + sectionsInherit = ""; + sections[] = {}; + skeletonName = ""; + }; + class sniper_tripod: Default { + skeletonName = "ace_snipertripod_skeleton"; + sectionsInherit = "Default"; + class animations { + class slide_down_tripod { + type = "translation"; + selection = "tripod"; + source = "user"; + begin = "slide_end"; + end = "slide_start"; + memory = 1; + minValue = 0; + maxValue = 1; + sourceAddress = "clamp"; + offset0 = 0; + offset1 = 0.855; + }; + class retract_leg_1: slide_down_tripod { + selection = "leg_slide_1"; + begin = "slide_end_1"; + end = "slide_start_1"; + offset0 = 0; + offset1 = -0.95; + }; + class retract_leg_2: retract_leg_1 { + selection = "leg_slide_2"; + begin = "slide_end_2"; + end = "slide_start_2"; + }; + class retract_leg_3: retract_leg_2 { + selection = "leg_slide_3"; + begin = "slide_end_3"; + end = "slide_start_3"; + }; + }; + }; +}; diff --git a/addons/tripod/data/nipertripod_co.paa b/addons/tripod/data/nipertripod_co.paa new file mode 100644 index 0000000000..6f0cbaacf0 Binary files /dev/null and b/addons/tripod/data/nipertripod_co.paa differ diff --git a/addons/tripod/data/sniper_tripod.p3d b/addons/tripod/data/sniper_tripod.p3d new file mode 100644 index 0000000000..5deab7067a Binary files /dev/null and b/addons/tripod/data/sniper_tripod.p3d differ diff --git a/addons/tripod/data/w_sniper_tripod.p3d b/addons/tripod/data/w_sniper_tripod.p3d new file mode 100644 index 0000000000..65758ea807 Binary files /dev/null and b/addons/tripod/data/w_sniper_tripod.p3d differ diff --git a/addons/tripod/functions/fnc_adjust.sqf b/addons/tripod/functions/fnc_adjust.sqf new file mode 100644 index 0000000000..ce50d38cf0 --- /dev/null +++ b/addons/tripod/functions/fnc_adjust.sqf @@ -0,0 +1,43 @@ +/* + * Author: Ruthberg + * + * Adjust tripod height + * + * Arguments: + * 0: tripod + * + * Return Value: + * Nothing + * + * Return value: + * None + */ +#include "script_component.hpp" + +PARAMS_1(_tripod); + +GVAR(adjuster) = ACE_player; +GVAR(adjusting) = true; + +GVAR(adjustPFH) = [{ + EXPLODE_1_PVT(_this select 0,_tripod); + + if (GVAR(adjuster) != ACE_player || !GVAR(adjusting)) exitWith { + call EFUNC(interaction,hideMouseHint); + [ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Adjust), -1]] call EFUNC(Common,removeActionEventHandler); + [_this select 1] call cba_fnc_removePerFrameHandler; + }; + + { + _tripod animate [_x, 1 - GVAR(height)]; + } foreach ["slide_down_tripod", "retract_leg_1", "retract_leg_2", "retract_leg_3"]; + +}, 0, [_tripod]] call CBA_fnc_addPerFrameHandler; + +[localize "STR_ACE_Tripod_Done", "", localize "STR_ACE_Tripod_ScrollAction"] call EFUNC(interaction,showMouseHint); + +ACE_player setVariable [QGVAR(Adjust), + [ACE_player, "DefaultAction", + {GVAR(adjustPFH) != -1 && GVAR(adjusting)}, + {GVAR(adjusting) = false;} +] call EFUNC(common,AddActionEventHandler)]; diff --git a/addons/tripod/functions/fnc_handleScrollWheel.sqf b/addons/tripod/functions/fnc_handleScrollWheel.sqf new file mode 100644 index 0000000000..7399bf0c2c --- /dev/null +++ b/addons/tripod/functions/fnc_handleScrollWheel.sqf @@ -0,0 +1,24 @@ +/* + * Author: Garth 'L-H' de Wet, Ruthberg + * Handles sandbag rotation + * + * Arguments: + * 0: scroll amount + * + * Return Value: + * handled + * + * Example: + * 1.2 call ace_tripod_fnc_handleScrollWheel; + * + * Public: No + */ +#include "script_component.hpp" + +PARAMS_1(_scroll); + +if (GETMVAR(ACE_Modifier,0) == 0 || GVAR(adjustPFH) == -1) exitWith { false }; + +GVAR(height) = 0 max (GVAR(height) + (_scroll / 20)) min 1; + +true diff --git a/addons/tripod/functions/fnc_pickup.sqf b/addons/tripod/functions/fnc_pickup.sqf new file mode 100644 index 0000000000..44011e262a --- /dev/null +++ b/addons/tripod/functions/fnc_pickup.sqf @@ -0,0 +1,30 @@ +/* + * Author: Rocko, Ruthberg + * + * Pick up tripod + * + * Arguments: + * 0: tripod + * 1: unit + * + * Return Value: + * Nothing + * + * Return value: + * None + */ +#include "script_component.hpp" + +PARAMS_2(_tripod,_unit); + +if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { + _unit playMove "AmovPercMstpSrasWrflDnon_diary"; +}; + +[{ + PARAMS_2(_tripod,_unit); + + _unit addItem "ACE_Tripod"; + deleteVehicle _tripod; + +}, [_tripod, _unit], 1, 0]call EFUNC(common,waitAndExecute); diff --git a/addons/tripod/functions/fnc_place.sqf b/addons/tripod/functions/fnc_place.sqf new file mode 100644 index 0000000000..5e9c783589 --- /dev/null +++ b/addons/tripod/functions/fnc_place.sqf @@ -0,0 +1,50 @@ +/* + * Author: Rocko, Ruthberg + * + * Place down tripod + * + * Arguments: + * 0: unit + * 1: tripod class + * + * Return Value: + * Nothing + * + * Return value: + * None + */ +#include "script_component.hpp" + +PARAMS_2(_unit,_tripodClass); + +_unit removeItem _tripodClass; + +if ((_unit call CBA_fnc_getUnitAnim) select 0 == "stand") then { + _unit playMove "AmovPercMstpSrasWrflDnon_diary"; +}; + +[{ + PARAMS_1(_unit); + + private ["_direction", "_position", "_tripod"]; + _direction = getDir _unit; + _position = (getPosASL _unit) vectorAdd [0.8 * sin(_direction), 0.8 * cos(_direction), 0.02]; + + _tripod = "ACE_TripodObject" createVehicle [0, 0, 0]; + { + _tripod animate [_x, 1]; + } foreach ["slide_down_tripod", "retract_leg_1", "retract_leg_2", "retract_leg_3"]; + + [{ + EXPLODE_3_PVT(_this select 0,_tripod,_direction,_position); + if (_tripod animationPhase "slide_down_tripod" == 1) then { + _tripod setDir _direction; + _tripod setPosASL _position; + if ((getPosATL _tripod select 2) - (getPos _tripod select 2) < 1E-5) then { + _tripod setVectorUp (surfaceNormal (position _tripod)); + }; + [_this select 1] call CBA_fnc_removePerFrameHandler; + }; + }, 0, [_tripod, _direction, _position]] call CBA_fnc_addPerFrameHandler; + +}, [_unit], 1, 0] call EFUNC(common,waitAndExecute); diff --git a/addons/tripod/functions/script_component.hpp b/addons/tripod/functions/script_component.hpp new file mode 100644 index 0000000000..4fa165afc7 --- /dev/null +++ b/addons/tripod/functions/script_component.hpp @@ -0,0 +1 @@ +#include "\z\ace\addons\tripod\script_component.hpp" \ No newline at end of file diff --git a/addons/tripod/script_component.hpp b/addons/tripod/script_component.hpp new file mode 100644 index 0000000000..b160a14742 --- /dev/null +++ b/addons/tripod/script_component.hpp @@ -0,0 +1,12 @@ +#define COMPONENT tripod +#include "\z\ace\addons\main\script_mod.hpp" + +#ifdef DEBUG_ENABLED_TRIPOD + #define DEBUG_MODE_FULL +#endif + +#ifdef DEBUG_SETTINGS_TRIPOD + #define DEBUG_SETTINGS DEBUG_SETTINGS_TRIPOD +#endif + +#include "\z\ace\addons\main\script_macros.hpp" diff --git a/addons/tripod/stringtable.xml b/addons/tripod/stringtable.xml new file mode 100644 index 0000000000..69b30b7e98 --- /dev/null +++ b/addons/tripod/stringtable.xml @@ -0,0 +1,39 @@ + + + + + SSWT Kit + Scharfschützenzweibein + Снайперский штатив + Trójnóg snajperski + SSWT Kit + SSWT Kit + SSWT sada + SSWT Kit + SSWT Kit + + + Place SSWT Kit + Scharfschützenzweibein aufstellen + Установить снайперский штатив + Postaw trójnóg snajperski + Place SSWT Kit + Place SSWT Kit + Rozlož sadu SSWT + Place SSWT Kit + Place SSWT Kit + + + Pick up SSWT Kit + + + Adjust SSWT Kit + + + Done + + + + Modifier, adjust + + + \ No newline at end of file