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 StaticWeapon {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject));
|
init = QUOTE(_this call DFUNC(initObject));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ReammoBox_F {
|
class ReammoBox_F {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject));
|
init = QUOTE(_this call DFUNC(initObject));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Cargo_base_F {
|
class Cargo_base_F {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
|
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class CargoNet_01_box_F {
|
class CargoNet_01_box_F {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
|
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Land_CargoBox_V1_F {
|
class Land_CargoBox_V1_F {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
|
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Land_PaperBox_closed_F {
|
class Land_PaperBox_closed_F {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
|
init = QUOTE(_this call DFUNC(initObject); _this call DFUNC(initVehicle));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Car {
|
class Car {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initVehicle));
|
init = QUOTE(_this call DFUNC(initVehicle));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Tank {
|
class Tank {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initVehicle));
|
init = QUOTE(_this call DFUNC(initVehicle));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Helicopter {
|
class Helicopter {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initVehicle));
|
init = QUOTE(_this call DFUNC(initVehicle));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Plane {
|
class Plane {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initVehicle));
|
init = QUOTE(_this call DFUNC(initVehicle));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Ship_F {
|
class Ship_F {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initVehicle));
|
init = QUOTE(_this call DFUNC(initVehicle));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ACE_RepairItem_Base {
|
class ACE_RepairItem_Base {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject));
|
init = QUOTE(_this call DFUNC(initObject));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ACE_bodyBagObject {
|
class ACE_bodyBagObject {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject));
|
init = QUOTE(_this call DFUNC(initObject));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class ACE_ConcertinaWireCoil {
|
class ACE_ConcertinaWireCoil {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(initObject));
|
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
|
// Load item or delete it if no space left
|
||||||
if !([_item, _vehicle] call FUNC(loadItem)) exitWith {
|
if !([_item, _vehicle] call FUNC(loadItem)) exitWith {
|
||||||
|
TRACE_1("no room to load item - deleting",_item);
|
||||||
deleteVehicle _item;
|
deleteVehicle _item;
|
||||||
};
|
};
|
||||||
|
TRACE_1("Item Loaded",_item);
|
||||||
|
|
||||||
// Invoke listenable event
|
// Invoke listenable event
|
||||||
["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent);
|
["cargoAddedByClass", [_itemClass, _vehicle, _amount]] call EFUNC(common,globalEvent);
|
||||||
};
|
};
|
||||||
|
@ -25,7 +25,11 @@ _initializedClasses = GETMVAR(GVAR(initializedClasses),[]);
|
|||||||
if (isServer) then {
|
if (isServer) then {
|
||||||
{
|
{
|
||||||
if (isClass _x) 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"));
|
} count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo"));
|
||||||
};
|
};
|
||||||
|
@ -19,13 +19,19 @@
|
|||||||
private ["_loaded", "_space", "_itemSize"];
|
private ["_loaded", "_space", "_itemSize"];
|
||||||
|
|
||||||
params ["_item", "_vehicle"];
|
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 = _vehicle getVariable [QGVAR(loaded), []];
|
||||||
_loaded pushback _item;
|
_loaded pushback _item;
|
||||||
_vehicle setVariable [QGVAR(loaded), _loaded, true];
|
_vehicle setVariable [QGVAR(loaded), _loaded, true];
|
||||||
|
|
||||||
|
TRACE_1("added to loaded array",_loaded);
|
||||||
|
|
||||||
_space = [_vehicle] call FUNC(getCargoSpaceLeft);
|
_space = [_vehicle] call FUNC(getCargoSpaceLeft);
|
||||||
_itemSize = [_item] call FUNC(getSizeItem);
|
_itemSize = [_item] call FUNC(getSizeItem);
|
||||||
_vehicle setVariable [QGVAR(space), _space - _itemSize, true];
|
_vehicle setVariable [QGVAR(space), _space - _itemSize, true];
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#define COMPONENT cargo
|
#define COMPONENT cargo
|
||||||
#include "\z\ace\addons\main\script_mod.hpp"
|
#include "\z\ace\addons\main\script_mod.hpp"
|
||||||
|
|
||||||
|
// #define DEBUG_MODE_FULL
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED_CARGO
|
#ifdef DEBUG_ENABLED_CARGO
|
||||||
#define DEBUG_MODE_FULL
|
#define DEBUG_MODE_FULL
|
||||||
#endif
|
#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 Car {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(addRepairActions));
|
init = QUOTE(_this call DFUNC(addRepairActions));
|
||||||
serverInit = QUOTE(_this call DFUNC(addSpareParts));
|
serverInit = QUOTE(_this call DFUNC(addSpareParts));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Tank {
|
class Tank {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(addRepairActions));
|
init = QUOTE(_this call DFUNC(addRepairActions));
|
||||||
serverInit = QUOTE(_this call DFUNC(addSpareParts));
|
serverInit = QUOTE(_this call DFUNC(addSpareParts));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Helicopter {
|
class Helicopter {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(addRepairActions));
|
init = QUOTE(_this call DFUNC(addRepairActions));
|
||||||
serverInit = QUOTE(_this call DFUNC(addSpareParts));
|
serverInit = QUOTE(_this call DFUNC(addSpareParts));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Plane {
|
class Plane {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(addRepairActions));
|
init = QUOTE(_this call DFUNC(addRepairActions));
|
||||||
serverInit = QUOTE(_this call DFUNC(addSpareParts));
|
serverInit = QUOTE(_this call DFUNC(addSpareParts));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
class Ship_F {
|
class Ship_F {
|
||||||
class ADDON {
|
class ADDON {
|
||||||
init = QUOTE(_this call DFUNC(addRepairActions));
|
init = QUOTE(_this call DFUNC(addRepairActions));
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#define COMPONENT repair
|
#define COMPONENT repair
|
||||||
#include "\z\ace\addons\main\script_mod.hpp"
|
#include "\z\ace\addons\main\script_mod.hpp"
|
||||||
|
|
||||||
|
#define DEBUG_MODE_FULL
|
||||||
|
|
||||||
#ifdef DEBUG_ENABLED_REPAIR
|
#ifdef DEBUG_ENABLED_REPAIR
|
||||||
#define DEBUG_MODE_FULL
|
#define DEBUG_MODE_FULL
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user