Created
December 6, 2017 18:57
-
-
Save bosoy/4c994eed8cb4d183e50cf1018090e555 to your computer and use it in GitHub Desktop.
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
/* | |
File: fn_returnbaseParents.sqf | |
Author: Dimon UA | |
Description: | |
Returns list of base parent classes | |
Parameter(s): | |
_this select 0: starting config class (Config) | |
_this select 1: true if you want to return only classnames (Boolean) | |
Returns: | |
Array - List of base classes (including starting one) | |
*/ | |
private ["_entry","_returnString","_element","_parents"]; | |
_entry = _this select 0; | |
_returnString = if (count _this > 1) then {true} else {false}; | |
_parents = []; | |
if ( typename _entry == "STRING") then {_entry = (configFile >> "CfgVehicles" >> _entry)}; | |
if (typename _entry != "CONFIG") exitwith {hintsilent "Log: [Functions/returnParents] Entry (0) must be of type Config!"}; | |
for "_i" from 0 to 1 step 0 do | |
{ | |
_element = if (_returnString) then {configname _entry} else {_entry}; | |
_parents = _parents + [_element]; | |
_entry = inheritsfrom _entry; | |
if ((configName _entry) == "" | |
|| ((configName _entry) in ["All","AllVehicles","Air","Helicopter","Plane","Land","LandVehicle","Car","Truck","PaperCar","Wheeled_APC","Tank","APC","Tracked_APC", | |
"StaticWeapon","StaticMGWeapon","StaticATWeapon","StaticAAWeapon","StaticCannon","StaticGrenadeLauncher","StaticMortar","StaticSEARCHLight","StaticCanon", | |
"ACE_NoGeo_Tripod_Base","m113_Base","Pandur2_Base","ACE_T10","Plane_LG","ACE_Su30","Su34","F35_base","TU_MiG29_R73M"] | |
)) exitwith | |
{ | |
(_parents select ((count _parents) - 1)) | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment