Bring component up to date, use user EH instead

This commit is contained in:
johnb432 2024-04-04 00:44:15 +02:00
parent d699cf9a38
commit 7b8414acde
10 changed files with 78 additions and 94 deletions

View File

@ -1 +1 @@
z\ace\addons\prone_launcher
z\ace\addons\pronelauncher

View File

@ -1,18 +1,5 @@
class Extended_PreStart_EventHandlers {
class ADDON {
init = QUOTE(call COMPILE_FILE(XEH_preStart));
};
};
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));
init = QUOTE(call COMPILE_SCRIPT(XEH_postInit));
};
};

View File

@ -3,7 +3,7 @@ class CfgMovesMaleSdr: CfgMovesBasic {
class TransAnimBase;
class AmovPpneMstpSrasWlnrDnon;
class States {
//Prone Stopped Launcher
// Prone Stopped Launcher
class ACE_LauncherProne: AmovPpneMstpSrasWlnrDnon {
variantsAI[] = {};
variantsPlayer[] = {};
@ -49,7 +49,7 @@ class CfgMovesMaleSdr: CfgMovesBasic {
"Campaign_Base", 0.02
};
};
//Prone Stopped Launcher Turn Left
// Prone Stopped Launcher Turn Left
class AmovPpneMstpSrasWlnrDnon_turnL: AmovPpneMstpSrasWlnrDnon {
actions = "ACE_LauncherProneActions";
aimPrecision = 5;
@ -60,7 +60,7 @@ class CfgMovesMaleSdr: CfgMovesBasic {
"AmovPpneMstpSrasWlnrDnon", 0.02
};
};
//Prone Stopped Launcher Turn Right
// Prone Stopped Launcher Turn Right
class AmovPpneMstpSrasWlnrDnon_turnR: AmovPpneMstpSrasWlnrDnon {
actions = "ACE_LauncherProneActions";
aimPrecision = 5;
@ -71,7 +71,7 @@ class CfgMovesMaleSdr: CfgMovesBasic {
"AmovPpneMstpSrasWlnrDnon", 0.02
};
};
//Prone Stopped Launcher -> Standing Stopped Launcher
// Prone Stopped Launcher -> Standing Stopped Launcher
//class AmovPpneMstpSrasWlnrDnon_AmovPercMstpSrasWlnrDnon: TransAnimBase {
// actions = "LauncherStandActions";
// duty = 2;

View File

@ -1 +0,0 @@
PREP(onKeyDown);

View File

@ -1 +1,71 @@
#include "script_component.hpp"
addUserActionEventHandler ["Stand", "Activate", { // Stand (toggle)
if ((!alive ACE_player) || {!(isNull objectParent ACE_player)}) exitWith {};
private _launcherWeapon = secondaryWeapon ACE_player;
if ((_launcherWeapon == "") || {currentWeapon ACE_player != _launcherWeapon}) exitwith {};
if ((stance ACE_player) == "PRONE") then {
TRACE_1("stand toggle",stance ACE_player);
ACE_player playMoveNow "AmovPpneMstpSrasWlnrDnon_AmovPknlMstpSrasWlnrDnon";
ACE_player playMove "AmovPknlMstpSrasWlnrDnon_AmovPercMstpSrasWlnrDnon";
};
}];
addUserActionEventHandler ["Crouch", "Activate", { // Crouch (toggle)
if ((!alive ACE_player) || {!(isNull objectParent ACE_player)}) exitWith {};
private _launcherWeapon = secondaryWeapon ACE_player;
if ((_launcherWeapon == "") || {currentWeapon ACE_player != _launcherWeapon}) exitwith {};
if ((stance ACE_player) == "PRONE") then {
TRACE_1("crouch toggle",stance ACE_player);
ACE_player playMoveNow "AmovPpneMstpSrasWlnrDnon_AmovPknlMstpSrasWlnrDnon";
};
}];
addUserActionEventHandler ["Prone", "Activate", { // Prone (toggle)
if ((!alive ACE_player) || {!(isNull objectParent ACE_player)}) exitWith {};
private _launcherWeapon = secondaryWeapon ACE_player;
if ((_launcherWeapon == "") || {currentWeapon ACE_player != _launcherWeapon}) exitwith {};
TRACE_1("prone toggle",stance ACE_player);
// Make unit go prone (resets if key is pressed, so need to redo animation)
ACE_player playMoveNow "ACE_LauncherProne";
}];
addUserActionEventHandler ["MoveUp", "Activate", { // (X) Crouch / Stand Up
if ((!alive ACE_player) || {!(isNull objectParent ACE_player)}) exitWith {};
private _launcherWeapon = secondaryWeapon ACE_player;
if ((_launcherWeapon == "") || {currentWeapon ACE_player != _launcherWeapon}) exitwith {};
if ((stance ACE_player) == "PRONE") then {
TRACE_1("moveUp from prone",stance ACE_player);
ACE_player playMoveNow "AmovPpneMstpSrasWlnrDnon_AmovPknlMstpSrasWlnrDnon";
};
}];
addUserActionEventHandler ["MoveDown", "Activate", { // (Z) Go Prone / Stand Up
if ((!alive ACE_player) || {!(isNull objectParent ACE_player)}) exitWith {};
private _launcherWeapon = secondaryWeapon ACE_player;
if ((_launcherWeapon == "") || {currentWeapon ACE_player != _launcherWeapon}) exitwith {};
if ((stance ACE_player) == "PRONE") then {
TRACE_1("moveDown from prone",stance ACE_player);
ACE_player playMoveNow "AmovPpneMstpSrasWlnrDnon_AmovPknlMstpSrasWlnrDnon";
ACE_player playMove "AmovPknlMstpSrasWlnrDnon_AmovPercMstpSrasWlnrDnon";
} else {
TRACE_1("moveDown from non-prone",stance ACE_player);
ACE_player playMoveNow "ACE_LauncherProne";
};
}];

View File

@ -1,11 +0,0 @@
#include "script_component.hpp"
ADDON = false;
PREP_RECOMPILE_START;
#include "XEH_PREP.hpp"
PREP_RECOMPILE_END;
["KeyDown", {_this call FUNC(onKeyDown)}] call CBA_fnc_addDisplayHandler;
ADDON = true;

View File

@ -1,3 +0,0 @@
#include "script_component.hpp"
#include "XEH_PREP.hpp"

View File

@ -1,57 +0,0 @@
#include "script_component.hpp"
/*
* Author: PiZZADOX, Jonpas
* Handles keyDown EH for overriding engine stance changes when in AT launcher stance.
*
* Arguments:
* 0: Control <CONTROL>
* 1: Key <NUMBER>
* 2: Shift <BOOL>
* 3: Ctrl <BOOL>
* 4: Alt <BOOL>
*
* Return Value:
* None
*
* Example:
* [control, 5, false, true, false] call ace_pronelauncher_fnc_onKeyDown
*
* Public: No
*/
params ["", "_key"];
if !(isNull objectParent ACE_player) exitWith {false};
private _launcherWeapon = secondaryWeapon ACE_player;
if (_launcherWeapon isEqualTo "") exitwith {false};
if (currentWeapon ACE_player != _launcherWeapon) exitWith {false};
private _stance = stance ACE_player;
private _keysMoveDown = actionKeys "moveDown";
private _keysMoveUp = actionKeys "moveUp";
private _keysProne = actionKeys "Prone";
private _keysCrouch = actionKeys "Crouch";
private _keysStand = actionKeys "Stand";
if (_stance in ["STAND", "CROUCH"] && {(_key in _keysMoveDown) || (_key in _keysProne)}) exitWith {
ACE_player playMoveNow "ACE_LauncherProne";
true
};
if (_stance isEqualTo "PRONE") exitWith {
if (_key in _keysProne) exitWith {
true
};
if ((_key in _keysCrouch) || (_key in _keysMoveUp)) exitWith {
ACE_player playMoveNow "AmovPpneMstpSrasWlnrDnon_AmovPknlMstpSrasWlnrDnon";
true
};
if ((_key in _keysMoveDown) || (_key in _keysStand)) exitWith {
ACE_player playMoveNow "AmovPpneMstpSrasWlnrDnon_AmovPknlMstpSrasWlnrDnon";
ACE_player playMove "AmovPknlMstpSrasWlnrDnon_AmovPercMstpSrasWlnrDnon";
true
};
false
};
false

View File

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

View File

@ -3,8 +3,8 @@
#include "\z\ace\addons\main\script_mod.hpp"
#define DEBUG_MODE_FULL
#define DISABLE_COMPILE_CACHE
#define ENABLE_PERFORMANCE_COUNTERS
// #define DISABLE_COMPILE_CACHE
// #define ENABLE_PERFORMANCE_COUNTERS
#ifdef DEBUG_ENABLED_PRONELAUNCHER
#define DEBUG_MODE_FULL