mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Changed cargo initVehicle to event driven, Added listenable event cargo_itemAdded
This commit is contained in:
parent
4c86db9505
commit
583682396f
@ -27,7 +27,12 @@ _position set [2, (_position select 2) + 7.5];
|
||||
|
||||
for "_i" from 1 to _amount do {
|
||||
_item = createVehicle [_itemClass, _position, [], 0, "CAN_COLLIDE"];
|
||||
|
||||
// Load item or delete it if no space left
|
||||
if !([_item, _vehicle] call FUNC(loadItem)) exitWith {
|
||||
deleteVehicle _item;
|
||||
};
|
||||
|
||||
// Invoke listenable event
|
||||
["cargo_itemAdded", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent);
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Author: Glowbal
|
||||
* Initializes vehicle, adds open caro menu action if available.
|
||||
* Initializes vehicle, adds open cargo menu action if available.
|
||||
*
|
||||
* Arguments:
|
||||
* 0: Vehicle <OBJECT>
|
||||
@ -25,7 +25,7 @@ _initializedClasses = GETMVAR(GVAR(initializedClasses),[]);
|
||||
if (isServer) then {
|
||||
{
|
||||
if (isClass _x) then {
|
||||
[getText (_x >> "type"), _vehicle, getNumber (_x >> "amount")] call FUNC(addItem);
|
||||
["AddCargoItem", [getText (_x >> "type"), _vehicle, getNumber (_x >> "amount")]] call EFUNC(common,localEvent);
|
||||
};
|
||||
} count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo"));
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user