Merge pull request #1224 from Winter259/last-module-cleanup

Fixed safemode module indentation
This commit is contained in:
Nicolás Badano 2015-05-15 11:21:59 -03:00
commit 8d7f9c9a0d
4 changed files with 75 additions and 75 deletions

View File

@ -10,7 +10,7 @@ private ["_safedWeapons"];
_safedWeapons = _unit getVariable [QGVAR(safedWeapons), []];
if (_weapon in _safedWeapons) exitWith {
_this call FUNC(unlockSafety);
_this call FUNC(unlockSafety);
};
_safedWeapons pushBack _weapon;
@ -18,39 +18,39 @@ _safedWeapons pushBack _weapon;
_unit setVariable [QGVAR(safedWeapons), _safedWeapons];
if (_unit getVariable [QGVAR(actionID), -1] == -1) then {
private ["_condition", "_statement", "_id"];
private ["_condition", "_statement", "_id"];
_condition = {
if (
[_this select 1] call EFUNC(common,canUseWeapon)
&& {
if (currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(safedWeapons), []])) then {
if (inputAction "nextWeapon" > 0) exitWith {
[_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety);
_condition = {
if (
[_this select 1] call EFUNC(common,canUseWeapon)
&& {
if (currentMuzzle (_this select 1) in ((_this select 1) getVariable [QGVAR(safedWeapons), []])) then {
if (inputAction "nextWeapon" > 0) exitWith {
[_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety);
false
};
true
} else {false}
}
) then {
// player hud
[false] call FUNC(setSafeModeVisual);
true
} else {
// player hud
[true] call FUNC(setSafeModeVisual);
false
};
true
} else {false}
}
) then {
// player hud
[false] call FUNC(setSafeModeVisual);
true
} else {
// player hud
[true] call FUNC(setSafeModeVisual);
false
}
};
}
};
_statement = {
[_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety);
};
_statement = {
[_this select 1, currentWeapon (_this select 1), currentMuzzle (_this select 1)] call FUNC(unlockSafety);
};
//_id = [_unit, format ["<t color=""#FFFF00"" >%1</t>", localize "STR_ACE_SafeMode_TakeOffSafety"], "DefaultAction", _condition, {}, {true}, _statement, 10] call EFUNC(common,addActionMenuEventHandler);
_id = [_unit, "DefaultAction", _condition, {}] call EFUNC(common,addActionEventHandler);
//_id = [_unit, format ["<t color=""#FFFF00"" >%1</t>", localize "STR_ACE_SafeMode_TakeOffSafety"], "DefaultAction", _condition, {}, {true}, _statement, 10] call EFUNC(common,addActionMenuEventHandler);
_id = [_unit, "DefaultAction", _condition, {}] call EFUNC(common,addActionEventHandler);
_unit setVariable [QGVAR(actionID), _id];
_unit setVariable [QGVAR(actionID), _id];
};
_unit selectWeapon _muzzle;//_weapon

View File

@ -7,17 +7,17 @@ private ["_sound"];
_sound = getArray (configFile >> "CfgWeapons" >> _weapon >> "changeFiremodeSound");
if (count _sound == 0) exitWith {
playSound "ACE_Sound_Click";
playSound "ACE_Sound_Click";
};
// add file extension
if call {
{
if (toLower (_sound select 0) find _x == count toArray (_sound select 0) - count toArray _x - 1) exitWith {false};
true
} forEach [".wav", ".ogg", ".wss"];
{
if (toLower (_sound select 0) find _x == count toArray (_sound select 0) - count toArray _x - 1) exitWith {false};
true
} forEach [".wav", ".ogg", ".wss"];
} then {
_sound set [0, (_sound select 0) + ".wss"];
_sound set [0, (_sound select 0) + ".wss"];
};
// add default volume, pitch and distance

View File

@ -11,12 +11,12 @@ _control = (uiNamespace getVariable ["ACE_dlgSoldier", displayNull]) displayCtrl
if (isNull _control) exitWith {};
if (_show) then {
private "_config";
_config = configFile >> "RscInGameUI" >> "RscUnitInfoSoldier" >> "WeaponInfoControlsGroupLeft" >> "controls" >> "CA_ModeTexture";
private "_config";
_config = configFile >> "RscInGameUI" >> "RscUnitInfoSoldier" >> "WeaponInfoControlsGroupLeft" >> "controls" >> "CA_ModeTexture";
_control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];
_control ctrlCommit 0;
_control ctrlSetPosition [getNumber (_config >> "x"), getNumber (_config >> "y"), getNumber (_config >> "w"), getNumber (_config >> "h")];
_control ctrlCommit 0;
} else {
_control ctrlSetPosition [0, 0, 0, 0];
_control ctrlCommit 0;
_control ctrlSetPosition [0, 0, 0, 0];
_control ctrlCommit 0;
};

View File

@ -7,51 +7,51 @@ private ["_safedWeapons"];
_safedWeapons = _unit getVariable [QGVAR(safedWeapons), []];
if (_weapon in _safedWeapons) then {
_safedWeapons = _safedWeapons - [_weapon];
_safedWeapons = _safedWeapons - [_weapon];
_unit setVariable [QGVAR(safedWeapons), _safedWeapons];
_unit setVariable [QGVAR(safedWeapons), _safedWeapons];
if (count _safedWeapons == 0) then {
private "_id";
_id = _unit getVariable [QGVAR(actionID), -1];
if (count _safedWeapons == 0) then {
private "_id";
_id = _unit getVariable [QGVAR(actionID), -1];
//[_unit, "DefaultAction", _id] call EFUNC(common,removeActionMenuEventHandler);
[_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler);
_unit setVariable [QGVAR(actionID), -1];
};
//[_unit, "DefaultAction", _id] call EFUNC(common,removeActionMenuEventHandler);
[_unit, "DefaultAction", _id] call EFUNC(common,removeActionEventHandler);
_unit setVariable [QGVAR(actionID), -1];
};
};
_unit selectWeapon _muzzle;
if (inputAction "nextWeapon" > 0) then {
// switch to the last mode to roll over to first after the default nextWeapon action
private ["_modes", "_mode", "_index"];
// switch to the last mode to roll over to first after the default nextWeapon action
private ["_modes", "_mode", "_index"];
// get weapon modes
_modes = [];
{
if (getNumber (configFile >> "CfgWeapons" >> _weapon >> _x >> "showToPlayer") == 1) then {
_modes pushBack _x;
// get weapon modes
_modes = [];
{
if (getNumber (configFile >> "CfgWeapons" >> _weapon >> _x >> "showToPlayer") == 1) then {
_modes pushBack _x;
};
if (_x == "this") then {
_modes pushBack _weapon;
};
} forEach getArray (configfile >> "CfgWeapons" >> _weapon >> "modes");
// select last mode
_mode = _modes select (count _modes - 1);
// switch to last mode
_index = 0;
while {
_index < 100 && {currentMuzzle _unit != _weapon || {currentWeaponMode _unit != _mode}}
} do {
_unit action ["SwitchWeapon", _unit, _unit, _index];
_index = _index + 1;
};
if (_x == "this") then {
_modes pushBack _weapon;
};
} forEach getArray (configfile >> "CfgWeapons" >> _weapon >> "modes");
// select last mode
_mode = _modes select (count _modes - 1);
// switch to last mode
_index = 0;
while {
_index < 100 && {currentMuzzle _unit != _weapon || {currentWeaponMode _unit != _mode}}
} do {
_unit action ["SwitchWeapon", _unit, _unit, _index];
_index = _index + 1;
};
} else {
// play fire mode selector sound
[_unit, _weapon, _muzzle] call FUNC(playChangeFiremodeSound);
// play fire mode selector sound
[_unit, _weapon, _muzzle] call FUNC(playChangeFiremodeSound);
};
// player hud