Added load in cargo containers

This commit is contained in:
Glowbal 2015-08-14 22:01:14 +02:00
parent 55ad706761
commit 96ec435d0d
8 changed files with 223 additions and 11 deletions

View File

@ -22,6 +22,23 @@ class Extended_Init_EventHandlers {
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 Car {
class ADDON {
init = QUOTE(_this call DFUNC(initVehicle));

View File

@ -10,8 +10,8 @@ class CfgVehicles {
class ACE_medicalSupplyCrate {
type = "ACE_medicalSupplyCrate";
amount = 1;
};*/
};
};
};*/
};
};
@ -69,4 +69,185 @@ class CfgVehicles {
GVAR(size) = 2; // 1 = small, 2 = large
GVAR(canLoad) = 1;
};
class Cargo_base_F: ThingX {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
GVAR(size) = 4;
GVAR(canLoad) = 1;
class ACE_Actions {
class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction);
distance = 5;
condition = QUOTE(true);
statement = "";
icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa";
selection = "";
};
};
};
class Cargo10_base_F: Cargo_base_F {
GVAR(space) = 14;
GVAR(size) = 15;
XEH_ENABLED;
};
class Land_Cargo20_blue_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_brick_red_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_cyan_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_grey_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_light_blue_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_light_green_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_military_green_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_military_ruins_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_orange_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_red_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_sand_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_vr_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_white_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo20_yellow_F: Cargo_base_F {
GVAR(space) = 49;
GVAR(size) = 50;
XEH_ENABLED;
};
class Land_Cargo40_blue_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_brick_red_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_cyan_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_grey_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_light_blue_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_light_green_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_military_green_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_military_ruins_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_orange_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_red_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_sand_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_vr_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_white_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
class Land_Cargo40_yellow_F: Cargo_base_F {
GVAR(space) = 99;
GVAR(size) = 100;
XEH_ENABLED;
};
// small
class Land_CargoBox_V1_F: ThingX {
GVAR(space) = 7;
GVAR(hasCargo) = 1;
GVAR(size) = 7;
XEH_ENABLED;
class ACE_Actions {
class ACE_MainActions {
displayName = ECSTRING(interaction,MainAction);
distance = 5;
condition = QUOTE(true);
statement = "";
icon = "\a3\ui_f\data\IGUI\Cfg\Actions\eject_ca.paa";
selection = "";
};
};
};
};

View File

@ -18,6 +18,14 @@ params ["_player", "_object"];
private ["_nearestVehicle"];
_nearestVehicle = [_player] call FUNC(findNearestVehicle);
if (_nearestVehicle isKindOf "Cargo_Base_F" || isNull _nearestVehicle) then {
{
if ([_object, _x] call FUNC(canLoadItemIn)) exitwith {_nearestVehicle = _x};
}foreach (nearestObjects [_player, ["Cargo_base_F"], MAX_LOAD_DISTANCE]);
};
if (isNull _nearestVehicle) exitwith {false};
[_object, _nearestVehicle] call FUNC(canLoadItemIn);

View File

@ -13,7 +13,7 @@
#include "script_component.hpp"
private ["_loadCar", "_loadHelicopter", "_loadTank", "_loadShip"];
private ["_loadCar", "_loadHelicopter", "_loadTank", "_loadShip", "_loadContainer"];
params ["_unit"];
_loadCar = nearestObject [_unit, "car"];
@ -28,4 +28,7 @@ if (_unit distance _loadTank <= MAX_LOAD_DISTANCE) exitwith {_loadTank};
_loadShip = nearestObject [_unit, "ship"];
if (_unit distance _loadShip <= MAX_LOAD_DISTANCE) exitwith {_loadShip};
_loadContainer = nearestObject [_unit,"Cargo_base_F"];
if (_unit distance _loadContainer <= MAX_LOAD_DISTANCE) exitwith {_loadContainer};
objNull;

View File

@ -20,7 +20,6 @@ private ["_type", "_initializedClasses"];
_type = typeOf _vehicle;
_initializedClasses = GETMVAR(GVAR(initializedClasses),[]);
if (isServer) then {
{
if (isClass _x) then {
@ -41,7 +40,6 @@ if (isServer) then {
} count ("true" configClasses (configFile >> "CfgVehicles" >> _type >> "ACE_Cargo" >> "Cargo"));
};
// do nothing if the class is already initialized
if (_type in _initializedClasses) exitWith {};
// set class as initialized
@ -53,7 +51,7 @@ if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) ex
private ["_text", "_condition", "_statement", "_icon", "_action"];
_text = localize "STR_ACE_Cargo_openMenu";
_condition = {true};
_statement = {diag_log format["_target %1", _target];GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);};
_statement = {GVAR(interactionVehicle) = _target; createDialog QGVAR(menu);};
_icon = "";
_action = [QGVAR(openMenu), _text, _icon, _statement, _condition] call EFUNC(interact_menu,createAction);

View File

@ -18,5 +18,12 @@ params ["_player", "_object"];
private ["_nearestVehicle"];
_nearestVehicle = [_player] call FUNC(findNearestVehicle);
if (isNull _nearestVehicle || _nearestVehicle isKindOf "Cargo_Base_F") then {
{
if ([_item, _x] call FUNC(canLoadItemIn)) exitwith {_nearestVehicle = _x};
}foreach (nearestObjects [_player, ["Cargo_base_F"], MAX_LOAD_DISTANCE]);
};
if (isNull _nearestVehicle) exitwith {false};
[_object, _nearestVehicle] call FUNC(loadItem);

View File

@ -13,20 +13,19 @@
#include "script_component.hpp"
private ["_display", "_loaded", "_loadedCount", "_ctrl", "_selected", "_item"];
private ["_display", "_loaded", "_ctrl", "_selected", "_item"];
disableSerialization;
_display = uiNamespace getvariable QGVAR(menuDisplay);
if (isnil "_display") exitwith {};
_loaded = GVAR(interactionVehicle) getvariable [QGVAR(loaded), []];
_loadedCount = count _loaded;
if (_loadedCount == 0) exitwith {};
if (count _loaded == 0) exitwith {};
_ctrl = _display displayCtrl 100;
_selected = (lbCurSel _ctrl) max 0;
if (_loadedCount <= _selected) exitwith {systemChat format["count: %1 %2", _loadedCount, _selected]};
if (count _loaded <= _selected) exitwith {};
_item = _loaded select _selected;
[_item, GVAR(interactionVehicle)] call FUNC(unloadItem);

View File

@ -18,7 +18,6 @@ private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"];
params ["_item", "_vehicle"];
if !([_item, _vehicle] call FUNC(canUnloadItem)) exitwith {
systemChat format["Can not unload item"];
false
};