Make Mils Toogle Self Action

This commit is contained in:
PabstMirror 2015-04-05 15:00:59 -05:00
parent 34a86e0db3
commit 3d9da5f142
5 changed files with 36 additions and 12 deletions

View File

@ -17,6 +17,14 @@ class CfgVehicles {
turretInfoType = "ACE_Mk6_RscWeaponRangeArtillery";
};
};
class ACE_SelfActions {
class GVAR(toggleMils) {
displayName = "Toggle MILS";
condition = QUOTE(true);
statement = QUOTE(_this call FUNC(toggleMils));
exceptions[] = {};
};
};
};
class Logic;

View File

@ -5,6 +5,7 @@ ADDON = false;
PREP(handleFired);
PREP(handlePlayerVehicleChanged);
PREP(moduleInit);
PREP(toggleMils);
PREP(turretDisplayLoaded);
ADDON = true;

View File

@ -19,13 +19,6 @@ class CfgPatches {
#include "RscInGameUI.hpp"
class ACE_Settings {
class GVAR(useMils) {
value = 1;
typeName = "BOOL";
isClientSetable = 1;
displayName = "$STR_ACE_mk6mortar_useMils";
};
//These settings effect gameplay difficutly: defaults will leave the mortar the same as vanilla
class GVAR(airResistanceEnabled) {
value = 0;

View File

@ -41,6 +41,8 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes")
ctrlDelete _chargeText;
} else {
_useMils = _mortarVeh getVariable [QGVAR(useMils), true];
//Compute: 'charge' from weaponstate
_currentFireMode = (weaponState [_mortarVeh, [0]]) select 2;
_currentChargeMode = _fireModes find _currentFireMode;
@ -58,7 +60,7 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes")
//Update CurrentElevation Display:
_elevDeg = parseNumber ctrlText (_display displayCtrl 175);
if (GVAR(useMils)) then {
if (_useMils) then {
(_display displayCtrl 80175) ctrlSetText str round (_elevDeg * 6400 / 360);
} else {
(_display displayCtrl 80175) ctrlSetText str _elevDeg;
@ -72,7 +74,7 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes")
if (_elevDeg <= 0) then {
(_display displayCtrl 80176) ctrlSetText (ctrlText (_display displayCtrl 176));
} else {
if (GVAR(useMils)) then {
if (_useMils) then {
(_display displayCtrl 80176) ctrlSetText str round (_elevDeg * 6400 / 360);
} else {
(_display displayCtrl 80176) ctrlSetText str _elevDeg;
@ -85,10 +87,10 @@ _fireModes = getArray (configFile >> "CfgWeapons" >> _tubeWeaponName >> "modes")
(_display displayCtrl 80156) ctrlSetText "";
} else {
_rotationDegrees = ((getDir _mortarVeh) + (((-180 / PI) * (_mortarVeh animationPhase "mainTurret")) + 360)) % 360;
if (GVAR(useMils)) then {
if (_useMils) then {
(_display displayCtrl 80156) ctrlSetText str round (_rotationDegrees * 6400 / 360);
} else {
(_display displayCtrl 80156) ctrlSetText str _rotationDegrees;
(_display displayCtrl 80156) ctrlSetText (ctrlText (_display displayCtrl 156));
};
};
};

View File

@ -0,0 +1,20 @@
/*
* Author: PabstMirror
*
*
* Arguments:
*
* Return Value:
*
* Example:
*
* Public: No
*/
#include "script_component.hpp"
PARAMS_2(_mortarVeh,_unit);
private "_currentSetting";
_currentSetting = _mortarVeh getVariable [QGVAR(useMils), true];
_mortarVeh setVariable [QGVAR(useMils), (!_currentSetting)];