mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Added support for cargo configuration on vehicle spawn
This commit is contained in:
parent
ffa476bee2
commit
abc732ac35
@ -4,6 +4,15 @@ class CfgVehicles {
|
||||
class Car: LandVehicle {
|
||||
GVAR(space) = 4;
|
||||
GVAR(hasCargo) = 1;
|
||||
class ACE_Cargo {
|
||||
/*
|
||||
class Cargo {
|
||||
class ACE_medicalSupplyCrate {
|
||||
type = "ACE_medicalSupplyCrate";
|
||||
amount = 1;
|
||||
};*/
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
class Tank: LandVehicle {
|
||||
|
@ -17,10 +17,31 @@ params ["_vehicle"];
|
||||
TRACE_1("params", _vehicle);
|
||||
|
||||
private ["_type", "_initializedClasses"];
|
||||
|
||||
_type = typeOf _vehicle;
|
||||
_initializedClasses = GETMVAR(GVAR(initializedClasses),[]);
|
||||
|
||||
|
||||
if (isServer) then {
|
||||
{
|
||||
if (isClass _x) then {
|
||||
private ["_className", "_amount","_position","_object"];
|
||||
_className = getText (_x >> "type");
|
||||
_amount = getNumber (_x >> "amount");
|
||||
_position = getPos _vehicle;
|
||||
_position set [2, (_position select 2) + 7.5];
|
||||
_position set [1, (_position select 1) + 1];
|
||||
for "_i" from 1 to _amount do {
|
||||
_object = createVehicle [_className, _position, [], 0, "CAN_COLLIDE"];
|
||||
if !([_object, _vehicle] call FUNC(loadItem)) exitwith {
|
||||
deleteVehicle _object;
|
||||
};
|
||||
};
|
||||
};
|
||||
nil
|
||||
}count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo"));
|
||||
};
|
||||
|
||||
|
||||
// do nothing if the class is already initialized
|
||||
if (_type in _initializedClasses) exitWith {};
|
||||
// set class as initialized
|
||||
|
Loading…
Reference in New Issue
Block a user