mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added string checking for less needed string multiplicates
This commit is contained in:
parent
0fc9a33d38
commit
396e01cd6e
@ -13,12 +13,15 @@
|
||||
*
|
||||
* Public: No
|
||||
*/
|
||||
#define DEBUG_MODE_FULL
|
||||
#include "script_component.hpp"
|
||||
#define TRACK_HITPOINTS ["HitLTrack", "HitRTrack"]
|
||||
|
||||
params ["_vehicle"];
|
||||
TRACE_1("params", _vehicle);
|
||||
|
||||
if (typeOf _vehicle != "O_Heli_Transport_04_F") exitWith {}; // test
|
||||
|
||||
private ["_type", "_initializedClasses"];
|
||||
|
||||
_type = typeOf _vehicle;
|
||||
@ -39,6 +42,11 @@ _wheelHitPointsWithSelections = [_vehicle] call FUNC(getWheelHitPointsWithSelect
|
||||
_wheelHitPoints = _wheelHitPointsWithSelections select 0;
|
||||
_wheelHitPointSelections = _wheelHitPointsWithSelections select 1;
|
||||
|
||||
private ["_hitPointsAddedNames", "_hitPointsAddedStrings", "_hitPointsAddedAmount"];
|
||||
_hitPointsAddedNames = [];
|
||||
_hitPointsAddedStrings = [];
|
||||
_hitPointsAddedAmount = [];
|
||||
|
||||
// add repair events to this vehicle class
|
||||
{
|
||||
if (_x in _wheelHitPoints) then {
|
||||
@ -83,12 +91,60 @@ _wheelHitPointSelections = _wheelHitPointsWithSelections select 1;
|
||||
|
||||
// add misc repair action
|
||||
|
||||
private ["_name", "_text", "_icon", "_selection", "_condition", "_statement"];
|
||||
private ["_name", "_text", "_icon", "_selection", "_condition", "_statement", "_toFind", "_hitPointFoundIndex", "_combinedString"];
|
||||
|
||||
_name = format ["Repair_%1", _x];
|
||||
|
||||
_text = format ["STR_ACE_Repair_%1", _x];
|
||||
_text = if (isLocalized _text) then {localize _text} else {_x};
|
||||
// Prepare first part of the string from stringtable
|
||||
_text = LSTRING(Hit);
|
||||
|
||||
// Remove "Hit" from hitpoint name if one exists
|
||||
_toFind = if (_x find "Hit" == 0) then {
|
||||
[_x, 3] call CBA_fnc_substr
|
||||
} else {
|
||||
_x
|
||||
};
|
||||
|
||||
// Loop through always shorter part of the hitpoint name to find the string from stringtable or use an already found one
|
||||
for "_i" from 0 to (count _x) do {
|
||||
// Loop through already added hitpoints and save index
|
||||
_hitPointFoundIndex = -1;
|
||||
{
|
||||
if (_x == _toFind) exitWith {
|
||||
_hitPointFoundIndex = _forEachIndex;
|
||||
};
|
||||
} forEach _hitPointsAddedNames;
|
||||
|
||||
// Use already added hitpoint if one found above and numerize
|
||||
if (_hitPointFoundIndex != -1) exitWith {
|
||||
_text = (_hitPointsAddedNames select _hitPointFoundIndex) + " " + str(_hitPointsAddedAmount select _hitPointFoundIndex);
|
||||
_hitPointsAddedAmount set [_hitPointFoundIndex, (_hitPointsAddedAmount select _hitPointFoundIndex) + 1]; // Set amount
|
||||
TRACE_2("Same hitpoint found",_toFind,_hitPointsAddedNames);
|
||||
};
|
||||
|
||||
// Localize if localization found and save all variables for possible hitpoints of same type
|
||||
_combinedString = _text + _toFind;
|
||||
if (isLocalized _combinedString) exitWith {
|
||||
// Add hitpoint to the list
|
||||
_hitPointsAddedNames pushBack _toFind;
|
||||
_hitPointsAddedStrings pushBack _combinedString;
|
||||
_hitPointsAddedAmount pushBack 2;
|
||||
|
||||
// Localize text
|
||||
_text = localize _combinedString;
|
||||
TRACE_1("Hitpoint localized",_toFind);
|
||||
};
|
||||
|
||||
// Cut off one character
|
||||
_toFind = [_toFind, 0, count _toFind - 1] call CBA_fnc_substr;
|
||||
};
|
||||
|
||||
// Display part name directly if no string is found in stringtable
|
||||
if (_text == LSTRING(Hit)) then {
|
||||
_text = _x;
|
||||
};
|
||||
|
||||
|
||||
|
||||
_icon = "A3\ui_f\data\igui\cfg\actions\repair_ca.paa";
|
||||
_selection = "";
|
||||
|
@ -230,6 +230,15 @@
|
||||
<Hungarian>Motor</Hungarian>
|
||||
<Russian>Двигатель</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitHStabilizerL1">
|
||||
<English>Left Horizontal Stabilizer</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitHStabilizerR1">
|
||||
<English>Right Horizontal Stabilizer</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitVStabilizer1">
|
||||
<English>Vertical Stabilizer</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitFuel">
|
||||
<English>Fuel Tank</English>
|
||||
<German>Tank</German>
|
||||
@ -242,6 +251,24 @@
|
||||
<Hungarian>Üzemanyagtank</Hungarian>
|
||||
<Russian>Топливный бак</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitTransmission">
|
||||
<English>Transmission</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitGear">
|
||||
<English>Gear</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitStarter">
|
||||
<English>Starter</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitTail">
|
||||
<English>Tail</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitPilotTube">
|
||||
<English>Pilot Tube</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitStaticPort">
|
||||
<English>Static Port</English>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitTurret">
|
||||
<English>Main Turret</English>
|
||||
<German>Turm</German>
|
||||
@ -451,77 +478,17 @@
|
||||
<Hungarian>Bal szélvédő</Hungarian>
|
||||
<Russian>Стекло (слава)</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitGlass1">
|
||||
<English>Glass 1</English>
|
||||
<German>Scheibe 1</German>
|
||||
<Spanish>Ventana 1</Spanish>
|
||||
<French>Vitre 1</French>
|
||||
<Polish>Szyba 1</Polish>
|
||||
<Czech>Sklo 1</Czech>
|
||||
<Portuguese>Vidro 1</Portuguese>
|
||||
<Italian>Vetro 1</Italian>
|
||||
<Hungarian>Üveg 1</Hungarian>
|
||||
<Russian>Стекло 1</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitGlass2">
|
||||
<English>Glass 2</English>
|
||||
<German>Scheibe 2</German>
|
||||
<Spanish>Ventana 2</Spanish>
|
||||
<French>Vitre 2</French>
|
||||
<Polish>Szyba 2</Polish>
|
||||
<Czech>Sklo 2</Czech>
|
||||
<Portuguese>Vidro 2</Portuguese>
|
||||
<Italian>Vetro 2</Italian>
|
||||
<Hungarian>Üveg 2</Hungarian>
|
||||
<Russian>Стекло 2</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitGlass3">
|
||||
<English>Glass 3</English>
|
||||
<German>Scheibe 3</German>
|
||||
<Spanish>Ventana 3</Spanish>
|
||||
<French>Vitre 3</French>
|
||||
<Polish>Szyba 3</Polish>
|
||||
<Czech>Sklo 3</Czech>
|
||||
<Portuguese>Vidro 3</Portuguese>
|
||||
<Italian>Vetro 3</Italian>
|
||||
<Hungarian>Üveg 3</Hungarian>
|
||||
<Russian>Стекло 3</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitGlass4">
|
||||
<English>Glass 4</English>
|
||||
<German>Scheibe 4</German>
|
||||
<Spanish>Ventana 4</Spanish>
|
||||
<French>Vitre 4</French>
|
||||
<Polish>Szyba 4</Polish>
|
||||
<Czech>Sklo 4</Czech>
|
||||
<Portuguese>Vidro 4</Portuguese>
|
||||
<Italian>Vetro 4</Italian>
|
||||
<Hungarian>Üveg 4</Hungarian>
|
||||
<Russian>Стекло 4</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitGlass5">
|
||||
<English>Glass 5</English>
|
||||
<German>Scheibe 5</German>
|
||||
<Spanish>Ventana 5</Spanish>
|
||||
<French>Vitre 5</French>
|
||||
<Polish>Szyba 5</Polish>
|
||||
<Czech>Sklo 5</Czech>
|
||||
<Portuguese>Vidro 5</Portuguese>
|
||||
<Italian>Vetro 5</Italian>
|
||||
<Hungarian>Üveg 5</Hungarian>
|
||||
<Russian>Стекло 5</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_HitGlass6">
|
||||
<English>Glass 6</English>
|
||||
<German>Scheibe 6</German>
|
||||
<Spanish>Ventana 6</Spanish>
|
||||
<French>Vitre 6</French>
|
||||
<Polish>Szyba 6</Polish>
|
||||
<Czech>Sklo 6</Czech>
|
||||
<Portuguese>Vidro 6</Portuguese>
|
||||
<Italian>Vetro 6</Italian>
|
||||
<Hungarian>Üveg 6</Hungarian>
|
||||
<Russian>Стекло 6</Russian>
|
||||
<Key ID="STR_ACE_Repair_HitGlass">
|
||||
<English>Glass</English>
|
||||
<German>Scheibe</German>
|
||||
<Spanish>Ventana</Spanish>
|
||||
<French>Vitre</French>
|
||||
<Polish>Szyba</Polish>
|
||||
<Czech>Sklo</Czech>
|
||||
<Portuguese>Vidro</Portuguese>
|
||||
<Italian>Vetro</Italian>
|
||||
<Hungarian>Üveg</Hungarian>
|
||||
<Russian>Стекло</Russian>
|
||||
</Key>
|
||||
<Key ID="STR_ACE_Repair_moduleName">
|
||||
<English>Repair Settings</English>
|
||||
|
Loading…
Reference in New Issue
Block a user