-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework vehicle classification system to not rely on EN translations
- Loading branch information
1 parent
d4d60ea
commit 3571b6d
Showing
10 changed files
with
209 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// private _fnc_scriptName = "TRGM_GLOBAL_fnc_getVehicleType"; | ||
params [["_type", "", [""]]]; | ||
|
||
|
||
private _configPath = (configFile >> "CfgVehicles" >> _type); | ||
private _vehData = [_configPath] call TRGM_GLOBAL_fnc_getVehicleData; | ||
_vehData params ["_className", "_dispName", "_rawDispName", "_calloutName", "_rawCalloutName", "_editorSubcategory", "_category", "_rawCategory", "_isTransport", "_isArmed"]; | ||
|
||
private _returnType = "UnarmedCars"; | ||
if (isNil "_className" || isNil "_dispName" || isNil "_calloutName" || isNil "_rawCategory" || [_configPath] call TRGM_GLOBAL_fnc_ignoreVehicle) then { | ||
_returnType = "UnarmedCars"; | ||
} else { | ||
if (_calloutName isEqualTo "mortar" || _className isKindOf "StaticMortar") then { | ||
_returnType = "Mortars"; | ||
} else { | ||
if (_className isKindOf "StaticMGWeapon" || _className isKindOf "StaticGrenadeLauncher") then { | ||
_returnType = "Turrets"; | ||
} else { | ||
private _typeFound = false; | ||
private _returnTypeMap = [ | ||
["Cars", ["car", "truck", "mrap", "bike", "bicycle"]], | ||
["Mortars", ["mortar"]], | ||
["Turrets", ["turret", "static"]], | ||
["Boats", ["boat", "ship"]], | ||
["Artillery", ["artillery", "arty"]], | ||
["AntiAir", ["_aa", "radar", "air defence"]], | ||
["Planes", ["plane"]], | ||
["APCs", ["apc", "ifv"]], | ||
["Tanks", ["tank", "armor"]], | ||
["Helos", ["helicopter"]] | ||
]; | ||
if (!_typeFound) then { | ||
{ | ||
private _searchText = _x; | ||
if ([_searchText, _rawCategory] call BIS_fnc_inString) exitWith { | ||
_typeFound = true; | ||
private _mapIndex = _returnTypeMap findIf { _searchText in (_x select 1) }; | ||
_returnType = (_returnTypeMap select _mapIndex) select 0; | ||
if (_returnType in ["Cars", "Helos"]) then { | ||
if (_isArmed && !_isTransport) then { | ||
_returnType = "Armed" + _returnType; | ||
} else { | ||
_returnType = "Unarmed" + _returnType; | ||
}; | ||
}; | ||
}; | ||
} forEach (flatten (_returnTypeMap apply { _x select 1})); | ||
}; | ||
if (!_typeFound) then { | ||
{ | ||
private _searchText = _x; | ||
if ([_searchText, _rawCalloutName] call BIS_fnc_inString) exitWith { | ||
_typeFound = true; | ||
private _mapIndex = _returnTypeMap findIf { _searchText in (_x select 1) }; | ||
_returnType = (_returnTypeMap select _mapIndex) select 0; | ||
if (_returnType in ["Cars", "Helos"]) then { | ||
if (_isArmed && !_isTransport) then { | ||
_returnType = "Armed" + _returnType; | ||
} else { | ||
_returnType = "Unarmed" + _returnType; | ||
}; | ||
}; | ||
}; | ||
} forEach (flatten (_returnTypeMap apply { _x select 1})); | ||
}; | ||
}; | ||
}; | ||
}; | ||
|
||
// Possible return types are: | ||
// [ | ||
// "UnarmedCars", | ||
// "ArmedCars", | ||
// "Mortars", | ||
// "Turrets", | ||
// "Boats", | ||
// "Artillery", | ||
// "AntiAir", | ||
// "Planes", | ||
// "APCs", | ||
// "Tanks", | ||
// "ArmedHelos", | ||
// "UnarmedHelos", | ||
// ] | ||
_returnType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.