Fix repair cargo not added to zeus created objects (#4201)

- Fix #4200 (add delay for units created via zeus)
- Use ace_settingsInitialized to add events
This commit is contained in:
PabstMirror 2016-08-03 13:44:04 -05:00 committed by GitHub
parent 0a56ab1fc4
commit afe3e5ccd3
3 changed files with 14 additions and 3 deletions

View File

@ -22,13 +22,11 @@ class Extended_InitPost_EventHandlers {
class Car {
class ADDON {
init = QUOTE(_this call DFUNC(addRepairActions));
serverInit = QUOTE([ARR_3(_this select 0,1,'ACE_Wheel')] call DFUNC(addSpareParts));
};
};
class Tank {
class ADDON {
init = QUOTE(_this call DFUNC(addRepairActions));
serverInit = QUOTE([ARR_3(_this select 0,1,'ACE_Track')] call DFUNC(addSpareParts));
};
};
class Motorcycle {

View File

@ -5,3 +5,14 @@
// wheels
[QGVAR(setWheelHitPointDamage), {(_this select 0) setHitPointDamage [_this select 1, _this select 2]}] call CBA_fnc_addEventHandler;
if (isServer) then {
["ace_settingsInitialized", {
TRACE_1("ace_settingsInitialized eh", GVAR(addSpareParts));
if (!GVAR(addSpareParts)) exitWith {};
if (!(["ace_cargo"] call EFUNC(common,isModLoaded))) exitWith {};
["Car", "Init", {[_this select 0, 1, "ACE_Wheel"] call FUNC(addSpareParts)}, true, [], true] call CBA_fnc_addClassEventHandler;
["Tank", "Init", {[_this select 0, 1, "ACE_Track"] call FUNC(addSpareParts)}, true, [], true] call CBA_fnc_addClassEventHandler;
}] call CBA_fnc_addEventHandler;
};

View File

@ -33,4 +33,6 @@ if (!EGVAR(common,settingsInitFinished)) exitWith {
if (!_force && !GVAR(addSpareParts)) exitWith {};
// Load
["ace_addCargo", [_part, _vehicle, _amount]] call CBA_fnc_localEvent;
[{
["ace_addCargo", _this] call CBA_fnc_localEvent;
}, [_part, _vehicle, _amount]] call CBA_fnc_execNextFrame;