mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
#2488 - Fix cargo setVariable on server with InitPost
This commit is contained in:
parent
05f4dad764
commit
789f3843d5
@ -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));
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -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"));
|
||||
};
|
||||
|
@ -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];
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user