Initial draft of the ACE2 tactical ladder port.

This commit is contained in:
ulteq 2015-06-03 20:27:52 +02:00
parent 5b766d3668
commit 68b652cee9
22 changed files with 476 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 = "true";
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,81 @@
#include "script_component.hpp"
GVAR(height) = false;
GVAR(rotate) = false;
GVAR(key_add) = {
GVAR(handlerid_press) = (findDisplay 46) displayAddEventHandler ["KeyDown", QUOTE(_this call GVAR(keypressed))];
GVAR(handlerid_release) = (findDisplay 46) displayAddEventHandler ["KeyUp", QUOTE(_this call GVAR(keyreleased))];
};
GVAR(key_rem) = {
(findDisplay 46) displayRemoveEventHandler ["KeyDown", GVAR(handlerid_press)];
(findDisplay 46) displayRemoveEventHandler ["KeyUp", GVAR(handlerid_release)];
};
GVAR(keypressed) = {
if (_this select 2) then {
GVAR(height) = true; // SHIFT for setting height
};
if (_this select 3) then {
GVAR(rotate) = true; // ALT for rotating
};
};
GVAR(keyreleased) = {
GVAR(height) = false;
GVAR(rotate) = false;
};
FUNC(ladderKey_add) = {
GVAR(ladder_handlerid_press) = (findDisplay 46) displayAddEventHandler ["KeyDown", QUOTE(_this call FUNC(ladder_interaction))];
};
FUNC(ladderKey_remove) = {
(findDisplay 46) displayRemoveEventHandler ["KeyDown", GVAR(ladder_handlerid_press)];
};
FUNC(ladder_interaction) = {
private "_fnc_collide";
#define __ANIMS ["extract_4","extract_5","extract_6","extract_7","extract_8","extract_9","extract_10","extract_11"]
// Ladder animations start from "extract_4" onwards, because from initial setting, the first three elements extract automatically
_ladder = GVAR(ladder);
_key = _this select 1;
_shift = _this select 2;
_fnc_collide = {
_pos1 = ATLtoASL(GVAR(ladder) modelToWorld (GVAR(ladder) selectionPosition "check2"));
_pos2 = [_pos1 select 0,_pos1 select 1,(_pos1 select 2)+0.4];
lineIntersects [_pos1, _pos2, GVAR(ladder)]
};
if (_key == 18 && {!_shift}) then { // UP
if (call _fnc_collide) exitWith {};
_currentStep = GVAR(currentStep);
_currentStep = _currentStep + 1;
if (_currentStep == 12) exitWith { GVAR(currentStep) = 11; };
if (_ladder animationPhase (format["extract_%1",_currentStep]) == 0) then {
_ladder animate [(format["extract_%1",_currentStep]),1];
GVAR(currentStep) = _currentStep;
};
};
if (_key == 18 && {_shift}) then {
_currentAngle = GVAR(currentAngle);
_currentAngle = _currentAngle + 2.5;
if (_currentAngle > 90) exitWith { GVAR(currentAngle = 90); };
_ladder animate ["rotate",_currentAngle];
GVAR(currentAngle) = _currentAngle;
};
if (_key == 16 && {!_shift}) then { // DOWN // TODO: actionKeyName "leanleft"
_currentStep = GVAR(currentStep);
if (_currentStep == 3) exitWith { GVAR(currentStep) = 3; };
if (_ladder animationPhase (format["extract_%1",_currentStep]) == 1) then {
_ladder animate [(format["extract_%1",_currentStep]),0];
GVAR(currentStep) = _currentStep - 1;
};
};
if (_key == 16 && {_shift}) then {
_currentAngle = GVAR(currentAngle);
_currentAngle = _currentAngle - 2.5;
if (_currentAngle <= 0) then { _currentAngle = 0; };
_ladder animate ["rotate",_currentAngle];
GVAR(currentAngle) = _currentAngle;
};
false
};

View File

@ -0,0 +1,11 @@
#include "script_component.hpp"
ADDON = false;
PREP(cancelTLdeploy);
PREP(confirmTLdeploy);
PREP(deployTL);
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,105 @@
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";
};
};
};
};

View File

@ -0,0 +1,15 @@
// #define DEBUG_MODE_FULL
#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_4(_target,_caller,_index,_ladder);
_target removeAction _index;
detach _ladder;
_ladder setVariable [QGVAR(inUse),false,true]; // No longer In Use!
_ladder animate ["rotate",0];
{ _ladder animate [_x,0] } foreach __ANIMS;
_target removeAction (_target getVariable QGVAR(TLdeployAction));
call FUNC(ladderKey_remove);

View File

@ -0,0 +1,19 @@
// #define DEBUG_MODE_FULL
#include "script_component.hpp"
PARAMS_4(_target,_caller,_index,_ladder);
_fnc_collide = {
_pos1 = getPosASL GVAR(ladder);
_pos2 = ATLtoASL(GVAR(ladder) modelToWorld (GVAR(ladder) selectionPosition "check2"));
lineIntersects [_pos1, _pos2, GVAR(ladder)]
};
if (call _fnc_collide) exitWith {};
_target removeAction _index;
detach _ladder;
_ladder setVariable [QGVAR(inUse),false,true]; // No longer In Use!
_target removeAction (_target getVariable QGVAR(TLdropAction));
call FUNC(ladderKey_remove);

View File

@ -0,0 +1,15 @@
#include "script_component.hpp"
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)];
_z = [ACE_player] call CBA_fnc_realHeight;
_pos set [2,_z];
_ladder = "ACE_Tactical_Ladder" createVehicle _pos;
_ladder setPos _pos;
_ladder setDir (direction ACE_player);
ACE_player reveal _ladder;

View File

@ -0,0 +1,8 @@
/* ace_sys_sandbag (.pbo) | (c) 2009 by rocko */
#include "script_component.hpp"
PARAMS_2(_ladder,_unit);
deleteVehicle _ladder;
_unit addBackpack "ACE_TacticalLadder_Pack";

View File

@ -0,0 +1,26 @@
#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 setVariable [QGVAR(inUse),true,true]; // In Use!
_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(currentStep) = 3;
GVAR(currentAngle) = 0;
call FUNC(ladderKey_add);
_action_drop = _unit addAction [localize "STR_ACE_DROP_TACLADDER","\z\ace\addons\tacticalladder\functions\fnc_cancelTLdeploy.sqf",_ladder];
_action_deploy = _unit addAction [localize "STR_ACE_DEPLOY_TACLADDER","\z\ace\addons\tacticalladder\functions\fnc_confirmTLdeploy.sqf",_ladder];
_unit setVariable [QGVAR(TLdeployAction),_action_deploy];
_unit setVariable [QGVAR(TLdropAction),_action_drop];

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>