Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Ported the ACE2 Tripod #1509

Merged
merged 3 commits into from
Jun 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/tripod/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
z\ace\addons\tripod
19 changes: 19 additions & 0 deletions addons/tripod/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -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));
};
};
};
93 changes: 93 additions & 0 deletions addons/tripod/CfgVehicles.hpp
Original file line number Diff line number Diff line change
@@ -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,0};
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);
};
};
};
};
};
18 changes: 18 additions & 0 deletions addons/tripod/CfgWeapons.hpp
Original file line number Diff line number Diff line change
@@ -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;
};
};
};
10 changes: 10 additions & 0 deletions addons/tripod/README.md
Original file line number Diff line number Diff line change
@@ -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)
Binary file added addons/tripod/UI/w_sniper_tripod_ca.paa
Binary file not shown.
16 changes: 16 additions & 0 deletions addons/tripod/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -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);
10 changes: 10 additions & 0 deletions addons/tripod/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "script_component.hpp"

ADDON = false;

PREP(adjust);
PREP(handleScrollWheel);
PREP(pickup);
PREP(place);

ADDON = true;
16 changes: 16 additions & 0 deletions addons/tripod/config.cpp
Original file line number Diff line number Diff line change
@@ -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"
64 changes: 64 additions & 0 deletions addons/tripod/data/model.cfg
Original file line number Diff line number Diff line change
@@ -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";
};
};
};
};
Binary file added addons/tripod/data/nipertripod_co.paa
Binary file not shown.
Binary file added addons/tripod/data/sniper_tripod.p3d
Binary file not shown.
Binary file added addons/tripod/data/w_sniper_tripod.p3d
Binary file not shown.
43 changes: 43 additions & 0 deletions addons/tripod/functions/fnc_adjust.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Author: Ruthberg
*
* Adjust tripod height
*
* Arguments:
* 0: tripod <OBJECT>
*
* 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)];
24 changes: 24 additions & 0 deletions addons/tripod/functions/fnc_handleScrollWheel.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Author: Garth 'L-H' de Wet, Ruthberg
* Handles sandbag rotation
*
* Arguments:
* 0: scroll amount <NUMBER>
*
* Return Value:
* handled <BOOL>
*
* 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
30 changes: 30 additions & 0 deletions addons/tripod/functions/fnc_pickup.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Author: Rocko, Ruthberg
*
* Pick up tripod
*
* Arguments:
* 0: tripod <OBJECT>
* 1: unit <OBJECT>
*
* 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);
Loading