First version of "Check spare barrel temperatures" action

This commit is contained in:
esteldunedain 2016-02-27 01:46:27 -03:00
parent e950552345
commit b8f955468c
3 changed files with 88 additions and 0 deletions

View File

@ -30,6 +30,15 @@ class CfgVehicles {
priority = 2.9;
icon = QUOTE(PATHTOF(UI\temp_ca.paa));
};
class ACE_CheckTemperatureSpareBarrels {
displayName = CSTRING(CheckTemperatureSpareBarrelsShort);
condition = QUOTE( 'ACE_SpareBarrel' in magazines _player);
exceptions[] = {"isNotInside", "isNotSitting"};
statement = QUOTE([ARR_2('spareBarrelsCheckTemperatures',[ARR_2(_player,_player)])] call EFUNC(common,serverEvent););
showDisabled = 0;
priority = 2.8;
icon = QUOTE(PATHTOF(UI\temp_ca.paa));
};
};
};
};

View File

@ -11,6 +11,67 @@ if (isServer) then {
// Keep track of the temperature of stored spare barrels
GVAR(storedSpareBarrels) = [] call CBA_fnc_hashCreate;
["spareBarrelsCheckTemperatures", {
params ["_player","_unit"];
// Find all spare barrel the player has
private _allMags = magazinesDetail _unit;
_allMags = _allMags select {_x find "ACE Spare Barrel" == 0};
if ((count _allMags) < 1) exitWith {};
// Determine the temp of each barrel
private _temps = [];
{
private _temp = 0;
if ([GVAR(storedSpareBarrels), _x] call CBA_fnc_hashHasKey) then {
_temp = ([GVAR(storedSpareBarrels), _x] call CBA_fnc_hashGet) select 0;
};
_temps pushBack _temp;
} forEach _allMags;
TRACE_1("_temps",_temps);
// Count cool
private _countCool = {_x < 20} count _temps;
private _countWarm = {(_x >= 20) && (_x < 100)} count _temps;
private _countHot = {(_x >= 100) && (_x < 200)} count _temps;
private _countVeryHot = {(_x >= 200) && (_x < 600)} count _temps;
private _countExtremelyHot = {_x >= 600} count _temps;
private _output = ["%1 %2%3%4 %5%6%7 %8%9%10 %11%12%13 %14"];
private _size = 1.0;
if (_countCool > 0) then {
_output pushBack _countCool;
_output pushBack LSTRING(BarrelCool);
_output pushBack "<br/>";
_size = _size + 0.5;
};
if (_countWarm > 0) then {
_output pushBack _countWarm;
_output pushBack LSTRING(BarrelWarm);
_output pushBack "<br/>";
_size = _size + 0.5;
};
if (_countHot > 0) then {
_output pushBack _countHot;
_output pushBack LSTRING(BarrelHot);
_output pushBack "<br/>";
_size = _size + 0.5;
};
if (_countVeryHot > 0) then {
_output pushBack _countVeryHot;
_output pushBack LSTRING(BarrelVeryHot);
_output pushBack "<br/>";
_size = _size + 0.5;
};
if (_countExtremelyHot > 0) then {
_output pushBack _countExtremelyHot;
_output pushBack LSTRING(BarrelExtremelyHot);
_size = _size + 0.5;
};
TRACE_1("_output",_output);
["displayTextStructured", [_player], [_output, _size, _player]] call EFUNC(common,targetEvent);
}] call EFUNC(common,addEventHandler);
["spareBarrelLoadedCoolest", {
params ["_unit", "_weapon", "_weaponTemp", "_barrelMass"];
TRACE_4("spareBarrelLoadedCoolest1",_unit,_weapon,_weaponTemp,_barrelMass);

View File

@ -224,6 +224,9 @@
<Italian>Sto controllando la temperatura...</Italian>
<Russian>Проверка температуры...</Russian>
</Key>
<Key ID="STR_ACE_Overheating_CheckTemperatureSpareBarrelsShort">
<English>Check spare barrel temperatures</English>
</Key>
<Key ID="STR_ACE_Overheating_Temperature">
<English>Temperature</English>
<German>Temperatur</German>
@ -236,5 +239,20 @@
<Italian>Temperatura</Italian>
<Russian>Температура</Russian>
</Key>
<Key ID="STR_ACE_Overheating_BarrelCool">
<English>Cool Spare Barrel/s</English>
</Key>
<Key ID="STR_ACE_Overheating_BarrelWarm">
<English>Warm Spare Barrel/s</English>
</Key>
<Key ID="STR_ACE_Overheating_BarrelHot">
<English>Hot Spare Barrel/s</English>
</Key>
<Key ID="STR_ACE_Overheating_BarrelVeryHot">
<English>Very Hot Spare Barrel/s</English>
</Key>
<Key ID="STR_ACE_Overheating_BarrelExtremelyHot">
<English>Extremele Hot Spare Barrel/s</English>
</Key>
</Package>
</Project>