Minor Cleanup

This commit is contained in:
PabstMirror 2015-10-26 10:49:39 -05:00
parent bfcf057dab
commit 2c995f9c2c
4 changed files with 29 additions and 24 deletions

View File

@ -1,25 +1,27 @@
#include "script_component.hpp"
if (!hasInterface) exitWith {};
#include "key.sqf"
// reload mutex, you can't play signal while reloading
GVAR(ReloadMutex) = true;
// PFH for Reloading
[{
if (isNull (findDisplay 46)) exitWith {};
// handle reloading
(findDisplay 46) displayAddEventHandler ["KeyDown", {
// Event for main display to be loaded:
["mainDisplayLoaded", {
// handle reloading
(findDisplay 46) displayAddEventHandler ["KeyDown", {
if ((_this select 1) in actionKeys "ReloadMagazine") then {
_weapon = currentWeapon ACE_player;
if ((isNull ACE_player) || {!alive ACE_player}) exitWith {false};
local _weapon = currentWeapon ACE_player;
if (_weapon != "") then {
GVAR(ReloadMutex) = false;
_gesture = getText (configfile >> "CfgWeapons" >> _this >> "reloadAction");
_isLauncher = "Launcher" in ([configFile >> "CfgWeapons" >> _this, true] call BIS_fnc_returnParents);
_config = ["CfgGesturesMale", "CfgMovesMaleSdr"] select _isLauncher;
_duration = getNumber (configfile >> _config >> "States" >> _gesture >> "speed");
local _gesture = getText (configfile >> "CfgWeapons" >> _weapon >> "reloadAction");
local _isLauncher = _weapon isKindOf ["Launcher", (configFile >> "CfgWeapons")];
local _config = ["CfgGesturesMale", "CfgMovesMaleSdr"] select _isLauncher;
local _duration = getNumber (configfile >> _config >> "States" >> _gesture >> "speed");
if (_duration != 0) then {
_duration = if (_duration < 0) then { abs _duration } else { 1 / _duration };
@ -27,10 +29,10 @@ GVAR(ReloadMutex) = true;
_duration = 3;
};
TRACE_2("Reloading, blocking gestures",_weapon,_duration);
[{GVAR(ReloadMutex) = true;}, [], _duration] call EFUNC(common,waitAndExecute);
};
};
false
}];
[_this select 1] call CBA_fnc_removePerFrameHandler;
}, 0,[]] call CBA_fnc_addPerFrameHandler;
}];
}] call EFUNC(common,addEventHandler);

View File

@ -11,12 +11,12 @@ class CfgMovesBasic {
GVAR(forwardStandLowered) = QGVAR(forwardStandLowered);
GVAR(stopStandLowered) = QGVAR(stopStandLowered);
GVAR(covertandLowered) = QGVAR(covertandLowered);
GVAR(coverStandLowered) = QGVAR(coverStandLowered);
GVAR(regroupStandLowered) = QGVAR(regroupStandLowered);
GVAR(engageStandLowered) = QGVAR(engageStandLowered);
GVAR(pointStandLowered) = QGVAR(pointStandLowered);
GVAR(holdStandLowered) = QGVAR(holdStandLowered);
GVAR(warningtandLowered) = QGVAR(warningtandLowered);
GVAR(warningStandLowered) = QGVAR(warningStandLowered);
};
class Actions {
@ -32,7 +32,7 @@ class CfgMovesBasic {
GVAR(forwardStandLowered)[] = {QGVAR(forwardStandLowered), "Gesture"};
GVAR(stopStandLowered)[] = {QGVAR(stopStandLowered), "Gesture"};
GVAR(covertandLowered)[] = {QGVAR(covertandLowered), "Gesture"};
GVAR(coverStandLowered)[] = {QGVAR(coverStandLowered), "Gesture"};
GVAR(regroupStandLowered)[] = {QGVAR(regroupStandLowered), "Gesture"};
GVAR(engageStandLowered)[] = {QGVAR(engageStandLowered), "Gesture"};
GVAR(pointStandLowered)[] = {QGVAR(pointStandLowered), "Gesture"};
@ -148,7 +148,7 @@ class CfgGesturesMale {
speed = 0.8;
};
class GVAR(covertandLowered): GVAR(cover) {
class GVAR(coverStandLowered): GVAR(cover) {
file = QUOTE(PATHTOF(anim\ace_cover_stand_lowered.rtm));
};
@ -193,7 +193,7 @@ class CfgGesturesMale {
speed = 0.8;
};
class GVAR(warningtandLowered): GVAR(warning) {
class GVAR(warningStandLowered): GVAR(warning) {
file = QUOTE(PATHTOF(anim\ace_warning_stand_lowered.rtm));
};
};

View File

@ -1,4 +1,3 @@
#include "script_component.hpp"
/*
* Author: joko // Jonas, Emperias, Zigomarvin
* Detect if the player and play the Gesture Animation
@ -10,14 +9,17 @@
* <BOOL>
*
* Example:
* "GeniusAnimation" call ace_handSignals_fnc_playSignal
* "GeniusAnimation" call ace_gestures_fnc_playSignal
*
* Public: No
*/
#include "script_component.hpp"
TRACE_1("params",_this);
if (!GVAR(ReloadMutex)) exitWith {false};
private "_gesture";
_gesture = if (_this select [0,2] == "BI") then {
local _gesture = if (_this select [0,2] == "BI") then {
_this select [2]
} else {
if (((animationState ACE_player) select [0, 12]) in ["amovpercmstp", "amovpercmwlk", "amovpercmtac"] && weaponLowered ACE_player) then {
@ -26,5 +28,6 @@ _gesture = if (_this select [0,2] == "BI") then {
_this
};
};
ACE_player playAction _gesture;
true

View File

@ -7,14 +7,14 @@
_currentName = _currentName select [2];
};
_code = (compile format [QUOTE(QUOTE(QGVAR(_%1)) call FUNC(playSignal); hint 'KeyDown'), _currentName]);
local _code = (compile format [QUOTE(QUOTE(QGVAR(%1)) call FUNC(playSignal);), _currentName]);
[
"ACE3 Gestures",
_currentName,
localize format[LSTRING(%1), _currentName],
_code,
{hint "key Up"},
{false},
[_key, [false, (_key != -1), false]],
false
] call CBA_fnc_addKeybind;