diff --git a/addons/cargo/CfgEventHandlers.hpp b/addons/cargo/CfgEventHandlers.hpp index 15aaaadad6..689ba5f19e 100644 --- a/addons/cargo/CfgEventHandlers.hpp +++ b/addons/cargo/CfgEventHandlers.hpp @@ -16,85 +16,73 @@ class Extended_Killed_EventHandlers { }; }; -class Extended_Init_EventHandlers { +//Need initPost or we have problems with setVariable with 'ACE_Cargo' +class Extended_InitPost_EventHandlers { class StaticWeapon { class ADDON { init = QUOTE(_this call DFUNC(initObject)); }; }; - class ReammoBox_F { class ADDON { init = QUOTE(_this call DFUNC(initObject)); }; }; - class Cargo_base_F { class ADDON { init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); }; }; - class CargoNet_01_box_F { class ADDON { init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); }; }; - class Land_CargoBox_V1_F { class ADDON { init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); }; }; - class Land_PaperBox_closed_F { class ADDON { init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle)); }; }; - class Car { class ADDON { init = QUOTE(_this call DFUNC(initVehicle)); }; }; - class Tank { class ADDON { init = QUOTE(_this call DFUNC(initVehicle)); }; }; - class Helicopter { class ADDON { init = QUOTE(_this call DFUNC(initVehicle)); }; }; - class Plane { class ADDON { init = QUOTE(_this call DFUNC(initVehicle)); }; }; - class Ship_F { class ADDON { init = QUOTE(_this call DFUNC(initVehicle)); }; }; - class ACE_RepairItem_Base { class ADDON { init = QUOTE(_this call DFUNC(initObject)); }; }; - class ACE_bodyBagObject { class ADDON { init = QUOTE(_this call DFUNC(initObject)); }; }; - class ACE_ConcertinaWireCoil { class ADDON { init = QUOTE(_this call DFUNC(initObject)); diff --git a/addons/cargo/functions/fnc_addCargoItem.sqf b/addons/cargo/functions/fnc_addCargoItem.sqf index 1233d0228d..17264ec15a 100644 --- a/addons/cargo/functions/fnc_addCargoItem.sqf +++ b/addons/cargo/functions/fnc_addCargoItem.sqf @@ -30,9 +30,11 @@ for "_i" from 1 to _amount do { // Load item or delete it if no space left if !([_item, _vehicle] call FUNC(loadItem)) exitWith { + TRACE_1("no room to load item - deleting",_item); deleteVehicle _item; }; - + TRACE_1("Item Loaded",_item); + // Invoke listenable event ["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent); }; diff --git a/addons/cargo/functions/fnc_initVehicle.sqf b/addons/cargo/functions/fnc_initVehicle.sqf index efb3b9a5cf..d436e0d416 100644 --- a/addons/cargo/functions/fnc_initVehicle.sqf +++ b/addons/cargo/functions/fnc_initVehicle.sqf @@ -25,7 +25,11 @@ _initializedClasses = GETMVAR(GVAR(initializedClasses),[]); if (isServer) then { { if (isClass _x) then { - ["AddCargoByClass", [getText (_x >> "type"), _vehicle, getNumber (_x >> "amount")]] call EFUNC(common,localEvent); + private ["_cargoClassname", "_cargoCount"]; + _cargoClassname = getText (_x >> "type"); + _cargoCount = getNumber (_x >> "amount"); + TRACE_3("adding ACE_Cargo", (configName _x), _cargoClassname, _cargoCount); + ["AddCargoByClass", [_cargoClassname, _vehicle, _cargoCount]] call EFUNC(common,localEvent); }; } count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo")); }; diff --git a/addons/cargo/functions/fnc_loadItem.sqf b/addons/cargo/functions/fnc_loadItem.sqf index cf81bdbe6c..ebe4260bc6 100644 --- a/addons/cargo/functions/fnc_loadItem.sqf +++ b/addons/cargo/functions/fnc_loadItem.sqf @@ -19,13 +19,19 @@ private ["_loaded", "_space", "_itemSize"]; params ["_item", "_vehicle"]; +TRACE_2("params",_item,_vehicle); -if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith {false}; +if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitWith { + TRACE_2("canLoadItemIn failed",_item,_vehicle); + false +}; _loaded = _vehicle getVariable [QGVAR(loaded), []]; _loaded pushback _item; _vehicle setVariable [QGVAR(loaded), _loaded, true]; +TRACE_1("added to loaded array",_loaded); + _space = [_vehicle] call FUNC(getCargoSpaceLeft); _itemSize = [_item] call FUNC(getSizeItem); _vehicle setVariable [QGVAR(space), _space - _itemSize, true]; diff --git a/addons/cargo/script_component.hpp b/addons/cargo/script_component.hpp index 9716d7a536..3f4d6c5d51 100644 --- a/addons/cargo/script_component.hpp +++ b/addons/cargo/script_component.hpp @@ -1,6 +1,8 @@ #define COMPONENT cargo #include "\z\ace\addons\main\script_mod.hpp" +// #define DEBUG_MODE_FULL + #ifdef DEBUG_ENABLED_CARGO #define DEBUG_MODE_FULL #endif diff --git a/addons/repair/CfgEventHandlers.hpp b/addons/repair/CfgEventHandlers.hpp index 03b3b5b494..798a10316a 100644 --- a/addons/repair/CfgEventHandlers.hpp +++ b/addons/repair/CfgEventHandlers.hpp @@ -10,35 +10,32 @@ class Extended_PostInit_EventHandlers { }; }; -class Extended_Init_EventHandlers { +//Need initPost or we have problems with setVariable with addSpareParts +class Extended_InitPost_EventHandlers { class Car { class ADDON { init = QUOTE(_this call DFUNC(addRepairActions)); serverInit = QUOTE(_this call DFUNC(addSpareParts)); }; }; - class Tank { class ADDON { init = QUOTE(_this call DFUNC(addRepairActions)); serverInit = QUOTE(_this call DFUNC(addSpareParts)); }; }; - class Helicopter { class ADDON { init = QUOTE(_this call DFUNC(addRepairActions)); serverInit = QUOTE(_this call DFUNC(addSpareParts)); }; }; - class Plane { class ADDON { init = QUOTE(_this call DFUNC(addRepairActions)); serverInit = QUOTE(_this call DFUNC(addSpareParts)); }; }; - class Ship_F { class ADDON { init = QUOTE(_this call DFUNC(addRepairActions)); diff --git a/addons/repair/script_component.hpp b/addons/repair/script_component.hpp index 89983dd0e8..aa60544ad2 100644 --- a/addons/repair/script_component.hpp +++ b/addons/repair/script_component.hpp @@ -1,6 +1,8 @@ #define COMPONENT repair #include "\z\ace\addons\main\script_mod.hpp" +#define DEBUG_MODE_FULL + #ifdef DEBUG_ENABLED_REPAIR #define DEBUG_MODE_FULL #endif