Localize spare barrel's displayName

This commit is contained in:
esteldunedain
2016-03-01 19:26:20 -03:00
parent e6a2ca7102
commit 850a499c0e
4 changed files with 22 additions and 12 deletions

View File

@ -1,9 +1,9 @@
class CfgMagazines { class CfgMagazines {
class CA_Magazine; class CA_Magazine;
class ACE_SpareBarrel: CA_Magazine { class ACE_SpareBarrel: CA_Magazine {
displayName = CSTRING(SpareBarrelName);
descriptionshort = CSTRING(SpareBarrelDescription); descriptionshort = CSTRING(SpareBarrelDescription);
picture = QUOTE(PATHTOF(UI\spare_barrel_ca.paa)); picture = QUOTE(PATHTOF(UI\spare_barrel_ca.paa));
displayName = "ACE Spare Barrel"; //!!!CANNOT be localized!!!: because it is used as part of the magazineDetail string
count = 1; count = 1;
mass = 60; mass = 60;
ACE_isUnique = 1; ACE_isUnique = 1;

View File

@ -4,4 +4,14 @@ ADDON = false;
#include "XEH_PREP.hpp" #include "XEH_PREP.hpp"
FakeCBA_fnc_getMagazineIds = {
params [["_unit", objNull, [objNull]], ["_magazine", "", [""]]];
private _displayName = getText (configFile >> "CfgMagazines" >> _magazine >> "displayName");
if (_displayName isEqualTo "") exitWith {[]};
magazinesDetail _unit select {_x find _displayName == 0} apply {_x = _x splitString "[:]"; _x select (count _x - 1)};
};
ADDON = true; ADDON = true;

View File

@ -21,15 +21,13 @@ params ["_unit", "_weapon", "_weaponTemp", "_barrelMass"];
TRACE_4("loadCoolestSpareBarrel1",_unit,_weapon,_weaponTemp,_barrelMass); TRACE_4("loadCoolestSpareBarrel1",_unit,_weapon,_weaponTemp,_barrelMass);
// Find all spare barrel the player has // Find all spare barrel the player has
private _allMags = magazinesDetail _unit; private _allBarrels = [_unit, "ACE_SpareBarrel"] call FakeCBA_fnc_getMagazineIds;
TRACE_1("loadCoolestSpareBarrel2",_allMags); TRACE_1("_allBarrels",_allBarrels);
_allMags = _allMags select {_x find "ACE Spare Barrel" == 0}; if ((count _allBarrels) < 1) exitWith {};
TRACE_1("loadCoolestSpareBarrel3",_allMags);
if ((count _allMags) < 1) exitWith {};
// Determine which on is coolest // Determine which on is coolest
private _coolestTemp = 10000; private _coolestTemp = 10000;
private _coolestMag = _allMags select 0; private _coolestMag = _allBarrels select 0;
{ {
private _temp = 0; private _temp = 0;
if ([GVAR(storedSpareBarrels), _x] call CBA_fnc_hashHasKey) then { if ([GVAR(storedSpareBarrels), _x] call CBA_fnc_hashHasKey) then {
@ -40,7 +38,7 @@ private _coolestMag = _allMags select 0;
_coolestTemp = _temp; _coolestTemp = _temp;
_coolestMag = _x; _coolestMag = _x;
}; };
} forEach _allMags; } forEach _allBarrels;
TRACE_3("loadCoolestSpareBarrel5",_coolestTemp,_coolestMag,_weaponTemp); TRACE_3("loadCoolestSpareBarrel5",_coolestTemp,_coolestMag,_weaponTemp);
// The new weapon temperature is similar to the coolest barrel // The new weapon temperature is similar to the coolest barrel
@ -49,3 +47,4 @@ _unit setVariable [format [QGVAR(%1_temp), _weapon], _coolestTemp, true];
// Heat up the coolest barrel to the former weapon temperature // Heat up the coolest barrel to the former weapon temperature
[GVAR(storedSpareBarrels), _coolestMag, [_weaponTemp, ACE_Time, _barrelMass]] call CBA_fnc_hashSet; [GVAR(storedSpareBarrels), _coolestMag, [_weaponTemp, ACE_Time, _barrelMass]] call CBA_fnc_hashSet;

View File

@ -18,9 +18,10 @@
params ["_player","_unit"]; params ["_player","_unit"];
// Find all spare barrel the player has // Find all spare barrel the player has
private _allMags = magazinesDetail _unit; TRACE_2("sendSpareBarrelsTemperatureHunt",_player,_unit);
_allMags = _allMags select {_x find "ACE Spare Barrel" == 0}; private _allBarrels = [_unit, "ACE_SpareBarrel"] call FakeCBA_fnc_getMagazineIds;
if ((count _allMags) < 1) exitWith {}; TRACE_1("_allBarrels",_allBarrels);
if ((count _allBarrels) < 1) exitWith {};
// Determine the temp of each barrel // Determine the temp of each barrel
private _temps = []; private _temps = [];
@ -30,7 +31,7 @@ private _temps = [];
_temp = ([GVAR(storedSpareBarrels), _x] call CBA_fnc_hashGet) select 0; _temp = ([GVAR(storedSpareBarrels), _x] call CBA_fnc_hashGet) select 0;
}; };
_temps pushBack _temp; _temps pushBack _temp;
} forEach _allMags; } forEach _allBarrels;
TRACE_1("_temps",_temps); TRACE_1("_temps",_temps);
// Count cool // Count cool