79 lines
2.4 KiB
Plaintext
79 lines
2.4 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* Author: IDSolutions
|
|
* Adds vehicles to virtual garage and categorizes them by type
|
|
*
|
|
* Arguments:
|
|
* 0: Vehicles <ARRAY> - Array of vehicle classnames
|
|
*/
|
|
|
|
params [["_vehicles", [], [[]]]];
|
|
|
|
private _default = [[],[],[],[],[],[]];
|
|
// private _garage_unlocks = player getVariable ["Garage_Unlocks", _default];
|
|
private _garage_unlocks = GETVAR(player,Garage_Unlocks,_default);
|
|
|
|
private _cars = _garage_unlocks select 0;
|
|
private _armor = _garage_unlocks select 1;
|
|
private _helis = _garage_unlocks select 2;
|
|
private _planes = _garage_unlocks select 3;
|
|
private _naval = _garage_unlocks select 4;
|
|
private _static = _garage_unlocks select 5;
|
|
|
|
{
|
|
switch true do {
|
|
case (_x isKindOf "Car"): {
|
|
if ((_x isKindOf "Tank") || (_x isKindOf "Wheeled_APC_F")) exitWith {};
|
|
_cars pushBackUnique _x;
|
|
};
|
|
case (_x isKindOf "Tank"): {
|
|
_armor pushBackUnique _x;
|
|
};
|
|
case (_x isKindOf "Helicopter"): {
|
|
_helis pushBackUnique _x;
|
|
};
|
|
case (_x isKindOf "Plane"): {
|
|
_planes pushBackUnique _x;
|
|
};
|
|
case (_x isKindOf "Ship"): {
|
|
_naval pushBackUnique _x;
|
|
};
|
|
case (_x isKindOf "Static"): {
|
|
_static pushBackUnique _x;
|
|
};
|
|
};
|
|
} forEach _vehicles;
|
|
|
|
GVAR(car_unlocks) = [];
|
|
GVAR(armor_unlocks) = [];
|
|
GVAR(heli_unlocks) = [];
|
|
GVAR(plane_unlocks) = [];
|
|
GVAR(naval_unlocks) = [];
|
|
GVAR(static_unlocks) = [];
|
|
|
|
{
|
|
GVAR(car_unlocks) append [getText(configFile >> "CfgVehicles" >> _x >> "model"),[configFile >> "CfgVehicles" >> _x]];
|
|
} forEach _cars;
|
|
|
|
{
|
|
GVAR(armor_unlocks) append [getText(configFile >> "CfgVehicles" >> _x >> "model"),[configFile >> "CfgVehicles" >> _x]];
|
|
} forEach _armor;
|
|
|
|
{
|
|
GVAR(heli_unlocks) append [getText(configFile >> "CfgVehicles" >> _x >> "model"),[configFile >> "CfgVehicles" >> _x]];
|
|
} forEach _helis;
|
|
|
|
{
|
|
GVAR(plane_unlocks) append [getText(configFile >> "CfgVehicles" >> _x >> "model"),[configFile >> "CfgVehicles" >> _x]];
|
|
} forEach _planes;
|
|
|
|
{
|
|
GVAR(naval_unlocks) append [getText(configFile >> "CfgVehicles" >> _x >> "model"),[configFile >> "CfgVehicles" >> _x]];
|
|
} forEach _naval;
|
|
|
|
{
|
|
GVAR(static_unlocks) append [getText(configFile >> "CfgVehicles" >> _x >> "model"),[configFile >> "CfgVehicles" >> _x]];
|
|
} forEach _static;
|
|
|
|
TRACE_1("Virtual vehicles updated",count _vehicles); |