Merge pull request #1493 from acemod/tacticalladder

Initial draft of the ACE2 tactical ladder port.
This commit is contained in:
ulteq 2015-06-13 09:37:41 +02:00
commit b86e6b6043
22 changed files with 584 additions and 0 deletions

BIN
addons/apl/data/plech.paa Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
z\ace\addons\tacticalladder

View File

@ -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) );
};
};

View File

@ -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;
};
};
};
};
};

View File

@ -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)

View File

@ -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);

View File

@ -0,0 +1,12 @@
#include "script_component.hpp"
ADDON = false;
PREP(cancelTLdeploy);
PREP(confirmTLdeploy);
PREP(deployTL);
PREP(handleScrollWheel);
PREP(pickupTL);
PREP(positionTL);
ADDON = true;

View File

@ -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 not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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 {
};
};

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -0,0 +1,48 @@
/*
* Author: Rocko, Ruthberg
* Handles lengthening and tilting of the ladder
*
* Arguments:
* Amount scrolled <NUMBER>
*
* Return Value:
* Handled <BOOL>
*
* Example:
* 1 call ace_tacticalladder_fnc_handleScrollWheel;
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_1(_scroll);
if (isNull GVAR(ladder)) exitWith { false };
if (GETMVAR(ACE_Modifier,0) == 0) then {
private ["_currentStep"];
// Lengthening
if (_scroll > 0) then {
_currentStep = GVAR(currentStep);
if (_currentStep == 11) exitWith {};
_currentStep = _currentStep + 1;
if (GVAR(ladder) animationPhase (format["extract_%1", _currentStep]) == 0) then {
GVAR(ladder) animate [format["extract_%1", _currentStep], 1];
GVAR(currentStep) = _currentStep;
};
};
if (_scroll < 0) then {
_currentStep = GVAR(currentStep);
if (_currentStep == 3) exitWith {};
if (GVAR(ladder) animationPhase (format["extract_%1", _currentStep]) == 1) then {
GVAR(ladder) animate [format["extract_%1", _currentStep], 0];
GVAR(currentStep) = _currentStep - 1;
};
};
} else {
// Tilting
GVAR(currentAngle) = 0 max (GVAR(currentAngle) + _scroll) min 90;
GVAR(ladder) animate ["rotate", GVAR(currentAngle)];
};
true

View File

@ -0,0 +1,26 @@
/*
* Author: Rocko, Ruthberg
* Pick up tactical ladder
*
* Arguments:
* 0: ladder <OBJECT>
* 1: unit <OBJECT>
*
* Return Value:
* Success?
*
* Example:
* [_ladder, _unit] call ace_tacticalladder_fnc_pickupTL;
*
* Public: No
*/
#include "script_component.hpp"
if ((backpack ACE_player) != "") exitWith { false };
PARAMS_2(_ladder,_unit);
deleteVehicle _ladder;
_unit addBackpack "ACE_TacticalLadder_Pack";
true

View File

@ -0,0 +1,52 @@
/*
* Author: Rocko, Ruthberg
* Position tactical ladder
*
* Arguments:
* 0: sandbag <OBJECT>
* 1: unit <OBJECT>
*
* Return Value:
* None
*
* Example:
* [_ladder, _unit] call ace_tacticalladder_fnc_positionTL;
*
* 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_2(_ladder,_unit);
{
_ladder animate [_x, 0];
} forEach __ANIMS;
_unit switchMove "amovpercmstpslowwrfldnon_player_idlesteady03";
_ladder attachTo [_unit, [0, 0.75, 0], ""]; // Position ladder in front of player
_ladder animate ["rotate", 0];
{
_ladder animate [_x, 1];
} forEach ["extract_1", "extract_2", "extract_3"]; // Extract ladder at head height (extract_3)
GVAR(ladder) = _ladder;
GVAR(cancelTime) = ACE_time + 1; // Workaround to prevent accidental canceling
GVAR(currentStep) = 3;
GVAR(currentAngle) = 0;
["Confirm", "Cancel", "Adjust"] call EFUNC(interaction,showMouseHint);
ACE_player setVariable [QGVAR(Deploy),
[ACE_player, "DefaultAction",
{!isNull GVAR(ladder)},
{GVAR(ladder) call FUNC(confirmTLdeploy);}
] call EFUNC(common,AddActionEventHandler)];
ACE_player setVariable [QGVAR(Cancel),
[ACE_player, "zoomtemp",
{!isNull GVAR(ladder)},
{GVAR(ladder) call FUNC(cancelTLdeploy);}
] call EFUNC(common,AddActionEventHandler)];

View File

@ -0,0 +1 @@
#include "\z\ace\addons\tacticalladder\script_component.hpp"

View File

@ -0,0 +1,12 @@
#define COMPONENT tacticalladder
#include "\z\ace\addons\main\script_mod.hpp"
#ifdef DEBUG_ENABLED_TACTICALLADDER
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_TACTICALLADDER
#define DEBUG_SETTINGS DEBUG_SETTINGS_TACTICALLADDER
#endif
#include "\z\ace\addons\main\script_macros.hpp"

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="tacticalladder">
<Key ID="STR_ACE_TACTICALLADDER">
<English>Telescopic Ladder</English>
<German>Teleskopleiter</German>
<Russian>Телескопическая лестница</Russian>
<Polish>Drabina teleskopowa</Polish>
<Spanish>Telescopic Ladder</Spanish>
<French>Telescopic Ladder</French>
<Czech>Teleskopický žebřík</Czech>
<Italian>Telescopic Ladder</Italian>
<Hungarian>Telescopic Ladder</Hungarian>
</Key>
<Key ID="STR_ACE_DEPLOY_TACLADDER">
<English>Deploy ladder</English>
<German>Leiter aufbauen</German>
<Russian>Установить лестницу</Russian>
<Polish>Rozłóż drabinę</Polish>
<Spanish>Deploy ladder</Spanish>
<French>Deploy ladder</French>
<Czech>Umístit žebřík</Czech>
<Italian>Deploy ladder</Italian>
<Hungarian>Deploy ladder</Hungarian>
</Key>
<Key ID="STR_ACE_DROP_TACLADDER">
<English>Drop ladder</English>
<German>Leiter ablegen</German>
<Russian>Положить лестницу</Russian>
<Polish>Zostaw drabinę</Polish>
<Spanish>Drop ladder</Spanish>
<French>Drop ladder</French>
<Czech>Položit žebřík</Czech>
<Italian>Drop ladder</Italian>
<Hungarian>Drop ladder</Hungarian>
</Key>
<Key ID="STR_ACE_POSITION_TACLADDER">
<English>Position ladder</English>
<German>Leiter positionieren</German>
<Russian>Перенести лестницу</Russian>
<Polish>Postaw drabinę</Polish>
<Spanish>Position ladder</Spanish>
<French>Position ladder</French>
<Czech>Přemístit žebřík</Czech>
<Italian>Position ladder</Italian>
<Hungarian>Position ladder</Hungarian>
</Key>
<Key ID="STR_ACE_PICKUP_TACLADDER">
<English>Pickup ladder</English>
<German>Leiter aufnehmen</German>
<Russian>Взять лестницу</Russian>
<Polish>Zabierz drabinę</Polish>
<Spanish>Pickup ladder</Spanish>
<French>Pickup ladder</French>
<Czech>Vzít žebřík</Czech>
<Italian>Pickup ladder</Italian>
<Hungarian>Pickup ladder</Hungarian>
</Key>
</Package>
</Project>