Skip to content

Commit

Permalink
Merge pull request #1493 from acemod/tacticalladder
Browse files Browse the repository at this point in the history
Initial draft of the ACE2 tactical ladder port.
  • Loading branch information
ulteq committed Jun 13, 2015
2 parents 42f2d88 + 4160c76 commit b86e6b6
Show file tree
Hide file tree
Showing 22 changed files with 584 additions and 0 deletions.
Binary file added addons/apl/data/plech.paa
Binary file not shown.
1 change: 1 addition & 0 deletions addons/tacticalladder/$PBOPREFIX$
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
z\ace\addons\tacticalladder
11 changes: 11 additions & 0 deletions addons/tacticalladder/CfgEventHandlers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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) );
};
};
86 changes: 86 additions & 0 deletions addons/tacticalladder/CfgVehicles.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

class CfgVehicles {
class Man;
class CAManBase: Man {
class ACE_SelfActions {
class ACE_TacticalLadders {
displayName = $STR_ACE_DEPLOY_TACLADDER;
condition = QUOTE((backpack ACE_player) == QUOTE(QUOTE(ACE_TacticalLadder_Pack)));
statement = QUOTE(call FUNC(deployTL));
exceptions[] = {};
showDisabled = 1;
priority = 4;
};
};
};

class Bag_Base;
class ACE_TacticalLadder_Pack: Bag_Base {
scope = 2;
displayName = "$STR_ACE_TACTICALLADDER";
descriptionShort = "";
model = PATHTOF(data\ace_tacticalladder_pack.p3d);
picture = PATHTOF(UI\ace_tactical_ladder_pack_ca.paa);
maximumLoad = 0;
mass = 50;
};

class House;
class ACE_Tactical_Ladder: House {
XEH_ENABLED;
displayName = $STR_ACE_TACTICALLADDER;
class DestructionEffects {};
model = PATHTOF(data\ace_tacticalladder.p3d);
animated = 1;
autocenter = 0;
featureSize = 12;
ladders[] = {{"start","end"}};
class AnimationSources {
class rotate {
source = "user";
animPeriod = 1e-007;
};
class extract_1 {
source = "user";
animPeriod = 1e-007;
};
class extract_2: extract_1 {};
class extract_3: extract_1 {};
class extract_4: extract_1 {};
class extract_5: extract_1 {};
class extract_6: extract_1 {};
class extract_7: extract_1 {};
class extract_8: extract_1 {};
class extract_9: extract_1 {};
class extract_10: extract_1 {};
class extract_11: extract_1 {};
};
class ACE_Actions {
class ACE_MainActions {
selection = "roadway";
distance = 5;
condition = "true";
class ACE_PickUp {
selection = "";
displayName = "$STR_ACE_PICKUP_TACLADDER";
distance = 4;
condition = QUOTE((backpack ACE_player) == '');
statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickupTL));
showDisabled = 0;
exceptions[] = {};
priority = 5;
};
class ACE_Position {
selection = "";
displayName = "$STR_ACE_POSITION_TACLADDER";
distance = 4;
condition = "true";
statement = QUOTE([ARR_2(_target,_player)] call FUNC(positionTL));
showDisabled = 0;
exceptions[] = {};
priority = 5;
};
};
};
};
};
10 changes: 10 additions & 0 deletions addons/tacticalladder/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ace_tacticalladder
===============

Adds a packable tactical ladder.

## Maintainers

The people responsible for merging changes to this component or answering potential questions.

- [Ruthberg] (http://github.com/Ulteq)
Binary file not shown.
15 changes: 15 additions & 0 deletions addons/tacticalladder/XEH_postInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "script_component.hpp"

GVAR(ladder) = objNull;
GVAR(cancelTime) = 0;
GVAR(currentStep) = 3;
GVAR(currentAngle) = 0;

// Cancel tactical ladder deployment if the interact menu is opened
["interactMenuOpened", {
if ((ACE_time > GVAR(cancelTime)) && !isNull GVAR(ladder)) then {
GVAR(ladder) call FUNC(cancelTLdeploy);
};
}] call EFUNC(common,addEventHandler);

[{(_this select 0) call FUNC(handleScrollWheel);}] call EFUNC(Common,addScrollWheelEventHandler);
12 changes: 12 additions & 0 deletions addons/tacticalladder/XEH_preInit.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "script_component.hpp"

ADDON = false;

PREP(cancelTLdeploy);
PREP(confirmTLdeploy);
PREP(deployTL);
PREP(handleScrollWheel);
PREP(pickupTL);
PREP(positionTL);

ADDON = true;
15 changes: 15 additions & 0 deletions addons/tacticalladder/config.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "script_component.hpp"

class CfgPatches {
class ADDON {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_interaction"};
author[] = {"Rocko"};
VERSION_CONFIG;
};
};

#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
Binary file added addons/tacticalladder/data/ace_ladder_co.paa
Binary file not shown.
Binary file added addons/tacticalladder/data/ace_tacticalladder.p3d
Binary file not shown.
Binary file not shown.
137 changes: 137 additions & 0 deletions addons/tacticalladder/data/model.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
class CfgSkeletons {
class Default {
isDiscrete = 1;
skeletonInherit = "";
skeletonBones[] = {};
};
class ace_tacticalladder_skeleton: Default {
isDiscrete = 0;
skeletonInherit = "";
skeletonBones[] = {
"base","",
"1","base",
"2","1",
"3","2",
"4","3",
"5","4",
"6","5",
"7","6",
"8","7",
"9","8",
"10","9",
"11","10",
"step","11"
};
};
};

class CfgModels {
class Default {
sectionsInherit="";
sections[] = {""};
skeletonName = "";
};
class ace_tacticalladder {
skeletonName = "ace_tacticalladder_skeleton";
sections[] = { "roadway" };
sectionsInherit = "";
class Animations {
class rotate {
type = "rotation";
source = "";
sourceAddress = "clamp";
selection = "base";
axis = "axis_rotate";
minValue = 0;
maxValue = 90;
angle0="rad 0";
angle1="rad +90";
};
class extract_1 {
type = "translation";
source = "";
selection = "1";
axis = "axis_1";
animPeriod = 0;
minValue = 0;
maxValue = 1;
minPhase = 0;
maxPhase = 1;
offset0 = 0;
offset1 = 0.82;
};
class extract_2: extract_1 {
selection = "2";
axis = "axis_2";
};
class extract_3: extract_1 {
selection = "3";
axis = "axis_3";
};
class extract_4: extract_1 {
selection = "4";
axis = "axis_4";
};
class extract_5: extract_1 {
selection = "5";
axis = "axis_5";
};
class extract_6: extract_1 {
selection = "6";
axis = "axis_6";
};
class extract_7: extract_1 {
selection = "7";
axis = "axis_7";
};
class extract_8: extract_1 {
selection = "8";
axis = "axis_8";
};
class extract_9: extract_1 {
selection = "9";
axis = "axis_9";
};
class extract_10: extract_1 {
selection = "10";
axis = "axis_10";
};
class extract_11: extract_1 {
selection = "11";
axis = "axis_11";
};
};
};
class ArmaMan: Default {
htMin=60;
htMax=1800;
afMax=30;
mfMax=0;
mFact=1;
tBody=37;
sections[]= {
"osobnost",
"Head_Injury",
"Body_Injury",
"l_leg_injury",
"l_arm_injury",
"r_arm_injury",
"r_leg_injury",
"injury_body",
"injury_legs",
"injury_hands",
"clan",
"clan_sign",
"Camo",
"CamoB",
"Camo1",
"Camo2",
"personality",
"hl",
"injury_head"
};
skeletonName="OFP2_ManSkeleton";
};
class ace_tacticalladder_pack: ArmaMan {
};
};
32 changes: 32 additions & 0 deletions addons/tacticalladder/functions/fnc_cancelTLdeploy.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Author: Rocko, Ruthberg
* Cancel tactical ladder deployment
*
* Arguments:
* 0: ladder <OBJECT>
*
* Return Value:
* None
*
* Example:
* [_ladder] call ace_tacticalladder_fnc_cancelTLdeploy;
*
* Public: No
*/
#include "script_component.hpp"

#define __ANIMS ["extract_1","extract_2","extract_3","extract_4","extract_5","extract_6","extract_7","extract_8","extract_9","extract_10","extract_11"]

PARAMS_1(_ladder);

detach _ladder;
_ladder animate ["rotate", 0];
{
_ladder animate [_x, 0];
} forEach __ANIMS;

call EFUNC(interaction,hideMouseHint);
[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler);
[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler);

GVAR(ladder) = objNull;
32 changes: 32 additions & 0 deletions addons/tacticalladder/functions/fnc_confirmTLdeploy.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Author: Rocko, Ruthberg
* Confirm tactical ladder deployment
*
* Arguments:
* 0: ladder <OBJECT>
*
* Return Value:
* Success?
*
* Example:
* [_ladder] call ace_tacticalladder_fnc_confirmTLdeploy;
*
* Public: No
*/
#include "script_component.hpp"

PARAMS_1(_ladder);

private ["_pos1", "_pos2"];
_pos1 = getPosASL GVAR(ladder);
_pos2 = (GVAR(ladder) modelToWorld (GVAR(ladder) selectionPosition "check2")) call EFUNC(common,positionToASL);
if (lineIntersects [_pos1, _pos2, GVAR(ladder)]) exitWith { false };

call EFUNC(interaction,hideMouseHint);
[ACE_player, "DefaultAction", ACE_player getVariable [QGVAR(Deploy), -1]] call EFUNC(Common,removeActionEventHandler);
[ACE_player, "zoomtemp", ACE_player getVariable [QGVAR(Cancel), -1]] call EFUNC(Common,removeActionEventHandler);

detach _ladder;
GVAR(ladder) = objNull;

true
34 changes: 34 additions & 0 deletions addons/tacticalladder/functions/fnc_deployTL.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Author: Rocko, Ruthberg
* Deploy tactical ladder
*
* Arguments:
* Nothing
*
* Return Value:
* Nothing
*
* Example:
* call ace_tacticalladder_fnc_deployTL;
*
* Public: No
*/
#include "script_component.hpp"

if ((backpack ACE_player) != "ACE_TacticalLadder_Pack") exitWith {};

private ["_pos", "_offset", "_ladder"];

removeBackpack ACE_player;

_pos = ACE_player modelToWorld [0,0,0];
_offset = if ((ACE_player call CBA_fnc_getUnitAnim select 0) == "prone") then { 1 } else {0.8};
_pos set [0, (_pos select 0) + (sin (direction ACE_player) * _offset)];
_pos set [1, (_pos select 1) + (cos (direction ACE_player) * _offset)];
_pos set [2, [ACE_player] call CBA_fnc_realHeight];

_ladder = "ACE_Tactical_Ladder" createVehicle _pos;
_ladder setPos _pos;
_ladder setDir (direction ACE_player);

ACE_player reveal _ladder;
Loading

0 comments on commit b86e6b6

Please sign in to comment.