Initial load in cargo module

This commit is contained in:
Glowbal 2015-08-10 23:07:47 +02:00
parent 27a57d89f8
commit c016d01414
23 changed files with 735 additions and 8 deletions

View File

@ -4,3 +4,51 @@ class Extended_PreInit_EventHandlers {
init = QUOTE(call COMPILE_FILE(XEH_preInit));
};
};
class Extended_Killed_EventHandlers {
class All {
init = QUOTE(call FUNC(handleDestroyed));
};
};
class Extended_Init_EventHandlers {
class StaticWeapon {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
class ReammoBox_F {
class ADDON {
init = QUOTE(_this call DFUNC(initObject));
};
};
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));
};
};
};

View File

@ -0,0 +1,63 @@
class CfgVehicles {
class LandVehicle;
class Car: LandVehicle {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
};
class Tank: LandVehicle {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
};
class Car_F;
class Truck_F: Car_F {
GVAR(space) = 8;
GVAR(hasCargo) = 1;
};
class Air;
// Repair helicopters
class Helicopter: Air {
GVAR(space) = 8;
GVAR(hasCargo) = 1;
};
class Heli_Transport_02_base_F;
class I_Heli_Transport_02_F : Heli_Transport_02_base_F {
GVAR(space) = 20;
GVAR(hasCargo) = 1;
};
// Repair fixed wing aircraft
class Plane: Air {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
};
// boats
class Ship;
class Ship_F: Ship {
GVAR(space) = 4;
GVAR(hasCargo) = 1;
};
// Static weapons
class StaticWeapon: LandVehicle {
GVAR(size) = 2; // 1 = small, 2 = large
GVAR(canLoad) = 1;
};
class StaticMortar;
class Mortar_01_base_F: StaticMortar {
GVAR(size) = 2; // 1 = small, 2 = large
GVAR(canLoad) = 1;
};
// Ammo boxes
class ThingX;
class ReammoBox_F: ThingX {
GVAR(size) = 2; // 1 = small, 2 = large
GVAR(canLoad) = 1;
};
};

View File

@ -2,6 +2,25 @@
ADDON = false;
PREP(empty);
PREP(canLoadItemIn);
PREP(canUnloadItem);
PREP(canLoad);
PREP(findNearestVehicle);
PREP(getCargoSpaceLeft);
PREP(GetSizeItem);
PREP(initObject);
PREP(initVehicle);
PREP(handleDestroyed);
PREP(loadItem);
PREP(onMenuOpen);
PREP(unloadItem);
PREP(validateCargoSpace);
PREP(startLoadIn);
PREP(startUnload);
GVAR(initializedItemClasses) = [];
if (isServer) then {
["cargo_hideItem", {(_this select 0) hideObjectGlobal (_this select 1);}] call EFUNC(common,addEventHandler);
};
ADDON = true;

View File

@ -5,11 +5,13 @@ class CfgPatches {
units[] = {};
weapons[] = {};
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"ace_common","ace_interaction","ace_interact_menu"};
author[] = {"commy2"};
authorUrl = "https://github.com/commy2";
requiredAddons[] = {"ace_interaction"};
author[] = {"commy2", "Glowbal"};
authorUrl = "https://ace3mod.com/";
VERSION_CONFIG;
};
};
#include "CfgEventHandlers.hpp"
#include "CfgVehicles.hpp"
#include "menu.hpp"

View File

@ -0,0 +1,23 @@
/*
* Author: Glowbal
* Check if player can load item into the nearest vehicle
*
* Arguments:
* 0: Player <OBJECT>
* 1: Object to load <OBJECT>
*
* Return value:
* Can load <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
params ["_player", "_object"];
private ["_nearestVehicle"];
_nearestVehicle = [_player] call FUNC(findNearestVehicle);
if (isNull _nearestVehicle) exitwith {false};
[_object, _nearestVehicle] call FUNC(canLoadItemIn);

View File

@ -0,0 +1,23 @@
/*
* Author: Glowbal
* Check if item can be loaded into other Object
*
* Arguments:
* 0: Any object <OBJECT>
* 1: Object <OBJECT>
*
* Return value:
* Can load in <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
params ["_item", "_vehicle"];
if (speed _vehicle > 1 || (((getPos _vehicle) select 2) > 3)) exitwith {false};
private "_itemSize";
_itemSize = ([_item] call FUNC(getSizeItem));
_itemSize > 0 && {alive _item && alive _vehicle} && {(_item distance _vehicle <= MAX_LOAD_DISTANCE)} && {_itemSize <= ([_vehicle] call FUNC(getCargoSpaceLeft))};

View File

@ -0,0 +1,39 @@
/*
* Author: Glowbal, ViperMaul
* Check if item can be unloaded
*
* Arguments:
* 0: loaded object <OBJECT>
* 1: Object <OBJECT>
*
* Return value:
* Can be unloaded <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
private ["_loaded", "_position", "_validVehiclestate", "_emptyPos"];
params ["_item", "_vehicle"];
_loaded = _vehicle getvariable [QGVAR(loaded), []];
if !(_item in _loaded) exitwith {false};
_validVehiclestate = true;
_emptyPos = [];
if (_vehicle isKindOf "Ship" ) then {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot.
} else {
if (_vehicle isKindOf "Air" ) then {
if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false};
_emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition);
_emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ];
} else {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]);
};
};
if (!_validVehiclestate) exitwith { false };
(count _emptyPos != 0);

View File

@ -1,3 +0,0 @@
#include "script_component.hpp"
diag_log text format["This is here as an example!!!"];

View File

@ -0,0 +1,31 @@
/*
* Author: Glowbal
* Get nearest vehicle, priority car, air, tank, ship
*
* Arguments:
* 0: Object <OBJECT>
*
* Return value:
* Can load <BOOL>
*
* Public: No
*/
#include "script_component.hpp"
private ["_vehicle"];
params ["_unit"];
_vehicle = nearestObject [_unit, "car"];
if (_unit distance _vehicle <= MAX_LOAD_DISTANCE) exitwith {_vehicle};
_loadhelicopter = nearestObject [_unit, "air"];
if (_unit distance _vehicle <= MAX_LOAD_DISTANCE) exitwith {_vehicle};
_loadtank = nearestObject [_unit, "tank"];
if (_unit distance _vehicle <= MAX_LOAD_DISTANCE) exitwith {_vehicle};
_loadtank = nearestObject [_unit, "ship"];
if (_unit distance _vehicle <= MAX_LOAD_DISTANCE) exitwith {_vehicle};
objNull;

View File

@ -0,0 +1,17 @@
/*
* Author: Glowbal
* Get the cargo space left on object
*
* Arguments:
* 0: Object <OBJECT>
*
* Return value:
* Cargo space left <NUMBER>
*
* Public: No
*/
#include "script_component.hpp"
params ["_vehicle"];
_vehicle getvariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> QGVAR(space))];

View File

@ -0,0 +1,20 @@
/*
* Author: Glowbal
* Get the cargo size of an object
*
* Arguments:
* 0: Object <OBJECT>
*
* Return value:
* Cargo size. -1 is not a size defined <NUMBER>
*
* Public: No
*/
#include "script_component.hpp"
params ["_item"];
if (isNumber (configFile >> "CfgVehicles" >> typeof _item >> QGVAR(size))) exitwith {
_item getvariable [QGVAR(size), getNumber (configFile >> "CfgVehicles" >> typeof _item >> QGVAR(size))];
};
-1;

View File

@ -0,0 +1,27 @@
/*
* Author: Glowbal
* Handle object being destroyed
*
* Arguments:
* 0: Object <OBJECT>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["_vehicle"];
_loaded = _vehicle getvariable [QGVAR(loaded), []];
if (count _loaded == 0) exitwith {};
{
// TODO deleteVehicle or just delete vehicle? Do we want to be able to recover destroyed equipment?
deleteVehicle _x;
//_x setDamage 1;
}foreach _loaded;
[_vehicle] call FUNC(validateCargoSpace);

View File

@ -0,0 +1,28 @@
/*
* Author: Glowbal
* Initialize variables for loadable objects. Called from init EH.
*
* Arguments:
* 0: Any object <OBJECT>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["_object"];
if (getNumber (configFile >> "CfgVehicles" >> typeOf _object >> QGVAR(canLoad)) != 1) exitwith {};
private ["_type", "_action"];
_type = typeOf _object;
// do nothing if the class is already initialized
if (_type in GVAR(initializedItemClasses)) exitWith {};
GVAR(initializedItemClasses) pushBack _type;
_action = [QGVAR(load), localize LSTRING(loadObject), "", {[_player, _target] call FUNC(startLoadIn)}, {[_player, _target] call FUNC(canLoad)}] call EFUNC(interact_menu,createAction);
[_type, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass);

View File

@ -0,0 +1,39 @@
/*
* Author: Glowbal
* initalize vehicle. Adds open caro menu action if available
*
* Arguments:
* 0: vehicle <OBJECT>
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["_vehicle"];
TRACE_1("params", _vehicle);
private ["_type", "_initializedClasses"];
_type = typeOf _vehicle;
_initializedClasses = GETMVAR(GVAR(initializedClasses),[]);
// do nothing if the class is already initialized
if (_type in _initializedClasses) exitWith {};
// set class as initialized
_initializedClasses pushBack _type;
SETMVAR(GVAR(initializedClasses),_initializedClasses);
if (getNumber (configFile >> "CfgVehicles" >> _type >> QGVAR(hasCargo)) != 1) exitwith {};
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);};
_icon = "";
_action = [QGVAR(openMenu), _text, _icon, _statement, _condition] call EFUNC(interact_menu,createAction);
[_type, 0, ["ACE_MainActions"], _action] call EFUNC(interact_menu,addActionToClass);

View File

@ -0,0 +1,34 @@
/*
* Author: Glowbal
* Load object into vehicle
*
* Arguments:
* 0: Object <OBJECT>
* 1: Vehicle <OBJECT>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_loaded", "_space", "_itemSize"];
params ["_item", "_vehicle"];
if !([_item, _vehicle] call FUNC(canLoadItemIn)) exitwith {false};
_loaded = _vehicle getvariable [QGVAR(loaded), []];
_loaded pushback _item;
_vehicle setvariable [QGVAR(loaded), _loaded, true];
_space = [_vehicle] call FUNC(getCargoSpaceLeft);
_itemSize = [_item] call FUNC(getSizeItem);
_vehicle setvariable [QGVAR(space), _space - _itemSize, true];
detach _item;
_item attachTo [_vehicle,[0,0,100]];
["cargo_hideItem", [_item, true]] call EFUNC(common,serverEvent);
true;

View File

@ -0,0 +1,44 @@
/*
* Author: Glowbal
* Handle the UI data display
*
* Arguments:
* 0: display <DISPLAY>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
disableSerialization;
params["_display"];
uiNamespace setvariable [QGVAR(menuDisplay), _display];
[{
private ["_display","_loaded", "_ctrl", "_label"];
disableSerialization;
_display = uiNamespace getvariable QGVAR(menuDisplay);
if (isnil "_display") exitwith {
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
if (isNull GVAR(interactionVehicle) || ACE_player distance GVAR(interactionVehicle) >= 10) exitwith {
closeDialog 0;
[_this select 1] call CBA_fnc_removePerFrameHandler;
};
_loaded = GVAR(interactionVehicle) getvariable [QGVAR(loaded), []];
_ctrl = _display displayCtrl 100;
_label = _display displayCtrl 2;
lbClear _ctrl;
{
_ctrl lbAdd (getText(configfile >> "CfgVehicles" >> typeOf _x >> "displayName"));
}foreach _loaded;
_label ctrlSetText format[localize "STR_ACE_Cargo_labelSpace", [GVAR(interactionVehicle)] call DFUNC(getCargoSpaceLeft)];
}, 0, []] call CBA_fnc_addPerFrameHandler;

View File

@ -0,0 +1,22 @@
/*
* Author: Glowbal
* Start load item
*
* Arguments:
* 0: Any object <OBJECT>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
params ["_player", "_object"];
private ["_nearestVehicle"];
_nearestVehicle = [_player] call FUNC(findNearestVehicle);
if (isNull _nearestVehicle) exitwith {false};
[_object, _nearestVehicle] call FUNC(loadItem);

View File

@ -0,0 +1,31 @@
/*
* Author: Glowbal
* Start unload action
*
* Arguments:
* None
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_display", "_loaded", "_ctrl", "_selected", "_item"];
disableSerialization;
_display = uiNamespace getvariable QGVAR(menuDisplay);
if (isnil "_display") exitwith {};
_loaded = GVAR(interactionVehicle) getvariable [QGVAR(loaded), []];
if (count _loaded == 0) exitwith {};
_ctrl = _display displayCtrl 100;
_selected = (lbCurSel _ctrl) max 0;
if (count _loaded <= _selected) exitwith {systemChat format["count: %1 %2", count _loaded, _selected]};
_item = _loaded select _selected;
[_item, GVAR(interactionVehicle)] call FUNC(unloadItem);

View File

@ -0,0 +1,63 @@
/*
* Author: Glowbal, ViperMaul
* Unload object from vehicle
*
* Arguments:
* 0: Object <OBJECT>
* 1: Vehicle <OBJECT>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_loaded", "_space", "_itemSize", "_emptyPos", "_validVehiclestate"];
params ["_item", "_vehicle"];
if !([_item, _vehicle] call FUNC(canUnloadItem)) exitwith {
systemChat format["Can not unload item"];
false
};
_validVehiclestate = true;
_emptyPos = [];
if (_vehicle isKindOf "Ship" ) then {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
TRACE_1("SHIP Ground Check", getPosATL _vehicle );
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 15, typeOf _item]); // TODO: if spot is underwater pick another spot.
} else {
if (_vehicle isKindOf "Air" ) then {
if !(speed _vehicle <1 && {isTouchingGround _vehicle}) then {_validVehiclestate = false};
TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle);
_emptyPos = (getPosASL _vehicle) call EFUNC(common,ASLtoPosition);
_emptyPos = [(_emptyPos select 0) + random(5), (_emptyPos select 1) + random(5), _emptyPos select 2 ];
} else {
if !(speed _vehicle <1 && {(((getPosATL _vehicle) select 2) < 2)}) then {_validVehiclestate = false};
TRACE_1("Vehicle Ground Check", isTouchingGround _vehicle);
_emptyPos = ((getPosASL _vehicle) call EFUNC(common,ASLtoPosition) findEmptyPosition [0, 13, typeOf _item]);
};
};
TRACE_1("getPosASL Vehicle Check", getPosASL _vehicle);
if (!_validVehiclestate) exitwith { false };
if (count _emptyPos == 0) exitwith { false}; //consider displaying text saying there are no safe places to exit the vehicle
_loaded = _vehicle getvariable [QGVAR(loaded), []];
_loaded = _loaded - [_item];
_vehicle setvariable [QGVAR(loaded), _loaded, true];
_space = [_vehicle] call FUNC(getCargoSpaceLeft);
_itemSize = [_item] call FUNC(getSizeItem);
_vehicle setvariable [QGVAR(space), _space + _itemSize, true];
detach _item;
_item setPosASL (_emptyPos call EFUNC(common,PositiontoASL));
["cargo_hideItem", [_item, false]] call EFUNC(common,serverEvent);
// TOOO maybe drag/carry the unloaded item?
true;

View File

@ -0,0 +1,31 @@
/*
* Author: Glowbal
* Validate the vehicle cargo space
*
* Arguments:
* 0: Object <OBJECT>
*
* Return value:
* None
*
* Public: No
*/
#include "script_component.hpp"
private ["_loaded", "_newLoaded", "_totalSpaceOccupied"];
params ["_vehicle"];
_loaded = _vehicle getvariable [QGVAR(loaded), []];
_newLoaded = [];
_totalSpaceOccupied = 0;
{
if !(isNull _x) then {
_newLoaded pushback _x;
_totalSpaceOccupied = _totalSpaceOccupied + ([_x] call FUNC(getSizeItem));
};
}foreach _loaded;
if (count _loaded != count _newLoaded) then {
_vehicle setvariable [QGVAR(loaded), _newLoaded, true];
};
_vehicle setvariable [QGVAR(space), getNumber (configFile >> "CfgVehicles" >> typeof _vehicle >> QGVAR(space)) - _totalSpaceOccupied, true];

104
addons/cargo/menu.hpp Normal file
View File

@ -0,0 +1,104 @@
#include "\z\ace\addons\common\define.hpp"
class GVAR(menu) {
idd = 314614;
movingEnable = true;
onLoad = QUOTE([_this select 0] call FUNC(onMenuOpen));
onUnload = QUOTE(uiNamespace setvariable [ARR_2(QUOTE(QGVAR(menuDisplay)),nil)];);
class controlsBackground {
class HeaderBackground: ACE_gui_backgroundBase{
idc = -1;
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
x = "13 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "13 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
text = "#(argb,8,8,3)color(0,0,0,0)";
};
class CenterBackground: HeaderBackground {
y = "2.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
h = "14 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
text = "#(argb,8,8,3)color(0,0,0,0.8)";
colorText[] = {0, 0, 0, "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"};
colorBackground[] = {0,0,0,"(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"};
};
};
class controls {
class HeaderName {
idc = 1;
type = CT_STATIC;
x = "13 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "13 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
style = ST_LEFT + ST_SHADOW;
font = "PuristaMedium";
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorText[] = {0.95, 0.95, 0.95, 0.75};
colorBackground[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.9])"};
text = CSTRING(cargoMenu);
};
class SubHeader: HeaderName {
idc = 2;
x = "13 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "2.5 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "13 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
style = ST_CENTER;
colorText[] = {1, 1, 1.0, 0.9};
colorBackground[] = {0,0,0,0};
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
text = "";
};
class cargoList: ACE_gui_listBoxBase {
idc = 100;
x = "13.1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "4 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "12.8 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "10 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)";
rowHeight = 0.03;
colorBackground[] = {0, 0, 0, 0.2};
colorText[] = {1, 1, 1, 1.0};
colorScrollbar[] = {0.95, 0.95, 0.95, 1};
colorSelect[] = {1, 1, 1, 1.0};
colorSelect2[] = {1, 1, 1, 1.0};
colorSelectBackground[] = {0.3, 0.3, 0.3, 1.0};
colorSelectBackground2[] = {0.3, 0.3, 0.3, 1.0};
};
class btnUnload: ACE_gui_buttonBase {
text = "Cancel";
idc = 11;
x = "13.1 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y = "14.1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - (((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w = "5 * (((safezoneW / safezoneH) min 1.2) / 40)";
h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)";
animTextureNormal = "#(argb,8,8,3)color(0,0,0,0.9)";
animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0.8)";
animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)";
color[] = {1, 1, 1, 1};
color2[] = {0,0,0, 1};
colorBackgroundFocused[] = {1,1,1,1};
colorBackground[] = {1,1,1,1};
colorbackground2[] = {1,1,1,1};
colorDisabled[] = {1,1,1,1};
colorFocused[] = {0,0,0,1};
periodFocus = 1;
periodOver = 1;
action = QUOTE(closeDialog 0);
};
class btnCancel: btnUnload {
text = CSTRING(unloadObject);
idc = 12;
x = "20.9 * (((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
action = QUOTE([] call FUNC(startUnload););
};
};
};

View File

@ -9,4 +9,6 @@
#define DEBUG_SETTINGS DEBUG_ENABLED_CARGO
#endif
#include "\z\ace\addons\main\script_macros.hpp"
#include "\z\ace\addons\main\script_macros.hpp"
#define MAX_LOAD_DISTANCE 10

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project name="ACE">
<Package name="Cargo">
<Key ID="STR_ACE_Cargo_loadObject">
<English>Load object</English>
</Key>
<Key ID="STR_ACE_Cargo_unloadObject">
<English>Unload object</English>
</Key>
<Key ID="STR_ACE_Cargo_openMenu">
<English>Cargo Menu</English>
</Key>
<Key ID="STR_ACE_Cargo_cargoMenu">
<English>Cargo Menu</English>
</Key>
<Key ID="STR_ACE_Cargo_labelSpace">
<English>Cargo space left: %1</English>
</Key>
</Package>
</Project>