Merge pull request #581 from KillahPotatoes/v0.97S11-569
Logistic module pt. 2
This commit is contained in:
commit
d7a1fc8b2f
|
@ -11,6 +11,7 @@
|
|||
"_thisType",
|
||||
"BIS_fnc_reviveInit",
|
||||
"CBA_Settings_fnc_init",
|
||||
"CBA_fnc_compatibleMagazines",
|
||||
"CBA_fnc_notify",
|
||||
"KPLIB_eden_boxspawn",
|
||||
"KPLIB_eden_potatospawn",
|
||||
|
@ -21,6 +22,7 @@
|
|||
"KPLIB_param_aceResupply",
|
||||
"KPLIB_param_ammoInfluence",
|
||||
"KPLIB_param_arsenalType",
|
||||
"KPLIB_param_cratefiller",
|
||||
"KPLIB_param_clearVehicleCargo",
|
||||
"KPLIB_param_commanderZeusMode",
|
||||
"KPLIB_param_copyDistance",
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
File: KPGUI_classes.hpp
|
||||
Author: Wyqer - https://github.com/KillahPotatoes
|
||||
Date: 2018-09-13
|
||||
Last Update: 2019-03-31
|
||||
|
||||
Last Update: 2019-04-05
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
|
@ -582,6 +581,16 @@ class KPGUI_PRE_EditBox {
|
|||
canModify = 1;
|
||||
};
|
||||
|
||||
// Progress bar
|
||||
class KPGUI_PRE_ProgressBar
|
||||
{
|
||||
type = 8;
|
||||
style = 0;
|
||||
colorFrame[] = {1,1,1,1};
|
||||
colorBar[] = KP_COLOR_PLAYERDEFINE;
|
||||
texture = "";
|
||||
};
|
||||
|
||||
// MapControl
|
||||
class KPGUI_PRE_MapControl {
|
||||
deletable = 0;
|
||||
|
@ -1103,6 +1112,38 @@ class KPGUI_PRE_DialogButton_LeftPanel: KPGUI_PRE_Button {
|
|||
w = KP_GETWPLAIN(KP_WIDTH_VAL_LP,1);
|
||||
};
|
||||
|
||||
/*
|
||||
--- Small sized classes ---
|
||||
*/
|
||||
|
||||
// Title bar
|
||||
class KPGUI_PRE_DialogTitleS: KPGUI_PRE_Title {
|
||||
x = KP_GETX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,1);
|
||||
y = safeZoneY + safeZoneH * KP_Y_VAL_S;
|
||||
w = KP_GETWPLAIN(KP_WIDTH_VAL_S,1);
|
||||
};
|
||||
|
||||
// Cross symbol
|
||||
class KPGUI_PRE_DialogCrossS: KPGUI_PRE_CloseCross {
|
||||
x = safeZoneX + safeZoneW * (KP_X_VAL_S + KP_WIDTH_VAL_S - 0.02)
|
||||
y = KP_GETY_CROSS(KP_Y_VAL_S);
|
||||
};
|
||||
|
||||
// Background
|
||||
class KPGUI_PRE_DialogBackgroundS: KPGUI_PRE_Background {
|
||||
x = KP_GETX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,1);
|
||||
y = KP_GETY_AREA(KP_Y_VAL_S);
|
||||
w = KP_GETWPLAIN(KP_WIDTH_VAL_S,1);
|
||||
h = safeZoneH * KP_HEIGHT_VAL_S;
|
||||
};
|
||||
|
||||
// Button
|
||||
class KPGUI_PRE_DialogButtonS: KPGUI_PRE_Button {
|
||||
x = KP_GETX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,1);
|
||||
y = KP_GETY_BELOW(KP_Y_VAL_S,KP_HEIGHT_VAL_S);
|
||||
w = KP_GETWPLAIN(KP_WIDTH_VAL_S,1);
|
||||
};
|
||||
|
||||
/*
|
||||
--- Other classes ---
|
||||
*/
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
File: KPGUI_defines.hpp
|
||||
Author: Wyqer - https://github.com/KillahPotatoes
|
||||
Date: 2018-07-10
|
||||
Last Update: 2018-12-14
|
||||
Last Update: 2019-04-05
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
|
@ -141,3 +141,14 @@
|
|||
|
||||
#define KP_WIDTH_VAL_LP 0.2
|
||||
#define KP_HEIGHT_VAL_LP (1 - 2 * KP_Y_VAL_LP - KP_HEIGTH_TITLE - KP_HEIGTH_BUTTON - 2 * KP_SPACING_Y)
|
||||
|
||||
/*
|
||||
--- Small dialog components ---
|
||||
(X from 0.3 - 0.7, Y from 0.05 - 0.8)
|
||||
*/
|
||||
|
||||
#define KP_X_VAL_S 0.3
|
||||
#define KP_Y_VAL_S 0.05
|
||||
|
||||
#define KP_WIDTH_VAL_S 0.4
|
||||
#define KP_HEIGHT_VAL_S (0.75 - KP_HEIGTH_TITLE - KP_HEIGTH_BUTTON - 2 * KP_SPACING_Y)
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -4,8 +4,7 @@
|
|||
File: KPLIB_functions.hpp
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2017-10-16
|
||||
Last Update: 2019-03-30
|
||||
|
||||
Last Update: 2019-04-05
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
|
@ -29,4 +28,5 @@ class KPLIB {
|
|||
#include "modules\16_garrison\functions.hpp"
|
||||
#include "modules\23_logistic\functions.hpp"
|
||||
#include "modules\24_enemy\functions.hpp"
|
||||
#include "modules\26_cratefiller\functions.hpp"
|
||||
};
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
File: KPLIB_ui.hpp
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2017-10-16
|
||||
Last Update: 2019-03-30
|
||||
Last Update: 2019-04-05
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
|
@ -24,3 +24,4 @@
|
|||
#include "modules\15_build\ui.hpp"
|
||||
#include "modules\16_garrison\ui.hpp"
|
||||
#include "modules\23_logistic\ui.hpp"
|
||||
#include "modules\26_cratefiller\ui.hpp"
|
||||
|
|
|
@ -8,6 +8,15 @@ Furthermore it provides functions which are often used and are not specifically
|
|||
This module uses no data or functions from other modules.
|
||||
|
||||
### Functions
|
||||
|
||||
* KPLIB_fnc_common_addAction
|
||||
|
||||
*Adds given action local to given object.*
|
||||
|
||||
* KPLIB_fnc_common_cameraCircleTarget
|
||||
|
||||
*Let a camera circle around a given target with given params.*
|
||||
|
||||
* KPLIB_fnc_common_clearVehicleCargo
|
||||
|
||||
*Clears vehicle cargo.*
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
KPLIB_fnc_common_cameraCircleTarget
|
||||
|
||||
File: fn_common_cameraCircleTarget.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-03-18
|
||||
Last Update: 2019-03-31
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: Yes
|
||||
|
||||
Description:
|
||||
Let a camera circle around a given target with given params.
|
||||
|
||||
Parameter(s):
|
||||
_camera - Camera object [OBJECT, defaults to objNull]
|
||||
_target - Target object [OBJECT, defaults to objNull]
|
||||
_steps - Steps to do [NUMBER, defaults to 0]
|
||||
_duration - Duration of a full circle [NUMBER, defaults to 0]
|
||||
_step - Step count [NUMBER, defaults to 0]
|
||||
_commitTime - Commit time [NUMBER, defaults to 0]
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
params [
|
||||
["_camera", objNull, [objNull]],
|
||||
["_target", objNull, [objNull]],
|
||||
["_steps", 36, [0]],
|
||||
["_duration", 30, [0]],
|
||||
["_step", 0, [0]],
|
||||
["_commitTime", 0, [0]]
|
||||
];
|
||||
|
||||
if (isNull _camera || {!camCommitted _camera}) exitWith {};
|
||||
|
||||
if (_step isEqualTo 0) then {
|
||||
_commitTime = _duration / _steps;
|
||||
};
|
||||
|
||||
_camera camSetPos ((_target getRelPos [15, _step * 10]) vectorAdd [0, 0, 5]);
|
||||
_camera camCommit _commitTime;
|
||||
|
||||
_step = _step + 1;
|
||||
[
|
||||
{camCommitted (_this select 0)},
|
||||
{[_this select 0, _this select 1, _this select 2, _this select 3, _this select 4, _this select 5] call KPLIB_fnc_common_cameraCircleTarget},
|
||||
[_camera, _target, _steps, _duration, _step, _commitTime]
|
||||
] call CBA_fnc_waitUntilAndExecute;
|
||||
|
||||
true
|
|
@ -17,6 +17,9 @@ class common {
|
|||
// Adds action to object with correct localized title
|
||||
class common_addAction {};
|
||||
|
||||
// Let a camera circle around a given target with given params
|
||||
class common_cameraCircleTarget {};
|
||||
|
||||
// Clears vehicle cargo
|
||||
class common_clearVehicleCargo {};
|
||||
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
KPLIB_fnc_res_refund
|
||||
|
||||
File: fn_res_refund.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-03-31
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Refunds given amount of resources to the provided location.
|
||||
|
||||
Parameter(s):
|
||||
_location - Sector or FOB marker where the resources should be refunded [STRING, defaults to ""]
|
||||
_supplies - Amount of supplies to refund [NUMBER, defaults to 0]
|
||||
_ammo - Amount of ammo to refund [NUMBER, defaults to 0]
|
||||
_fuel - Amount of fuel to refund [NUMBER, defaults to 0]
|
||||
|
||||
Returns:
|
||||
Refund successful [BOOL]
|
||||
*/
|
||||
|
||||
params [
|
||||
["_location", "", [""]],
|
||||
["_supplies", 0, [0]],
|
||||
["_ammo", 0, [0]],
|
||||
["_fuel", 0, [0]]
|
||||
];
|
||||
|
||||
// Exit if no location is given
|
||||
if (_location isEqualTo "") exitWith {false};
|
||||
|
||||
// Get all storage areas in the vicinity of the marker
|
||||
private _storages = nearestObjects [markerPos _location, KPLIB_res_storageClasses, KPLIB_param_fobRange];
|
||||
|
||||
// Check if the location even has the needed space
|
||||
private _supplyCrates = ceil (_supplies / KPLIB_param_crateVolume);
|
||||
private _ammoCrates = ceil (_ammo / KPLIB_param_crateVolume);
|
||||
private _fuelCrates = ceil (_fuel / KPLIB_param_crateVolume);
|
||||
private _crateCount = _supplyCrates + _ammoCrates + _fuelCrates;
|
||||
private _crateCapacity = 0;
|
||||
{
|
||||
_crateCapacity = _crateCapacity + ([_x] call KPLIB_fnc_res_getStorageSpace);
|
||||
} forEach _storages;
|
||||
|
||||
if (_crateCapacity < _crateCount) exitWith {
|
||||
false
|
||||
};
|
||||
|
||||
// Add resources based on given amount
|
||||
private _storage = objNull;
|
||||
private _crate = objNull;
|
||||
|
||||
while {_supplies > 0 || _ammo > 0 || _fuel > 0} do {
|
||||
_storage = _storages select (_storages findIf {([_x] call KPLIB_fnc_res_getStorageSpace) > 0});
|
||||
switch (true) do {
|
||||
case (_supplies > 0): {
|
||||
_crate = ["Supply", getPosATL _storage, (_supplies min KPLIB_param_crateVolume)] call KPLIB_fnc_res_createCrate;
|
||||
_supplies = _supplies - KPLIB_param_crateVolume;
|
||||
};
|
||||
case (_ammo > 0): {
|
||||
_crate = ["Ammo", getPosATL _storage, (_ammo min KPLIB_param_crateVolume)] call KPLIB_fnc_res_createCrate;
|
||||
_ammo = _ammo - KPLIB_param_crateVolume;
|
||||
};
|
||||
case (_fuel > 0): {
|
||||
_crate = ["Fuel", getPosATL _storage, (_fuel min KPLIB_param_crateVolume)] call KPLIB_fnc_res_createCrate;
|
||||
|
||||
_fuel = _fuel - KPLIB_param_crateVolume;
|
||||
};
|
||||
};
|
||||
[_crate] call KPLIB_fnc_res_storeCrate;
|
||||
};
|
||||
|
||||
// Reorder the crates on all storages to close the possible gaps
|
||||
{
|
||||
[_x] call KPLIB_fnc_res_stackNsort;
|
||||
} forEach _storages;
|
||||
|
||||
true
|
|
@ -4,7 +4,7 @@
|
|||
File: functions.hpp
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2018-12-13
|
||||
Last Update: 2019-02-16
|
||||
Last Update: 2019-03-31
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
|
@ -69,6 +69,9 @@ class res {
|
|||
// Push crate
|
||||
class res_pushCrate {};
|
||||
|
||||
// Refunds given amount of resources to the provided location
|
||||
class res_refund {};
|
||||
|
||||
// Saves module specific data for the save
|
||||
class res_saveData {};
|
||||
|
||||
|
|
|
@ -64,21 +64,27 @@ EMitted when a new permission handler is registered
|
|||
*Module pre initialization.*
|
||||
|
||||
* KPLIB_fnc_permission_registerPlayer
|
||||
|
||||
*Checks if the player is already registered to the permission system.*
|
||||
|
||||
* KPLIB_fnc_permission_resetToDefault
|
||||
|
||||
*Resets all permissions to default.*
|
||||
|
||||
* KPLIB_fnc_permission_saveData
|
||||
|
||||
*Fetches data which is bound to this module and send it to the global save data array.*
|
||||
|
||||
* KPLIB_fnc_permission_setupPermissionControls
|
||||
|
||||
*Reads the player permissions and applies them to the dialog controls.*
|
||||
|
||||
* KPLIB_fnc_permission_setupplayerActions
|
||||
|
||||
*Initialization of actions availible to players.*
|
||||
|
||||
* KPLIB_fnc_permission_syncClients
|
||||
|
||||
*Receive client variables and send them to all clients.*
|
||||
|
||||
### Scripts
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
File: fn_permission_postInit.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2018-12-07
|
||||
Last Update: 2019-03-16
|
||||
Last Update: 2019-04-06
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
|
@ -74,6 +74,16 @@ if (isServer) then {
|
|||
"STR_KPLIB_PERMISSION_GROUPLOGISTICS"
|
||||
] call KPLIB_fnc_permission_addPermissionHandler;
|
||||
|
||||
// Cratefiller
|
||||
[
|
||||
"Cratefiller",
|
||||
{},
|
||||
"STR_KPLIB_PERMISSION_CRATEFILLER",
|
||||
false,
|
||||
"LogisticStation",
|
||||
"STR_KPLIB_PERMISSION_GROUPLOGISTICS"
|
||||
] call KPLIB_fnc_permission_addPermissionHandler;
|
||||
|
||||
// Vehicle permissions
|
||||
// Add Light Vehicle Permission
|
||||
[
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
File: fn_init_fillArsenal.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2017-10-27
|
||||
Last Update: 2019-01-07
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
|
@ -41,7 +41,7 @@ private _configClasses = [];
|
|||
_configClasses append (
|
||||
"
|
||||
_type = (configName _x) call BIS_fnc_itemType;
|
||||
(getNumber (_x >> 'scope') == 2) &&
|
||||
(getNumber (_x >> 'scope') isEqualTo 2) &&
|
||||
((_type select 0) != '') &&
|
||||
((_type select 0) != 'VehicleWeapon')
|
||||
" configClasses _x
|
||||
|
@ -101,11 +101,11 @@ if !(_goodItems isEqualTo true) then {
|
|||
{
|
||||
_type = _x call BIS_fnc_itemType;
|
||||
switch (_type select 0) do {
|
||||
case "Weapon": {if ((_x call BIS_fnc_baseWeapon) == _x) then {_weapons pushBack _x;};};
|
||||
case "Weapon": {if ((_x call BIS_fnc_baseWeapon) isEqualTo _x) then {_weapons pushBack _x;};};
|
||||
case "Mine";
|
||||
case "Magazine": {_magazines pushBack _x};
|
||||
case "Item";
|
||||
case "Equipment": {if ((_type select 1) == "Backpack") then {_backpacks pushBack _x} else {_items pushBack _x};};
|
||||
case "Equipment": {if ((_type select 1) isEqualTo "Backpack") then {_backpacks pushBack _x} else {_items pushBack _x};};
|
||||
};
|
||||
} forEach _goodItems;
|
||||
|
||||
|
@ -135,4 +135,7 @@ publicVariable "KPLIB_preset_arsenal_whitelist";
|
|||
// Send updated blacklist to clients
|
||||
publicVariable "KPLIB_preset_arsenal_blacklist";
|
||||
|
||||
// Emit arsenal filled event
|
||||
["KPLIB_arsenal_newLists", []] call CBA_fnc_serverEvent;
|
||||
|
||||
true
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
File: fn_logistic_addActions.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-01-16
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-03
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
Adds all actions to the spawned logistic building.
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
File: fn_logistic_addMenu.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-01-17
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-03
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
Adds a new menu to the logistic main menu.
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
File: fn_logistic_calcCosts.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-02-23
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-03
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
Calculates the costs of the resupply action.
|
||||
|
@ -28,7 +29,12 @@ private _resupplyButton = _dialog displayCtrl 68747;
|
|||
|
||||
// Read the controls
|
||||
private _costs = parseNumber (ctrlText _ctrlCosts);
|
||||
private _count = sliderPosition _ctrlSlider;
|
||||
private _count = round (sliderPosition _ctrlSlider);
|
||||
|
||||
// Prepare resource check
|
||||
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
|
||||
private _res = [_nearFOB] call KPLIB_fnc_res_getResTotal;
|
||||
private _check = false;
|
||||
|
||||
// Fill the controls
|
||||
_index = lbCurSel _ctrlCargo;
|
||||
|
@ -37,29 +43,47 @@ if !(KPLIB_param_aceResupply) then {
|
|||
case "AMMO": {
|
||||
_ctrlTotalCosts ctrlSetText str (_costs * _count);
|
||||
_ctrlSliderValue ctrlSetText str _count;
|
||||
_check = ((_res select 1) >= (_costs * _count));
|
||||
};
|
||||
case "FUEL": {
|
||||
_ctrlTotalCosts ctrlSetText str (_costs * _count);
|
||||
_ctrlSliderValue ctrlSetText str _count;
|
||||
_check = ((_res select 2) >= (_costs * _count));
|
||||
};
|
||||
};
|
||||
} else {
|
||||
switch (_ctrlCargo lbData _index) do {
|
||||
case "AMMO": {
|
||||
_count = (ceil (_count / 100)) * 100;
|
||||
_ctrlTotalCosts ctrlSetText str (_costs * (_count / 100));
|
||||
_ctrlSliderValue ctrlSetText str _count;
|
||||
_check = ((_res select 1) >= (_costs * (_count / 100)));
|
||||
};
|
||||
case "FUEL": {
|
||||
_count = (ceil (_count / 1000)) * 1000;
|
||||
_ctrlTotalCosts ctrlSetText str (_costs * (_count / 1000));
|
||||
_ctrlSliderValue ctrlSetText str _count;
|
||||
_check = ((_res select 2) >= (_costs * (_count / 1000)));
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//Check if the resupply selection is 0
|
||||
if !(_count isEqualTo 0) then {
|
||||
_resupplyButton ctrlEnable true;
|
||||
} else {
|
||||
_resupplyButton ctrlEnable false;
|
||||
};
|
||||
|
||||
// Final check if enough resources available
|
||||
if !(_check) then {
|
||||
_resupplyButton ctrlEnable false;
|
||||
[
|
||||
["a3\3den\data\controlsgroups\tutorial\close_ca.paa", 1, [1,0,0]],
|
||||
[localize "STR_KPLIB_HINT_NOTENOUGHRESOURCES"]
|
||||
] call CBA_fnc_notify;
|
||||
} else {
|
||||
_resupplyButton ctrlEnable true;
|
||||
};
|
||||
|
||||
true
|
||||
|
|
|
@ -5,8 +5,9 @@
|
|||
File: fn_logistic_openDialog.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-01-16
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-03
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
Opens the logistic main dialog.
|
||||
|
@ -39,7 +40,7 @@ if !(_menus isEqualTo []) then {
|
|||
_tempCtrl = _dialog ctrlCreate ["KPGUI_PRE_DialogButtonC", 68741 + _forEachIndex];
|
||||
_tempCtrl ctrlSetPosition [
|
||||
KP_GETX(KP_X_VAL_C,KP_WIDTH_VAL_C,0,1),
|
||||
safeZoneY + safeZoneH * (KP_Y_VAL_C + (_forEachIndex + 1) * KP_HEIGTH_TITLE + (_forEachIndex + 2) * KP_SPACING_Y),
|
||||
safeZoneY + safeZoneH * (KP_Y_VAL_C + KP_HEIGTH_TITLE + _forEachIndex * KP_HEIGTH_BUTTON + (_forEachIndex + 1) * KP_SPACING_Y),
|
||||
KP_GETWPLAIN(KP_WIDTH_VAL_C,1),
|
||||
safeZoneH * KP_HEIGTH_BUTTON
|
||||
];
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
File: fn_logistic_openRecycleDialog.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-01-25
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-03
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
Opens the logistic recycle dialog.
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
File: fn_logistic_openResupplyDialog.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-02-21
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-03
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
Opens the logistic resupply dialog.
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
File: fn_logistic_postInit.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-01-16
|
||||
Last Update: 2019-03-17
|
||||
Last Update: 2019-04-06
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
The postInit function of a module takes care of starting/executing the modules functions or scripts.
|
||||
|
@ -53,6 +54,22 @@ if (isServer) then {
|
|||
"STR_KPLIB_LOGISTIC_RESUPPLY"
|
||||
] call KPLIB_fnc_logistic_addMenu;
|
||||
|
||||
[
|
||||
"Cratefiller",
|
||||
{
|
||||
if ([player, "Cratefiller"] call KPLIB_fnc_permission_getPermission && KPLIB_param_cratefiller) then {
|
||||
closeDialog 0;
|
||||
[] call KPLIB_fnc_cratefiller_openDialog;
|
||||
} else {
|
||||
[
|
||||
["a3\3den\data\controlsgroups\tutorial\close_ca.paa", 1, [1,0,0]],
|
||||
[localize "STR_KPLIB_HINT_NOPERMISSION"]
|
||||
] call CBA_fnc_notify;
|
||||
};
|
||||
},
|
||||
"STR_KPLIB_LOGISTIC_CRATEFILLER"
|
||||
] call KPLIB_fnc_logistic_addMenu;
|
||||
|
||||
private _vehicles = [];
|
||||
{
|
||||
_vehicles append (missionNamespace getVariable [format ["KPLIB_preset_%1F", _x], ""]);
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
File: fn_logistic_preInit.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-01-16
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-06
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
The preInit function defines global variables, adds event handlers and set some vital settings which are used in this module.
|
||||
|
@ -20,6 +21,10 @@
|
|||
if (isServer) then {
|
||||
diag_log format ["[KP LIBERATION] [%1] [PRE] [LOGISTIC] Module initializing...", diag_tickTime];
|
||||
|
||||
/*
|
||||
----- Module Initialization -----
|
||||
*/
|
||||
|
||||
// Adding actions to spawned logi buildings
|
||||
["KPLIB_vehicle_spawned", {[_this select 0] call KPLIB_fnc_logistic_addActions;}] call CBA_fnc_addEventHandler;
|
||||
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
File: fn_logistic_recycleTarget.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-01-31
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-04
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
Recycles the selected vehicle.
|
||||
|
@ -20,25 +21,86 @@
|
|||
// Dialog controls
|
||||
private _dialog = findDisplay 7580232;
|
||||
private _ctrlVehicleList = _dialog displayCtrl 68740;
|
||||
private _ctrlSupply = _dialog displayCtrl 68741;
|
||||
private _ctrlAmmo = _dialog displayCtrl 68742;
|
||||
private _ctrlFuel = _dialog displayCtrl 68743;
|
||||
private _recycleButton = _dialog displayCtrl 68745;
|
||||
private _ctrlSupplyValue = _dialog displayCtrl 68742;
|
||||
private _ctrlAmmoValue = _dialog displayCtrl 68744;
|
||||
private _ctrlFuelValue = _dialog displayCtrl 68746;
|
||||
private _recycleButton = _dialog displayCtrl 68747;
|
||||
|
||||
// Read controls
|
||||
private _index = lbCurSel _ctrlVehicleList;
|
||||
private _vehicleId = _ctrlVehicleList lbData _index;
|
||||
private _supplyValue = parseNumber (ctrlText _ctrlSupplyValue);
|
||||
private _ammoValue = parseNumber (ctrlText _ctrlAmmoValue);
|
||||
private _fuelValue = parseNumber (ctrlText _ctrlFuelValue);
|
||||
|
||||
// Get the target vehicle
|
||||
private _vehicle = objectFromNetId _vehicleId;
|
||||
private _type = typeOf _vehicle;
|
||||
private _vehicles = KPLIB_logistic_data getVariable ["Vehicles", []];
|
||||
private _vehicleIndex = _vehicles findIf {_x select 0 isEqualTo _type};
|
||||
private _damage = 1;
|
||||
private _ammo = 1;
|
||||
private _fuel = 1;
|
||||
|
||||
// Check for the influence params
|
||||
if (KPLIB_param_damageInfluence) then {
|
||||
_damage = (1 - damage _vehicle);
|
||||
};
|
||||
|
||||
if (KPLIB_param_ammoInfluence) then {
|
||||
private _ammoState = {_x select 2 != 0} count magazinesAllTurrets _vehicle;
|
||||
if (_ammoState > 0) then {
|
||||
private _ammoMax = count magazinesAllTurrets _vehicle;
|
||||
_ammo = _ammoState / _ammoMax;
|
||||
} else {
|
||||
_ammo = 0;
|
||||
};
|
||||
};
|
||||
|
||||
if (KPLIB_param_fuelInfluence) then {
|
||||
_fuel = fuel _vehicle;
|
||||
};
|
||||
|
||||
// Check if the Vehicle state has changed and exit
|
||||
private _supplyValueCheck = 0;
|
||||
private _ammoValueCheck = 0;
|
||||
private _fuelValueCheck = 0;
|
||||
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
|
||||
|
||||
if !(_vehicleIndex isEqualTo -1) then {
|
||||
private _vehicleArray = _vehicles select _vehicleIndex;
|
||||
_supplyValueCheck = (round ((_vehicleArray select 1) * (KPLIB_param_recycleFactor / 100) * _damage));
|
||||
_ammoValueCheck = (round ((_vehicleArray select 2) * (KPLIB_param_recycleFactor / 100) * _ammo));
|
||||
_fuelValueCheck = (round ((_vehicleArray select 3) * (KPLIB_param_recycleFactor / 100) * _fuel));
|
||||
} else {
|
||||
_supplyValueCheck = (KPLIB_param_refundSupply * _damage);
|
||||
_ammoValueCheck = (KPLIB_param_refundAmmo * _ammo);
|
||||
_fuelValueCheck = (KPLIB_param_refundFuel * _fuel);
|
||||
};
|
||||
|
||||
if (
|
||||
!(_supplyValue isEqualTo _supplyValueCheck) ||
|
||||
!(_ammoValue isEqualTo _ammoValueCheck) ||
|
||||
!(_fuelValue isEqualTo _fuelValueCheck) ||
|
||||
(((getMarkerPos _nearFOB) distance2D _vehicle) > KPLIB_param_fobRange)
|
||||
) exitWith {
|
||||
_recycleButton ctrlEnable false;
|
||||
[
|
||||
["a3\3den\data\controlsgroups\tutorial\close_ca.paa", 1, [1,0,0]],
|
||||
[localize "STR_KPLIB_HINT_VEHICLECHANGES"]
|
||||
] call CBA_fnc_notify;
|
||||
};
|
||||
|
||||
// Pay the refund
|
||||
private _storage = objNull;
|
||||
private _crate = objNull;
|
||||
private _storages = [getMarkerPos _nearFOB, KPLIB_param_fobRange] call KPLIB_fnc_res_getStorages;
|
||||
|
||||
[_nearFOB, _supplyValue, _ammoValue, _fuelValue] remoteExecCall ["KPLIB_fnc_res_refund", 2];
|
||||
|
||||
// Delete the vehicle
|
||||
deleteVehicle _vehicle;
|
||||
|
||||
/* TODO:
|
||||
- Implement Resource refund
|
||||
*/
|
||||
|
||||
[7580232, 68740] call KPLIB_fnc_logistic_refreshTargets;
|
||||
|
||||
true
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
File: fn_logistic_refreshTargets.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-01-25
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-03
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
Refreshes the vehicle list for the given dialog.
|
||||
|
@ -30,7 +31,7 @@ private _ctrlVehicleList = _dialog displayCtrl _ctrlId;
|
|||
lbClear _ctrlVehicleList;
|
||||
|
||||
// Get all FOB vehicles
|
||||
private _nearFOB = [player] call KPLIB_fnc_common_getPlayerFob;
|
||||
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
|
||||
private _vehicles = (getMarkerPos _nearFOB) nearEntities [["LandVehicle", "Air", "Ship"], KPLIB_param_fobRange];
|
||||
|
||||
private _cfg = configFile >> "CfgVehicles";
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
File: fn_logistic_resupplyTarget.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-02-24
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-04
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
Resupplies the given vehicle.
|
||||
|
@ -21,9 +22,11 @@
|
|||
private _dialog = findDisplay 7580233;
|
||||
private _ctrlVehicleList = _dialog displayCtrl 68740;
|
||||
private _ctrlCargo = _dialog displayCtrl 68741;
|
||||
private _ctrlCosts = _dialog displayCtrl 68743;
|
||||
private _ctrlCargoStateValue = _dialog displayCtrl 68742;
|
||||
private _ctrlSliderValue = _dialog displayCtrl 68745;
|
||||
private _ctrlTotalCosts = _dialog displayCtrl 68746;
|
||||
private _resupplyButton = _dialog displayCtrl 68747;
|
||||
|
||||
|
||||
private _cfgVeh = configFile >> "CfgVehicles";
|
||||
private _cfgMag = configFile >> "CfgMagazines";
|
||||
|
@ -31,47 +34,120 @@ private _cfgMag = configFile >> "CfgMagazines";
|
|||
// Read controls
|
||||
private _index = lbCurSel _ctrlVehicleList;
|
||||
private _vehicleId = _ctrlVehicleList lbData _index;
|
||||
private _costs = parseNumber (ctrlText _ctrlTotalCosts);
|
||||
|
||||
// Get the target vehicle
|
||||
private _vehicle = objectFromNetId _vehicleId;
|
||||
private _type = typeOf _vehicle;
|
||||
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
|
||||
|
||||
// Do the resupply
|
||||
_index = lbCurSel _ctrlCargo;
|
||||
// Check if the Vehicle state has changed and exit
|
||||
private _cargo = ctrlText _ctrlCargoStateValue;
|
||||
private _cargoCheck = "";
|
||||
private _ammoMax = 0;
|
||||
private _ammoState = 0;
|
||||
private _fuelMax = 0;
|
||||
private _fuelState = 0;
|
||||
|
||||
if !(KPLIB_param_aceResupply) then {
|
||||
switch (_ctrlCargo lbData _index) do {
|
||||
case "AMMO": {
|
||||
_vehicle setVehicleAmmo 1;
|
||||
_ammoMax = count magazinesAllTurrets _vehicle;
|
||||
_ammoState = {_x select 2 isEqualTo (getNumber (_cfgMag >> (_x select 0) >> "count"))} count magazinesAllTurrets _vehicle;
|
||||
_cargoCheck = format [localize "STR_KPLIB_DIALOG_RESUPPLY_AMMOSTATE", _ammoState, _ammoMax];
|
||||
};
|
||||
case "FUEL": {
|
||||
_fuelMax = getNumber (_cfgVeh >> _type >> "fuelCapacity");
|
||||
_fuelState = _fuelMax * (fuel _vehicle);
|
||||
_cargoCheck = format [localize "STR_KPLIB_DIALOG_RESUPPLY_FUELSTATE", _fuelState toFixed 2, _fuelMax toFixed 2];
|
||||
};
|
||||
};
|
||||
} else {
|
||||
switch (_ctrlCargo lbData _index) do {
|
||||
case "AMMO": {
|
||||
_ammoMax = getNumber (_cfgVeh >> _type >> "ace_rearm_defaultSupply");
|
||||
if (_ammoMax isEqualTo 0) then {
|
||||
_ammoState = 0;
|
||||
} else {
|
||||
_ammoState = _vehicle getVariable ["ace_rearm_currentSupply", 0];
|
||||
};
|
||||
_cargoCheck = format [localize "STR_KPLIB_DIALOG_RESUPPLY_AMMOSTATEACE", _ammoState, _ammoMax];
|
||||
};
|
||||
case "FUEL": {
|
||||
_fuelMax = getNumber (_cfgVeh >> _type >> "ace_refuel_fuelCargo");
|
||||
if (_fuelMax isEqualTo 0) then {
|
||||
_fuelState = 0;
|
||||
} else {
|
||||
_fuelState = _vehicle getVariable ["ace_refuel_currentFuelCargo", 0];
|
||||
};
|
||||
_cargoCheck = format [localize "STR_KPLIB_DIALOG_RESUPPLY_FUELSTATEACE", _fuelState, _fuelMax];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (
|
||||
!(_cargo isEqualTo _cargoCheck) ||
|
||||
(((getMarkerPos _nearFOB) distance2D _vehicle) > KPLIB_param_fobRange)
|
||||
) exitWith {
|
||||
_resupplyButton ctrlEnable false;
|
||||
[
|
||||
["a3\3den\data\controlsgroups\tutorial\close_ca.paa", 1, [1,0,0]],
|
||||
[localize "STR_KPLIB_HINT_VEHICLECHANGES"]
|
||||
] call CBA_fnc_notify;
|
||||
};
|
||||
|
||||
// Do the resupply
|
||||
_index = lbCurSel _ctrlCargo;
|
||||
private _addValue = parseNumber ctrlText _ctrlSliderValue;
|
||||
|
||||
if !(KPLIB_param_aceResupply) then {
|
||||
switch (_ctrlCargo lbData _index) do {
|
||||
case "AMMO": {
|
||||
_ammoMax = count magazinesAllTurrets _vehicle;
|
||||
_ammoState = {_x select 2 isEqualTo (getNumber (_cfgMag >> (_x select 0) >> "count"))} count magazinesAllTurrets _vehicle;
|
||||
private _newAmmoState = ((_ammoState + _addValue) / _ammoMax);
|
||||
if (_newAmmoState > 1) then {
|
||||
_newAmmoState = 1;
|
||||
};
|
||||
_vehicle setVehicleAmmo _newAmmoState;
|
||||
[_nearFOB, 0, _costs, 0] call KPLIB_fnc_res_pay;
|
||||
};
|
||||
case "FUEL": {
|
||||
private _fuelMax = getNumber (_cfgVeh >> _type >> "fuelCapacity");
|
||||
private _fuelState = _fuelMax * (fuel _vehicle);
|
||||
private _addValue = parseNumber ctrlText _ctrlSliderValue;
|
||||
private _newFuelState = ((_fuelState + _addValue) /_fuelMax);
|
||||
private _newFuelState = ((_fuelState + _addValue) / _fuelMax);
|
||||
if (_newFuelState > 1) then {
|
||||
_newFuelState = 1;
|
||||
};
|
||||
_vehicle setFuel _newFuelState;
|
||||
[_nearFOB, 0, 0, _costs] call KPLIB_fnc_res_pay;
|
||||
};
|
||||
};
|
||||
} else {
|
||||
switch (_ctrlCargo lbData _index) do {
|
||||
case "AMMO": {
|
||||
private _ammoMax = getNumber (_cfgVeh >> _type >> "ace_rearm_defaultSupply");
|
||||
private _ammoState = [_vehicle] call ace_rearm_fnc_getSupplyCount;
|
||||
private _addValue = parseNumber ctrlText _ctrlSliderValue;
|
||||
[_vehicle, _ammoState + _addValue] call ace_rearm_fnc_setSupplyCount;
|
||||
private _ammoState = _vehicle getVariable ["ace_rearm_currentSupply", 0];
|
||||
if ((_ammoState + _addValue) > _ammoMax) then {
|
||||
_vehicle setVariable ["ace_rearm_currentSupply", _ammoMax];
|
||||
} else {
|
||||
_vehicle setVariable ["ace_rearm_currentSupply", _ammoState + _addValue];
|
||||
};
|
||||
[_nearFOB, 0, _costs, 0] call KPLIB_fnc_res_pay;
|
||||
};
|
||||
case "FUEL": {
|
||||
private _fuelMax = getNumber (_cfgVeh >> _type >> "ace_refuel_fuelCargo");
|
||||
private _fuelState = [_vehicle] call ace_refuel_fnc_getFuel;
|
||||
private _addValue = parseNumber ctrlText _ctrlSliderValue;
|
||||
[_vehicle, _fuelState + _addValue] call ace_refuel_fnc_setFuel;
|
||||
private _fuelState = _vehicle getVariable ["ace_refuel_currentFuelCargo", 0];
|
||||
if ((_fuelState + _addValue) > _fuelMax) then {
|
||||
_vehicle setVariable ["ace_refuel_currentFuelCargo", _fuelMax];
|
||||
} else {
|
||||
_vehicle setVariable ["ace_refuel_currentFuelCargo", _fuelState + _addValue];
|
||||
};
|
||||
[_nearFOB, 0, 0, _costs] call KPLIB_fnc_res_pay;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
[] spawn KPLIB_fnc_logistic_selectResupplyTarget;
|
||||
[] call KPLIB_fnc_logistic_selectResupplyTarget;
|
||||
|
||||
true
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
File: fn_logistic_selectRecycleTarget.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-01-27
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-03
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
Selects the vehicle from the combo cox and fills the dialog.
|
||||
|
@ -71,11 +72,18 @@ if (KPLIB_param_fuelInfluence) then {
|
|||
};
|
||||
|
||||
// Fill the controls
|
||||
private _supplyValue = 0;
|
||||
private _ammoValue = 0;
|
||||
private _fuelValue = 0;
|
||||
|
||||
if !(_vehicleIndex isEqualTo -1) then {
|
||||
private _vehicleArray = _vehicles select _vehicleIndex;
|
||||
_ctrlSupplyValue ctrlSetText str (round ((_vehicleArray select 1) * (KPLIB_param_recycleFactor / 100) * _damage));
|
||||
_ctrlAmmoValue ctrlSetText str (round ((_vehicleArray select 2) * (KPLIB_param_recycleFactor / 100) * _ammo));
|
||||
_ctrlFuelValue ctrlSetText str (round ((_vehicleArray select 3) * (KPLIB_param_recycleFactor / 100) * _fuel));
|
||||
_supplyValue = (round ((_vehicleArray select 1) * (KPLIB_param_recycleFactor / 100) * _damage));
|
||||
_ctrlSupplyValue ctrlSetText str _supplyValue;
|
||||
_ammoValue = (round ((_vehicleArray select 2) * (KPLIB_param_recycleFactor / 100) * _ammo));
|
||||
_ctrlAmmoValue ctrlSetText str _ammoValue;
|
||||
_fuelValue = (round ((_vehicleArray select 3) * (KPLIB_param_recycleFactor / 100) * _fuel));
|
||||
_ctrlFuelValue ctrlSetText str _fuelValue;
|
||||
} else {
|
||||
_ctrlSupplyValue ctrlSetText str (KPLIB_param_refundSupply * _damage);
|
||||
_ctrlAmmoValue ctrlSetText str (KPLIB_param_refundAmmo * _ammo);
|
||||
|
@ -86,11 +94,28 @@ _ctrlSupplyFactor ctrlSetText str (round (_damage * 100)) + " %";
|
|||
_ctrlAmmoFactor ctrlSetText str (round (_ammo * 100)) + " %";
|
||||
_ctrlFuelFactor ctrlSetText str (round (_fuel * 100)) + " %";
|
||||
|
||||
/* TODO:
|
||||
- Implement check for empty cargo space
|
||||
*/
|
||||
// Check if there's enough empty storage capacity
|
||||
private _supplyCrates = ceil (_supplyValue / KPLIB_param_crateVolume);
|
||||
private _ammoCrates = ceil (_ammoValue / KPLIB_param_crateVolume);
|
||||
private _fuelCrates = ceil (_fuelValue / KPLIB_param_crateVolume);
|
||||
private _crateCount = _supplyCrates + _ammoCrates + _fuelCrates;
|
||||
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
|
||||
private _storages = [getMarkerPos _nearFOB, KPLIB_param_fobRange] call KPLIB_fnc_res_getStorages;
|
||||
private _crateCapacity = 0;
|
||||
|
||||
_recycleButton ctrlEnable true;
|
||||
{
|
||||
_crateCapacity = _crateCapacity + ([_x] call KPLIB_fnc_res_getStorageSpace);
|
||||
} forEach _storages;
|
||||
|
||||
if (_crateCapacity < _crateCount) then {
|
||||
_recycleButton ctrlEnable false;
|
||||
[
|
||||
["a3\3den\data\controlsgroups\tutorial\close_ca.paa", 1, [1,0,0]],
|
||||
[localize "STR_KPLIB_HINT_NOTENOUGHSTORAGE"]
|
||||
] call CBA_fnc_notify;
|
||||
} else {
|
||||
_recycleButton ctrlEnable true;
|
||||
};
|
||||
|
||||
// Spawn camera object
|
||||
camUseNVG false;
|
||||
|
@ -100,16 +125,9 @@ _cam cameraEffect ["internal", "front", "rtt"];
|
|||
KPLIB_logistic_activeCam = _cam;
|
||||
_cam camSetTarget _vehicle;
|
||||
_cam camSetFov 0.5;
|
||||
_cam camCommit 0;
|
||||
_cam camSetPos ((_vehicle getRelPos [15, 0]) vectorAdd [0, 0, 5]);
|
||||
_cam camSetPos ((_vehicle getRelPos [15, 0]) vectorAdd [0, 0, 90]);
|
||||
_cam camCommit 0;
|
||||
|
||||
while {(lbCurSel _ctrlVehicleList) isEqualTo _index || !dialog} do {
|
||||
for "_i" from 1 to 36 do {
|
||||
_cam camSetPos ((_vehicle getRelPos [15, _i * 10]) vectorAdd [0, 0, 5]);
|
||||
_cam camCommit 30/36;
|
||||
waitUntil {camCommitted _cam};
|
||||
};
|
||||
};
|
||||
[_cam, _vehicle, 36, 60] call KPLIB_fnc_common_cameraCircleTarget;
|
||||
|
||||
true
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
File: fn_logistic_selectResupplyTarget.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-02-23
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-03
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
Selects the vehicle from the combo cox and fills the dialog.
|
||||
|
@ -58,23 +59,36 @@ private _ammoState = 0;
|
|||
private _fuelMax = 0;
|
||||
private _fuelState = 0;
|
||||
|
||||
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
|
||||
private _res = [_nearFOB] call KPLIB_fnc_res_getResTotal;
|
||||
|
||||
if !(KPLIB_param_aceResupply) then {
|
||||
switch (_ctrlCargo lbData _index) do {
|
||||
case "AMMO": {
|
||||
_ctrlSlider ctrlEnable true;
|
||||
_ammoMax = count magazinesAllTurrets _vehicle;
|
||||
_ammoState = {_x select 2 isEqualTo (getNumber (_cfgMag >> (_x select 0) >> "count"))} count magazinesAllTurrets _vehicle;
|
||||
_ctrlCargoStateValue ctrlSetText format [localize "STR_KPLIB_DIALOG_RESUPPLY_AMMOSTATE", _ammoMax - _ammoState, _ammoMax];
|
||||
_ctrlCargoStateValue ctrlSetText format [localize "STR_KPLIB_DIALOG_RESUPPLY_AMMOSTATE", _ammoState, _ammoMax];
|
||||
_ctrlCosts ctrlSetText format [localize "STR_KPLIB_DIALOG_RESUPPLY_COSTSAMMO", str KPLIB_param_resupplyMagCost];
|
||||
_ctrlTotalCosts ctrlSetText str ((_ammoMax - _ammoState) * KPLIB_param_resupplyMagCost);
|
||||
_resupplyButton ctrlEnable true;
|
||||
if ((ceil (_ammoMax - _ammoState)) > (floor ((_res select 1) / KPLIB_param_resupplyMagCost))) then {
|
||||
_ctrlSlider sliderSetRange [0, floor ((_res select 1) / KPLIB_param_resupplyMagCost)];
|
||||
} else {
|
||||
_ctrlSlider sliderSetRange [0, ceil (_ammoMax - _ammoState)];
|
||||
};
|
||||
_ctrlSlider sliderSetPosition 0;
|
||||
_ctrlSlider sliderSetSpeed [1, 1];
|
||||
};
|
||||
case "FUEL": {
|
||||
_ctrlSlider ctrlEnable true;
|
||||
_fuelMax = getNumber (_cfgVeh >> _type >> "fuelCapacity");
|
||||
_fuelState = _fuelMax * (fuel _vehicle);
|
||||
_ctrlCargoStateValue ctrlSetText format [localize "STR_KPLIB_DIALOG_RESUPPLY_FUELSTATE", _fuelState toFixed 2, _fuelMax];
|
||||
_ctrlCargoStateValue ctrlSetText format [localize "STR_KPLIB_DIALOG_RESUPPLY_FUELSTATE", _fuelState toFixed 2, _fuelMax toFixed 2];
|
||||
_ctrlCosts ctrlSetText format [localize "STR_KPLIB_DIALOG_RESUPPLY_COSTSFUEL", str KPLIB_param_resupplyGallCost];
|
||||
_ctrlSlider sliderSetRange [0, ceil (_fuelMax - _fuelState)];
|
||||
if ((ceil (_fuelMax - _fuelState)) > (floor ((_res select 2) / KPLIB_param_resupplyGallCost))) then {
|
||||
_ctrlSlider sliderSetRange [0, floor ((_res select 2) / KPLIB_param_resupplyGallCost)];
|
||||
} else {
|
||||
_ctrlSlider sliderSetRange [0, ceil (_fuelMax - _fuelState)];
|
||||
};
|
||||
_ctrlSlider sliderSetPosition 0;
|
||||
_ctrlSlider sliderSetSpeed [1, 1];
|
||||
};
|
||||
|
@ -87,13 +101,17 @@ if !(KPLIB_param_aceResupply) then {
|
|||
if (_ammoMax isEqualTo 0) then {
|
||||
_ammoState = 0;
|
||||
} else {
|
||||
_ammoState = [_vehicle] call ace_rearm_fnc_getSupplyCount;
|
||||
_ammoState = _vehicle getVariable ["ace_rearm_currentSupply", 0];
|
||||
};
|
||||
_ctrlCargoStateValue ctrlSetText format [localize "STR_KPLIB_DIALOG_RESUPPLY_AMMOSTATEACE", _ammoState, _ammoMax];
|
||||
_ctrlCosts ctrlSetText format [localize "STR_KPLIB_DIALOG_RESUPPLY_COSTSAMMOACE", str KPLIB_param_resupplyAmmoCost];
|
||||
_ctrlSlider sliderSetRange [0, ceil (_ammoMax - _ammoState)];
|
||||
if (((ceil (_ammoMax - _ammoState)) / 100) > (floor ((_res select 1) / KPLIB_param_resupplyAmmoCost))) then {
|
||||
_ctrlSlider sliderSetRange [0, (floor ((_res select 1) / KPLIB_param_resupplyAmmoCost)) * 100];
|
||||
} else {
|
||||
_ctrlSlider sliderSetRange [0, ceil (_ammoMax - _ammoState)];
|
||||
};
|
||||
_ctrlSlider sliderSetPosition 0;
|
||||
_ctrlSlider sliderSetSpeed [100, 100];
|
||||
_ctrlSlider sliderSetSpeed [10, 10];
|
||||
};
|
||||
case "FUEL": {
|
||||
_ctrlSlider ctrlEnable true;
|
||||
|
@ -101,39 +119,45 @@ if !(KPLIB_param_aceResupply) then {
|
|||
if (_fuelMax isEqualTo 0) then {
|
||||
_fuelState = 0;
|
||||
} else {
|
||||
_fuelState = [_vehicle] call ace_refuel_fnc_getFuel;
|
||||
_fuelState = _vehicle getVariable ["ace_refuel_currentFuelCargo", 0];
|
||||
};
|
||||
_ctrlCargoStateValue ctrlSetText format [localize "STR_KPLIB_DIALOG_RESUPPLY_FUELSTATEACE", _fuelState, _fuelMax];
|
||||
_ctrlCosts ctrlSetText format [localize "STR_KPLIB_DIALOG_RESUPPLY_COSTSFUELACE", str KPLIB_param_resupplyFuelCost];
|
||||
_ctrlSlider sliderSetRange [0, ceil (_fuelMax - _fuelState)];
|
||||
if (((ceil (_fuelMax - _fuelState)) / 1000) > (floor ((_res select 2) / KPLIB_param_resupplyFuelCost))) then {
|
||||
_ctrlSlider sliderSetRange [0, (floor ((_res select 2) / KPLIB_param_resupplyFuelCost)) * 1000];
|
||||
} else {
|
||||
_ctrlSlider sliderSetRange [0, ceil (_fuelMax - _fuelState)];
|
||||
};
|
||||
_ctrlSlider sliderSetPosition 0;
|
||||
_ctrlSlider sliderSetSpeed [1000, 1000];
|
||||
_ctrlSlider sliderSetSpeed [100, 100];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
/* TODO:
|
||||
- Implement check for resources
|
||||
*/
|
||||
|
||||
// Spawn camera object
|
||||
camUseNVG false;
|
||||
showCinemaBorder false;
|
||||
private _cam = "camera" camCreate (getpos _vehicle);
|
||||
_cam cameraEffect ["internal", "front", "rtt"];
|
||||
KPLIB_logistic_activeCam = _cam;
|
||||
_cam camSetTarget _vehicle;
|
||||
_cam camSetFov 0.5;
|
||||
_cam camCommit 0;
|
||||
_cam camSetPos ((_vehicle getRelPos [15, 0]) vectorAdd [0, 0, 5]);
|
||||
_cam camCommit 0;
|
||||
|
||||
private _index = lbCurSel _ctrlVehicleList;
|
||||
while {(lbCurSel _ctrlVehicleList) isEqualTo _index || !dialog} do {
|
||||
for "_i" from 1 to 36 do {
|
||||
_cam camSetPos ((_vehicle getRelPos [15, _i * 10]) vectorAdd [0, 0, 5]);
|
||||
_cam camCommit 30/36;
|
||||
waitUntil {camCommitted _cam};
|
||||
if (isNull KPLIB_logistic_activeCam) then {
|
||||
camUseNVG false;
|
||||
showCinemaBorder false;
|
||||
private _cam = "camera" camCreate (getpos _vehicle);
|
||||
_cam cameraEffect ["internal", "front", "rtt"];
|
||||
KPLIB_logistic_activeCam = _cam;
|
||||
_cam camSetTarget _vehicle;
|
||||
_cam camSetFov 0.5;
|
||||
_cam camSetPos ((_vehicle getRelPos [15, 0]) vectorAdd [0, 0, 90]);
|
||||
_cam camCommit 0;
|
||||
[_cam, _vehicle, 36, 60] call KPLIB_fnc_common_cameraCircleTarget;
|
||||
} else {
|
||||
if !(_vehicle isEqualTo (camTarget KPLIB_logistic_activeCam)) then {
|
||||
camUseNVG false;
|
||||
showCinemaBorder false;
|
||||
private _cam = "camera" camCreate (getpos _vehicle);
|
||||
_cam cameraEffect ["internal", "front", "rtt"];
|
||||
KPLIB_logistic_activeCam = _cam;
|
||||
_cam camSetTarget _vehicle;
|
||||
_cam camSetFov 0.5;
|
||||
_cam camSetPos ((_vehicle getRelPos [15, 0]) vectorAdd [0, 0, 90]);
|
||||
_cam camCommit 0;
|
||||
[_cam, _vehicle, 36, 60] call KPLIB_fnc_common_cameraCircleTarget;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -4,8 +4,9 @@
|
|||
File: fn_logistic_settings.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-01-28
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-03
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
Public: No
|
||||
|
||||
Description:
|
||||
CBA Settings initialization for this module.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
File: KPLIB_logisticMain.hpp
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-01-16
|
||||
Last Update: 2019-01-16
|
||||
Last Update: 2019-04-05
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
|
@ -21,6 +21,7 @@ class KPLIB_logisticMain {
|
|||
class KPLIB_DialogTitle: KPGUI_PRE_DialogTitleC {
|
||||
text = "$STR_KPLIB_DIALOG_LOGISTICMAIN_TITLE";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class controls {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
File: KPLIB_recycle.hpp
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-01-22
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-05
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
|
@ -23,6 +23,7 @@ class KPLIB_recycle {
|
|||
};
|
||||
|
||||
class KPLIB_DialogArea: KPGUI_PRE_DialogBackgroundC {};
|
||||
|
||||
};
|
||||
|
||||
class controls {
|
||||
|
@ -34,7 +35,7 @@ class KPLIB_recycle {
|
|||
w = KP_GETW(KP_WIDTH_VAL_C,(12/11));
|
||||
h = KP_GETH(KP_HEIGHT_VAL_C,24);
|
||||
tooltip = "$STR_KPLIB_DIALOG_RECYCLE_VEHICLE_TT";
|
||||
onLBSelChanged = "KPLIB_logistic_activeCam cameraEffect [""terminate"",""back""]; camDestroy KPLIB_logistic_activeCam; [] spawn KPLIB_fnc_logistic_selectRecycleTarget";
|
||||
onLBSelChanged = "KPLIB_logistic_activeCam cameraEffect [""terminate"",""back""]; camDestroy KPLIB_logistic_activeCam; [] call KPLIB_fnc_logistic_selectRecycleTarget";
|
||||
};
|
||||
|
||||
class KPLIB_RefreshVehicles: KPGUI_PRE_CloseCross {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
File: KPLIB_resupply.hpp
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-02-21
|
||||
Last Update: 2019-02-24
|
||||
Last Update: 2019-04-05
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
|
@ -23,6 +23,7 @@ class KPLIB_resupply {
|
|||
};
|
||||
|
||||
class KPLIB_DialogArea: KPGUI_PRE_DialogBackgroundC {};
|
||||
|
||||
};
|
||||
|
||||
class controls {
|
||||
|
@ -34,7 +35,7 @@ class KPLIB_resupply {
|
|||
w = KP_GETW(KP_WIDTH_VAL_C,(12/11));
|
||||
h = KP_GETH(KP_HEIGHT_VAL_C,24);
|
||||
tooltip = "$STR_KPLIB_DIALOG_RESUPPLY_VEHICLE_TT";
|
||||
onLBSelChanged = "KPLIB_logistic_activeCam cameraEffect [""terminate"",""back""]; camDestroy KPLIB_logistic_activeCam; [] spawn KPLIB_fnc_logistic_selectResupplyTarget";
|
||||
onLBSelChanged = "KPLIB_logistic_activeCam cameraEffect [""terminate"",""back""]; camDestroy KPLIB_logistic_activeCam; [] call KPLIB_fnc_logistic_selectResupplyTarget";
|
||||
};
|
||||
|
||||
class KPLIB_RefreshVehicles: KPGUI_PRE_CloseCross {
|
||||
|
@ -52,7 +53,7 @@ class KPLIB_resupply {
|
|||
y = KP_GETCY(KP_Y_VAL_C,KP_HEIGHT_VAL_C,5,48);
|
||||
w = KP_GETW(KP_WIDTH_VAL_C,1);
|
||||
tooltip = "$STR_KPLIB_DIALOG_RESUPPLY_CARGO_TT";
|
||||
onLBSelChanged = "KPLIB_logistic_activeCam cameraEffect [""terminate"",""back""]; camDestroy KPLIB_logistic_activeCam; [] spawn KPLIB_fnc_logistic_selectResupplyTarget";
|
||||
onLBSelChanged = "[] call KPLIB_fnc_logistic_selectResupplyTarget";
|
||||
};
|
||||
|
||||
class KPLIB_TextCargoState: KPGUI_PRE_Text {
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
# KP Liberation Module Description
|
||||
|
||||
## Example Module
|
||||
This is an example module description.
|
||||
Used as template for new modules. Make sure to replace the `example` everywhere accordingly.
|
||||
|
||||
### Dependencies
|
||||
* None
|
||||
|
||||
### Functions
|
||||
|
||||
|
||||
### Scripts
|
||||
No scripts will be started by this module
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_addEquipment
|
||||
|
||||
File: fn_cratefiller_addEquipment.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-06
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Adds the given amount of the selected item to the inventory.
|
||||
|
||||
Parameter(s):
|
||||
_amount - Amount of the equipment which will be added [NUMBER, defaults to 0]
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
params [
|
||||
["_amount", 0, [0]]
|
||||
];
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 758026;
|
||||
private _ctrlEquipment = _dialog displayCtrl 75812;
|
||||
|
||||
// Read controls
|
||||
private _index = lbCurSel _ctrlEquipment;
|
||||
|
||||
// Check for empty selection
|
||||
if (_index isEqualTo -1) exitWith {};
|
||||
|
||||
// Get the storage object
|
||||
private _storage = [] call KPLIB_fnc_cratefiller_getStorage;
|
||||
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
|
||||
|
||||
// Check if the storage is in range
|
||||
if ((_storage distance2D (getMarkerPos _nearFOB)) > KPLIB_param_fobRange) exitWith {
|
||||
[localize "STR_KPLIB_HINT_RANGE"] call CBA_fnc_notify;
|
||||
[] remoteExecCall ["KPLIB_fnc_cratefiller_getNearStorages", (allPlayers - entities "HeadlessClient_F")];
|
||||
};
|
||||
|
||||
// Item selection
|
||||
private _item = _ctrlEquipment lbData _index;
|
||||
|
||||
// Check for enough inventory capacity
|
||||
if (!(_storage canAdd [_item, _amount])) exitWith {
|
||||
[localize "STR_KPLIB_HINT_FULL"] call CBA_fnc_notify;
|
||||
};
|
||||
|
||||
// Add the given item
|
||||
if (_item isKindOf "Bag_Base") then {
|
||||
_storage addBackpackCargoGlobal [_item, _amount];
|
||||
} else {
|
||||
_storage addItemCargoGlobal [_item, _amount];
|
||||
};
|
||||
|
||||
[] remoteExecCall ["KPLIB_fnc_cratefiller_showInventory", (allPlayers - entities "HeadlessClient_F")];
|
||||
|
||||
private _config = [_item] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
private _name = (getText (configFile >> _config >> _item >> "displayName"));
|
||||
private _picture = (getText (configFile >> _config >> _item >> "picture"));
|
||||
[
|
||||
[_picture, 2],
|
||||
[format [localize "STR_KPLIB_HINT_ADDED", _name, _amount]]
|
||||
] call CBA_fnc_notify;
|
||||
|
||||
true
|
|
@ -0,0 +1,118 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_createEquipmentList
|
||||
|
||||
File: fn_cratefiller_createEquipmentList.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-06
|
||||
Last Update: 2019-04-06
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Changes the shown equipment category.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 758026;
|
||||
private _ctrlCat = _dialog displayCtrl 75810;
|
||||
private _ctrlWeapon = _dialog displayCtrl 75811;
|
||||
private _ctrlEquipment = _dialog displayCtrl 75812;
|
||||
|
||||
// Clear the lists
|
||||
lbClear _ctrlWeapon;
|
||||
lbClear _ctrlEquipment;
|
||||
|
||||
// Hide controls
|
||||
_ctrlWeapon ctrlShow false;
|
||||
|
||||
// Read controls
|
||||
private _catIndex = lbCurSel _ctrlCat;
|
||||
|
||||
// Check for empty selection
|
||||
if (_catIndex isEqualTo -1) exitWith {};
|
||||
|
||||
private _index = 0;
|
||||
private _config = "";
|
||||
|
||||
switch (_catIndex) do {
|
||||
|
||||
// Weapons
|
||||
case 0 : {
|
||||
{
|
||||
_index = _ctrlEquipment lbAdd (_x select 0);
|
||||
_ctrlEquipment lbSetData [_index , _x select 1];
|
||||
_config = [_x select 1] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
_ctrlEquipment lbSetPicture [_index, getText (configFile >> _config >> (_x select 1) >> "picture")];
|
||||
} forEach (KPLIB_cratefiller_data getVariable ["weapons", []]);
|
||||
};
|
||||
|
||||
// Magazines
|
||||
case 1 : {
|
||||
_ctrlWeapon ctrlShow true;
|
||||
{
|
||||
_index = _ctrlWeapon lbAdd (_x select 0);
|
||||
_ctrlWeapon lbSetData [_index , _x select 1];
|
||||
_config = [_x select 1] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
_ctrlWeapon lbSetPicture [_index, getText (configFile >> _config >> (_x select 1) >> "picture")];
|
||||
} forEach (KPLIB_cratefiller_data getVariable ["weapons", []]);
|
||||
};
|
||||
|
||||
// Attachments
|
||||
case 2 : {
|
||||
_ctrlWeapon ctrlShow true;
|
||||
{
|
||||
_index = _ctrlWeapon lbAdd (_x select 0);
|
||||
_ctrlWeapon lbSetData [_index , _x select 1];
|
||||
_config = [_x select 1] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
_ctrlWeapon lbSetPicture [_index, getText (configFile >> _config >> (_x select 1) >> "picture")];
|
||||
} forEach (KPLIB_cratefiller_data getVariable ["weapons", []]);
|
||||
};
|
||||
|
||||
// Grenades
|
||||
case 3 : {
|
||||
{
|
||||
_index = _ctrlEquipment lbAdd (_x select 0);
|
||||
_ctrlEquipment lbSetData [_index , _x select 1];
|
||||
_config = [_x select 1] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
_ctrlEquipment lbSetPicture [_index, getText (configFile >> _config >> (_x select 1) >> "picture")];
|
||||
} forEach (KPLIB_cratefiller_data getVariable ["grenades", []]);
|
||||
};
|
||||
|
||||
// Explosives
|
||||
case 4 : {
|
||||
{
|
||||
_index = _ctrlEquipment lbAdd (_x select 0);
|
||||
_ctrlEquipment lbSetData [_index , _x select 1];
|
||||
_config = [_x select 1] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
_ctrlEquipment lbSetPicture [_index, getText (configFile >> _config >> (_x select 1) >> "picture")];
|
||||
} forEach (KPLIB_cratefiller_data getVariable ["explosives", []]);
|
||||
};
|
||||
|
||||
// Items
|
||||
case 5 : {
|
||||
{
|
||||
_index = _ctrlEquipment lbAdd (_x select 0);
|
||||
_ctrlEquipment lbSetData [_index , _x select 1];
|
||||
_config = [_x select 1] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
_ctrlEquipment lbSetPicture [_index, getText (configFile >> _config >> (_x select 1) >> "picture")];
|
||||
} forEach (KPLIB_cratefiller_data getVariable ["items", []]);
|
||||
};
|
||||
|
||||
// Backpacks
|
||||
case 6 : {
|
||||
{
|
||||
_index = _ctrlEquipment lbAdd (_x select 0);
|
||||
_ctrlEquipment lbSetData [_index , _x select 1];
|
||||
_config = [_x select 1] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
_ctrlEquipment lbSetPicture [_index, getText (configFile >> _config >> (_x select 1) >> "picture")];
|
||||
} forEach (KPLIB_cratefiller_data getVariable ["backpacks", []]);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
true
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_createSubList
|
||||
|
||||
File: fn_cratefiller_createSubList.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-06
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Creates a list with valueable magazines or attachments.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 758026;
|
||||
private _ctrlCat = _dialog displayCtrl 75810;
|
||||
private _ctrlWeapon = _dialog displayCtrl 75811;
|
||||
private _ctrlEquipment = _dialog displayCtrl 75812;
|
||||
|
||||
// Clear the lists
|
||||
lbClear _ctrlEquipment;
|
||||
|
||||
// Read controls
|
||||
private _catIndex = lbCurSel _ctrlCat;
|
||||
private _weaponIndex = lbCurSel _ctrlWeapon;
|
||||
|
||||
// Check for empty selection
|
||||
if (_weaponIndex isEqualTo -1) exitWith {};
|
||||
|
||||
// Weapon selection
|
||||
private _weaponType = _ctrlWeapon lbData _weaponIndex;
|
||||
|
||||
private _config = "";
|
||||
|
||||
switch (_catIndex) do {
|
||||
|
||||
// Magazines
|
||||
case 1 : {
|
||||
// Get compatible magazines
|
||||
private _glType = (getArray (configfile >> "CfgWeapons" >> _weaponType >> "muzzles")) select 1;
|
||||
private _magazines = [_weaponType] call CBA_fnc_compatibleMagazines;
|
||||
_magazines append ([configfile >> "CfgWeapons" >> _weaponType >> _glType] call CBA_fnc_compatibleMagazines);
|
||||
_magazines = _magazines - KPLIB_preset_arsenal_blacklist;
|
||||
private _sortedMagazines = [_magazines] call KPLIB_fnc_cratefiller_sortList;
|
||||
|
||||
private _index = 0;
|
||||
|
||||
// Fill controls
|
||||
{
|
||||
_index = _ctrlEquipment lbAdd (_x select 0);
|
||||
_ctrlEquipment lbSetData [_index , _x select 1];
|
||||
_config = [_x select 1] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
_ctrlEquipment lbSetPicture [_index, getText (configFile >> _config >> (_x select 1) >> "picture")];
|
||||
} forEach _sortedMagazines;
|
||||
};
|
||||
|
||||
// Attachments
|
||||
case 2 : {
|
||||
// Get compatible attachments
|
||||
private _attachments = [_weaponType] call BIS_fnc_compatibleItems;
|
||||
_attachments = _attachments - KPLIB_preset_arsenal_blacklist;
|
||||
private _sortedAttachments = [_attachments] call KPLIB_fnc_cratefiller_sortList;
|
||||
|
||||
private _index = 0;
|
||||
|
||||
// Fill controls
|
||||
{
|
||||
_index = _ctrlEquipment lbAdd (_x select 0);
|
||||
_ctrlEquipment lbSetData [_index , _x select 1];
|
||||
_config = [_x select 1] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
_ctrlEquipment lbSetPicture [_index, getText (configFile >> _config >> (_x select 1) >> "picture")];
|
||||
} forEach _sortedAttachments;
|
||||
};
|
||||
};
|
||||
|
||||
true
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_deletePreset
|
||||
|
||||
File: fn_cratefiller_deletePreset.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-07
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Deletes the selected preset.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 758026;
|
||||
private _ctrlImport = _dialog displayCtrl 75821;
|
||||
|
||||
// Read the import name
|
||||
private _index = lbCurSel _ctrlImport;
|
||||
private _importName = _ctrlImport lbText _index;
|
||||
|
||||
// Check for empty selection
|
||||
if (_index isEqualTo -1) exitWith {
|
||||
[localize "STR_KPLIB_HINT_SELECTION"] call CBA_fnc_notify;
|
||||
};
|
||||
|
||||
// Read the presets from profileNamespace
|
||||
private _import = profileNamespace getVariable ["KPLIB_cratefiller_preset", []];
|
||||
|
||||
_import deleteAt (_import findIf {(_x select 0) isEqualTo _importName});
|
||||
|
||||
// Save the inventory into profileNamespace
|
||||
profileNamespace setVariable ["KPLIB_cratefiller_preset", _import];
|
||||
saveProfileNamespace;
|
||||
|
||||
[] call KPLIB_fnc_cratefiller_showPresets;
|
||||
|
||||
true
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_export
|
||||
|
||||
File: fn_cratefiller_export.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-07
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Exports the active inventory.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 758026;
|
||||
private _ctrlExport = _dialog displayCtrl 75820;
|
||||
|
||||
// Read the presets from profileNamespace
|
||||
private _preset = profileNamespace getVariable ["KPLIB_cratefiller_preset", []];
|
||||
|
||||
// Read the export name
|
||||
private _exportName = ctrlText _ctrlExport;
|
||||
_ctrlExport ctrlSetText "";
|
||||
|
||||
// Check if the name is empty
|
||||
if (_exportName isEqualTo "") exitWith {
|
||||
[localize "STR_KPLIB_HINT_NAME"] call CBA_fnc_notify;
|
||||
};
|
||||
|
||||
// Check if the variable is empty
|
||||
if !(_preset isEqualTo []) then {
|
||||
// Check if the exportname already exists
|
||||
_preset deleteAt (_preset findIf {(_x select 0) isEqualTo _exportName});
|
||||
};
|
||||
|
||||
// Get the storage inventory
|
||||
private _inventory = [] call KPLIB_fnc_cratefiller_getInventory;
|
||||
|
||||
// Save the inventory into profileNamespace
|
||||
_preset pushBack [_exportName, +_inventory];
|
||||
|
||||
profileNamespace setVariable ["KPLIB_cratefiller_preset", _preset];
|
||||
saveProfileNamespace;
|
||||
|
||||
[] call KPLIB_fnc_cratefiller_showPresets;
|
||||
|
||||
true
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_getConfigPath
|
||||
|
||||
File: fn_cratefiller_getConfigPath.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-05
|
||||
Last Update: 2019-04-06
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Gets the config path / type of the given classname.
|
||||
|
||||
Parameter(s):
|
||||
_classname - Classname which should be checked [STRING, defaults to ""]
|
||||
|
||||
Returns:
|
||||
Config path [STRING]
|
||||
*/
|
||||
|
||||
params [
|
||||
["_classname", "", [""]]
|
||||
];
|
||||
|
||||
// find configclass
|
||||
switch true do
|
||||
{
|
||||
case (isClass (configFile >> "CfgMagazines" >> _classname)): {"CfgMagazines"};
|
||||
case (isClass (configFile >> "CfgWeapons" >> _classname)): {"CfgWeapons"};
|
||||
case (isClass (configFile >> "CfgVehicles" >> _classname)): {"CfgVehicles"};
|
||||
case (isClass (configFile >> "CfgGlasses" >> _classname)): {"CfgGlasses"};
|
||||
default {""};
|
||||
};
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_getInventory
|
||||
|
||||
File: fn_cratefiller_getInventory.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-06
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Gets all inventory items of the storage.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Inventory of the active storage [ARRAY]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 758026;
|
||||
|
||||
// Get the storage object
|
||||
private _storage = [] call KPLIB_fnc_cratefiller_getStorage;
|
||||
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
|
||||
|
||||
// Check for an active storage
|
||||
private _cargo = [];
|
||||
if (isNull _storage) exitWith {
|
||||
_cargo
|
||||
};
|
||||
|
||||
// Get all cargo
|
||||
private _item = getItemCargo _storage;
|
||||
private _weapon = getWeaponCargo _storage;
|
||||
private _magazine = getMagazineCargo _storage;
|
||||
private _backpack = getBackpackCargo _storage;
|
||||
|
||||
_cargo = _item;
|
||||
(_cargo select 0) append (_weapon select 0);
|
||||
(_cargo select 1) append (_weapon select 1);
|
||||
(_cargo select 0) append (_magazine select 0);
|
||||
(_cargo select 1) append (_magazine select 1);
|
||||
(_cargo select 0) append (_backpack select 0);
|
||||
(_cargo select 1) append (_backpack select 1);
|
||||
|
||||
// Count the variable index
|
||||
private _count = count (_cargo select 0);
|
||||
|
||||
private _config = "";
|
||||
|
||||
// Adapt the cargo
|
||||
private _finalCargo = [];
|
||||
for "_i" from 0 to (_count - 1) do {
|
||||
_config = [(_cargo select 0) select _i] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
_finalCargo pushBack [
|
||||
(getText (configFile >> _config >> ((_cargo select 0) select _i) >> "displayName")),
|
||||
(_cargo select 0) select _i,
|
||||
(_cargo select 1) select _i
|
||||
];
|
||||
};
|
||||
|
||||
_finalCargo sort true;
|
||||
|
||||
_finalCargo
|
|
@ -0,0 +1,69 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_getNearStorages
|
||||
|
||||
File: fn_cratefiller_getNearStorages.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-06
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Scans the fob for possible storages.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 758026;
|
||||
private _ctrlStorage = _dialog displayCtrl 75802;
|
||||
|
||||
// Clear the lists
|
||||
lbClear _ctrlStorage;
|
||||
|
||||
// Get near objects and check for storage capacity
|
||||
private _type = objNull;
|
||||
private _config = "";
|
||||
private _number= 0;
|
||||
private _index = 0;
|
||||
private _picture = "";
|
||||
private _storages = [];
|
||||
private _blacklist = [
|
||||
KPLIB_preset_crateSupplyE,
|
||||
KPLIB_preset_crateSupplyF,
|
||||
KPLIB_preset_crateAmmoE,
|
||||
KPLIB_preset_crateAmmoF,
|
||||
KPLIB_preset_crateFuelE,
|
||||
KPLIB_preset_crateFuelF,
|
||||
KPLIB_logistic_building
|
||||
];
|
||||
|
||||
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
|
||||
{
|
||||
_type = typeOf _x;
|
||||
if (_type isEqualTo "GroundWeaponHolder") exitWith {};
|
||||
_config = [_type] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
_number = getNumber (configfile >> _config >> _type >> "maximumLoad");
|
||||
if (_number > 0) then {
|
||||
_storages pushBack _x;
|
||||
};
|
||||
} forEach (((getMarkerPos _nearFOB) nearObjects KPLIB_param_fobRange) select {!(typeOf _x in _blacklist)});
|
||||
|
||||
// Fill the list
|
||||
{
|
||||
_type = typeOf _x;
|
||||
_config = [_type] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
_index = _ctrlStorage lbAdd format ["%1m - %2", round ((getMarkerPos _nearFOB) distance2D _x), getText (configFile >> _config >> _type >> "displayName")];
|
||||
_ctrlStorage lbSetData [_index, netId _x];
|
||||
_picture = getText (configFile >> _config >> _type >> "picture");
|
||||
if (_picture isEqualTo "pictureThing") then {
|
||||
_ctrlStorage lbSetPicture [_index, "KPGUI\res\icon_help.paa"];
|
||||
} else {
|
||||
_ctrlStorage lbSetPicture [_index, _picture];
|
||||
};
|
||||
} forEach _storages;
|
||||
|
||||
true
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_getStorage
|
||||
|
||||
File: fn_cratefiller_getStorage.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-06
|
||||
Last Update: 2019-04-06
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Returns the active storage.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Active Storage [OBJECT]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 758026;
|
||||
private _ctrlStorage = _dialog displayCtrl 75802;
|
||||
|
||||
// Read controls
|
||||
private _storageIndex = lbCurSel _ctrlStorage;
|
||||
|
||||
// Check for empty variable
|
||||
if (_storageIndex isEqualTo -1) exitWith {
|
||||
objNull
|
||||
};
|
||||
|
||||
// Get the storage object
|
||||
private _storage = objectFromNetId (_ctrlStorage lbData _storageIndex);
|
||||
|
||||
_storage
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_import
|
||||
|
||||
File: fn_cratefiller_import.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-07
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Imports the selected inventory.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 758026;
|
||||
private _ctrlImport = _dialog displayCtrl 75821;
|
||||
|
||||
// Get the storage object
|
||||
private _storage = [] call KPLIB_fnc_cratefiller_getStorage;
|
||||
|
||||
// Check if there's an active storage
|
||||
if (isNull _storage) exitWith {
|
||||
[localize "STR_KPLIB_HINT_NOSTORAGE"] call CBA_fnc_notify;
|
||||
};
|
||||
|
||||
// Read the import name
|
||||
private _index = lbCurSel _ctrlImport;
|
||||
private _importName = _ctrlImport lbText _index;
|
||||
|
||||
// Check for empty selection
|
||||
if (_index isEqualTo -1) exitWith {
|
||||
[localize "STR_KPLIB_HINT_SELECTION"] call CBA_fnc_notify;
|
||||
};
|
||||
|
||||
// Get the storage inventory
|
||||
private _inventory = [] call KPLIB_fnc_cratefiller_getInventory;
|
||||
|
||||
// Read the presets from profileNamespace
|
||||
private _import = profileNamespace getVariable ["KPLIB_cratefiller_preset", []];
|
||||
private _index = _import findIf {(_x select 0) isEqualTo _importName};
|
||||
_inventory append ((_import select _index) select 1);
|
||||
|
||||
[_inventory] call KPLIB_fnc_cratefiller_setInventory;
|
||||
|
||||
true
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_openDialog
|
||||
|
||||
File: fn_cratefiller_openDialog.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-06
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Opens the cratefiller dialog.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Create dialog
|
||||
createDialog "KPLIB_cratefiller";
|
||||
disableSerialization;
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 758026;
|
||||
private _ctrlCat = _dialog displayCtrl 75810;
|
||||
private _ctrlWeapon = _dialog displayCtrl 75811;
|
||||
|
||||
// Hide controls
|
||||
_ctrlWeapon ctrlShow false;
|
||||
|
||||
// Reset variables
|
||||
_ctrlCat lbAdd localize "STR_KPLIB_DIALOG_CRATEFILLER_LISTWEAPONS";
|
||||
_ctrlCat lbAdd localize "STR_KPLIB_DIALOG_CRATEFILLER_LISTMAGAZINES";
|
||||
_ctrlCat lbAdd localize "STR_KPLIB_DIALOG_CRATEFILLER_LISTATTACHMENTS";
|
||||
_ctrlCat lbAdd localize "STR_KPLIB_DIALOG_CRATEFILLER_LISTGRENADES";
|
||||
_ctrlCat lbAdd localize "STR_KPLIB_DIALOG_CRATEFILLER_LISTEXPLOSIVES";
|
||||
_ctrlCat lbAdd localize "STR_KPLIB_DIALOG_CRATEFILLER_LISTVARIOUS";
|
||||
_ctrlCat lbAdd localize "STR_KPLIB_DIALOG_CRATEFILLER_LISTBACKPACKS";
|
||||
|
||||
[] call KPLIB_fnc_cratefiller_showPresets;
|
||||
[] call KPLIB_fnc_cratefiller_getNearStorages;
|
||||
|
||||
true
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_postInit
|
||||
|
||||
File: fn_cratefiller_postInit.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-05
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
The postInit function of a module takes care of starting/executing the modules functions or scripts.
|
||||
Basically it starts/initializes the module functionality to make all provided features usable.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Module postInit finished [BOOL]
|
||||
*/
|
||||
|
||||
if (isServer) then {diag_log format ["[KP LIBERATION] [%1] [POST] [CRATEFILLER] Module initializing...", diag_tickTime];};
|
||||
|
||||
// Server section (dedicated and player hosted)
|
||||
if (isServer) then {
|
||||
// create cratefiller presets on startup
|
||||
[] call KPLIB_fnc_cratefiller_presets;
|
||||
|
||||
// Register arsenal filled event handler
|
||||
["KPLIB_arsenal_newLists", {[] call KPLIB_fnc_cratefiller_presets;}] call CBA_fnc_addEventHandler;
|
||||
};
|
||||
|
||||
if (isServer) then {diag_log format ["[KP LIBERATION] [%1] [POST] [CRATEFILLER] Module initialized", diag_tickTime];};
|
||||
|
||||
true
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
KPLIB_fnc_example_preInit
|
||||
|
||||
File: fn_example_preInit.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-02-02
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
The preInit function defines global variables, adds event handlers and set some vital settings which are used in this module.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Module preInit finished [BOOL]
|
||||
*/
|
||||
|
||||
if (isServer) then {
|
||||
diag_log format ["[KP LIBERATION] [%1] [PRE] [CRATEFILLER] Module initializing...", diag_tickTime];
|
||||
|
||||
/*
|
||||
----- Module Initialization -----
|
||||
*/
|
||||
|
||||
KPLIB_cratefiller_data = true call CBA_fnc_createNamespace;
|
||||
publicVariable "KPLIB_cratefiller_data";
|
||||
|
||||
};
|
||||
|
||||
// Process CBA Settings
|
||||
[] call KPLIB_fnc_cratefiller_settings;
|
||||
|
||||
if (isServer) then {diag_log format ["[KP LIBERATION] [%1] [PRE] [CRATEFILLER] Module initialized", diag_tickTime];};
|
||||
|
||||
true
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_presets
|
||||
|
||||
File: fn_cratefiller_presets.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-06
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Creates the different categories of the whitelisted items.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Define variables
|
||||
private _weapons = [];
|
||||
private _grenades = [];
|
||||
private _explosives = [];
|
||||
private _items = [];
|
||||
private _backpacks = [];
|
||||
private _classNames = KPLIB_preset_arsenal_whitelist;
|
||||
private _type = [];
|
||||
private _specialItems = [];
|
||||
|
||||
// Search for special items with wrong config entrys
|
||||
{
|
||||
if (_x isKindOf ["CBA_MiscItem", configfile >> "CfgWeapons"]) then {_specialItems pushBack _x};
|
||||
} forEach _classNames;
|
||||
|
||||
// Sort all classnames into the different categories
|
||||
{
|
||||
_type = _x call BIS_fnc_itemType;
|
||||
switch (_type select 0) do {
|
||||
case "Weapon": {if ((_type select 1) isEqualTo "UnknownWeapon") then {_items pushBack _x} else {if ((_x call BIS_fnc_baseWeapon) isEqualTo _x) then {_weapons pushBack _x;};};};
|
||||
case "Mine": {_explosives pushBack _x};
|
||||
case "Magazine": {if ((((_type select 1) isEqualTo "Grenade") || ((_type select 1) isEqualTo "SmokeShell")) && !((getNumber (configFile >> "CfgMagazines" >> _x >> "type")) isEqualTo 16)) then {_grenades pushBack _x}};
|
||||
case "Equipment": {if ((_type select 1) isEqualTo "Backpack") then {_backpacks pushBack _x}};
|
||||
case "Item": {
|
||||
switch (_type select 1) do {
|
||||
case "AccessoryMuzzle" : {};
|
||||
case "AccessoryPointer" : {};
|
||||
case "AccessorySights" : {};
|
||||
case "AccessoryBipod" : {};
|
||||
default {_items pushBack _x};
|
||||
};
|
||||
};
|
||||
};
|
||||
} forEach (_classnames arrayIntersect _classnames);
|
||||
|
||||
_items append _specialItems;
|
||||
|
||||
KPLIB_cratefiller_data setVariable ["weapons", [_weapons] call KPLIB_fnc_cratefiller_sortList, true];
|
||||
KPLIB_cratefiller_data setVariable ["grenades", [_grenades] call KPLIB_fnc_cratefiller_sortList, true];
|
||||
KPLIB_cratefiller_data setVariable ["explosives", [_explosives] call KPLIB_fnc_cratefiller_sortList, true];
|
||||
KPLIB_cratefiller_data setVariable ["items", [_items] call KPLIB_fnc_cratefiller_sortList, true];
|
||||
KPLIB_cratefiller_data setVariable ["backpacks", [_backpacks] call KPLIB_fnc_cratefiller_sortList, true];
|
||||
|
||||
true
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_removeEquipment
|
||||
|
||||
File: fn_cratefiller_removeEquipment.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-06
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Removes the given amount of the selected item from the storage.
|
||||
|
||||
Parameter(s):
|
||||
_amount - Amount of the equipment which will be removed [NUMBER, defaults to 0]
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
params [
|
||||
["_amount", 0, [0]]
|
||||
];
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 758026;
|
||||
private _ctrlInventory = _dialog displayCtrl 75822;
|
||||
|
||||
// Read controls
|
||||
private _index = lbCurSel _ctrlInventory;
|
||||
|
||||
// Get the storage object
|
||||
private _storage = [] call KPLIB_fnc_cratefiller_getStorage;
|
||||
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
|
||||
|
||||
// Get the storage inventory
|
||||
private _inventory = [] call KPLIB_fnc_cratefiller_getInventory;
|
||||
|
||||
// Check for empty selection
|
||||
if (_index isEqualTo -1) exitWith {
|
||||
[localize "STR_KPLIB_HINT_SELECTION"] call CBA_fnc_notify;
|
||||
};
|
||||
|
||||
// Check if the storage is in range
|
||||
if ((_storage distance2D (getMarkerPos _nearFOB)) > KPLIB_param_fobRange) exitWith {
|
||||
[localize "STR_KPLIB_HINT_RANGE"] call CBA_fnc_notify;
|
||||
[] remoteExecCall ["KPLIB_fnc_cratefiller_getNearStorages", (allPlayers - entities "HeadlessClient_F")];
|
||||
};
|
||||
|
||||
// Check for inventory clear
|
||||
if (_amount isEqualTo 0) exitWith {
|
||||
_inventory = [];
|
||||
[_inventory] call KPLIB_fnc_cratefiller_setInventory;
|
||||
[localize "STR_KPLIB_HINT_CLEARFULL"] call CBA_fnc_notify;
|
||||
};
|
||||
|
||||
// Item selection
|
||||
private _item = ((_inventory select _index) select 1);
|
||||
|
||||
// New item amount
|
||||
private _modify = (((_inventory select _index) select 2) - _amount);
|
||||
|
||||
// Check if the amount is negative
|
||||
if (_modify < 0) then {
|
||||
_modify = 0;
|
||||
};
|
||||
|
||||
// Modify array
|
||||
(_inventory select _index) set [2, _modify];
|
||||
|
||||
[_inventory] call KPLIB_fnc_cratefiller_setInventory;
|
||||
|
||||
private _config = [_item] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
private _name = (getText (configFile >> _config >> _item >> "displayName"));
|
||||
private _picture = (getText (configFile >> _config >> _item >> "picture"));
|
||||
[
|
||||
[_picture, 2],
|
||||
[format [localize "STR_KPLIB_HINT_UNLOAD", _name, _amount]]
|
||||
] call CBA_fnc_notify;
|
||||
|
||||
true
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_setInventory
|
||||
|
||||
File: fn_cratefiller_setInventory.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-06
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Adds the items to the active storage.
|
||||
|
||||
Parameter(s):
|
||||
_inventory - Inventory data which should be applied to the active storage [ARRAY, defaults to []]
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
params [
|
||||
["_inventory", [], [[]]]
|
||||
];
|
||||
// Get the storage object
|
||||
private _storage = [] call KPLIB_fnc_cratefiller_getStorage;
|
||||
private _nearFOB = [] call KPLIB_fnc_common_getPlayerFob;
|
||||
|
||||
// Check if the storage is in range
|
||||
if ((_storage distance2D (getMarkerPos _nearFOB)) > KPLIB_param_fobRange) exitWith {
|
||||
[localize "STR_KPLIB_HINT_RANGE"] call CBA_fnc_notify;
|
||||
[] remoteExecCall ["KPLIB_fnc_cratefiller_getNearStorages", (allPlayers - entities "HeadlessClient_F")];
|
||||
};
|
||||
|
||||
// Check if the storage will be empty
|
||||
if (count _inventory isEqualTo 0) exitWith {
|
||||
clearWeaponCargoGlobal _storage;
|
||||
clearMagazineCargoGlobal _storage;
|
||||
clearItemCargoGlobal _storage;
|
||||
clearBackpackCargoGlobal _storage;
|
||||
[] remoteExecCall ["KPLIB_fnc_cratefiller_showInventory", (allPlayers - entities "HeadlessClient_F")];
|
||||
};
|
||||
|
||||
// Clear the storage
|
||||
clearWeaponCargoGlobal _storage;
|
||||
clearMagazineCargoGlobal _storage;
|
||||
clearItemCargoGlobal _storage;
|
||||
clearBackpackCargoGlobal _storage;
|
||||
|
||||
// Count the variable index
|
||||
private _count = count _inventory;
|
||||
private _item = "";
|
||||
private _amount = 0;
|
||||
|
||||
// Adapt the cargo into KPCF variable
|
||||
for "_i" from 0 to (_count-1) do {
|
||||
_item = (_inventory select _i) select 1;
|
||||
_amount = (_inventory select _i) select 2;
|
||||
if (!(_storage canAdd [_item, _amount])) exitWith {};
|
||||
if (((_inventory select _i) select 1) isKindOf "Bag_Base") then {
|
||||
_storage addBackpackCargoGlobal [_item, _amount];
|
||||
} else {
|
||||
_storage addItemCargoGlobal [_item, _amount];
|
||||
};
|
||||
};
|
||||
|
||||
[] remoteExecCall ["KPLIB_fnc_cratefiller_showInventory", (allPlayers - entities "HeadlessClient_F")];
|
||||
|
||||
true
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_settings
|
||||
|
||||
File: fn_cratefiller_settings.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-05
|
||||
Last Update: 2019-04-06
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
CBA Settings initialization for this module
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
/*
|
||||
----- CRATEFILLER SETTINGS -----
|
||||
*/
|
||||
|
||||
// KPLIB_param_cratefiller
|
||||
// Enables/Disables the cratefiller.
|
||||
// Default: true
|
||||
[
|
||||
"KPLIB_param_cratefiller",
|
||||
"CHECKBOX",
|
||||
[localize "STR_KPLIB_SETTINGS_CRATEFILLER_ACTIVATE", localize "STR_KPLIB_SETTINGS_CRATEFILLER_ACTIVATE_TT"],
|
||||
localize "STR_KPLIB_SETTINGS_CRATEFILLER",
|
||||
true,
|
||||
1,
|
||||
{}
|
||||
] call CBA_Settings_fnc_init;
|
||||
|
||||
true
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_showInventory
|
||||
|
||||
File: fn_cratefiller_showInventory.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-06
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Displays the items of the active storage.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 758026;
|
||||
private _ctrlInventory = _dialog displayCtrl 75822;
|
||||
private _ctlrProgress = _dialog displayCtrl 75823;
|
||||
|
||||
// Check if dialog is open
|
||||
if (isNull _dialog) exitWith {};
|
||||
|
||||
// Reset variables
|
||||
lbClear _ctrlInventory;
|
||||
|
||||
private _config = "";
|
||||
private _type = "";
|
||||
private _itemMass = 0;
|
||||
private _index = 0;
|
||||
|
||||
// Get the active storage
|
||||
private _storage = [] call KPLIB_fnc_cratefiller_getStorage;
|
||||
|
||||
// Get the storage inventory
|
||||
private _inventory = [] call KPLIB_fnc_cratefiller_getInventory;
|
||||
|
||||
// Fill the controls
|
||||
{
|
||||
_index = _ctrlInventory lbAdd (format ["%1x %2", str (_x select 2), _x select 0]);
|
||||
_config = [_x select 1] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
_ctrlInventory lbSetPicture [_index, getText (configFile >> _config >> (_x select 1) >> "picture")];
|
||||
} forEach _inventory;
|
||||
|
||||
private _load = 0;
|
||||
|
||||
// Check for an active storage
|
||||
if (isNull _storage) exitWith {
|
||||
_ctlrProgress progressSetPosition 0;
|
||||
};
|
||||
|
||||
// Get the mass of each item
|
||||
{
|
||||
_type = (_x select 1);
|
||||
_config = [_type] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
if (_config isEqualTo "CfgWeapons") then {
|
||||
_itemMass = getNumber (configfile >> _config >> _type >> "WeaponSlotsInfo" >> "mass");
|
||||
if (_itemMass isEqualTo 0) then {
|
||||
_itemMass = getNumber (configfile >> _config >> _type >> "ItemInfo" >> "mass");
|
||||
};
|
||||
} else {
|
||||
_itemMass = getNumber (configFile >> _config >> _type >> "mass");
|
||||
};
|
||||
_load = _load + (_itemMass * (_x select 2));
|
||||
} forEach _inventory;
|
||||
|
||||
_type = typeOf _storage;
|
||||
_config = [_type] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
private _maxLoad = getNumber (configFile >> _config >> _type >> "maximumLoad");
|
||||
private _loadFactor = _load / _maxLoad;
|
||||
|
||||
_ctlrProgress progressSetPosition _loadFactor;
|
||||
|
||||
true
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_showPresets
|
||||
|
||||
File: fn_cratefiller_showPresets.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-06
|
||||
Last Update: 2019-04-06
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Reads all saved presets and lists them.
|
||||
|
||||
Parameter(s):
|
||||
NONE
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
// Dialog controls
|
||||
private _dialog = findDisplay 758026;
|
||||
private _ctrlImport = _dialog displayCtrl 75821;
|
||||
|
||||
// Reset variables
|
||||
lbClear _ctrlImport;
|
||||
|
||||
// Read the presets from profileNamespace
|
||||
private _import = profileNamespace getVariable ["KPLIB_cratefiller_preset", []];
|
||||
|
||||
// Fill controls
|
||||
{
|
||||
_ctrlImport lbAdd (_x select 0);
|
||||
} forEach _import;
|
||||
|
||||
true
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
KPLIB_fnc_cratefiller_sortList
|
||||
|
||||
File: fn_cratefiller_sortList.sqf
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-06
|
||||
Last Update: 2019-04-06
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Sorts the displaynames of the given item array.
|
||||
|
||||
Parameter(s):
|
||||
_list - Array of elements which should be sorted [ARRAY, defaults to []]
|
||||
|
||||
Returns:
|
||||
Function reached the end [BOOL]
|
||||
*/
|
||||
|
||||
params [
|
||||
["_list", [], [[]]]
|
||||
];
|
||||
|
||||
private _config = "";
|
||||
private _sortedList = [];
|
||||
|
||||
{
|
||||
_config = [_x] call KPLIB_fnc_cratefiller_getConfigPath;
|
||||
if ((getText (configFile >> _config >> _x >> "displayName")) isEqualTo "") then {
|
||||
} else {
|
||||
_sortedList pushBack [
|
||||
(getText (configFile >> _config >> _x >> "displayName")),
|
||||
_x
|
||||
];
|
||||
};
|
||||
} forEach _list;
|
||||
|
||||
_sortedList sort true;
|
||||
|
||||
_sortedList
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
KP LIBERATION MODULE FUNCTIONS
|
||||
|
||||
File: functions.hpp
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-05
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Defines for all functions, which are brought by this module.
|
||||
*/
|
||||
|
||||
class cratefiller {
|
||||
file = "modules\26_cratefiller\fnc";
|
||||
|
||||
// Adds the given amount of the selected item to the inventory
|
||||
class cratefiller_addEquipment {};
|
||||
|
||||
// Changes the shown equipment category
|
||||
class cratefiller_createEquipmentList {};
|
||||
|
||||
// Creates a list with valueable magazines or attachments
|
||||
class cratefiller_createSubList {};
|
||||
|
||||
// Deletes the selected preset
|
||||
class cratefiller_deletePreset {};
|
||||
|
||||
// Exports the active inventory
|
||||
class cratefiller_export {};
|
||||
|
||||
// Gets all inventory items of the storage
|
||||
class cratefiller_getInventory {};
|
||||
|
||||
// Gets the config path / type of the given classname
|
||||
class cratefiller_getConfigPath {};
|
||||
|
||||
// Scans the fob for possible storages
|
||||
class cratefiller_getNearStorages {};
|
||||
|
||||
// Returns the active storage
|
||||
class cratefiller_getStorage {};
|
||||
|
||||
// Imports the selected inventory
|
||||
class cratefiller_import {};
|
||||
|
||||
// Opens the cratefiller dialog
|
||||
class cratefiller_openDialog {};
|
||||
|
||||
// Module post initialization
|
||||
class cratefiller_postInit {
|
||||
postInit = 1;
|
||||
};
|
||||
|
||||
// Module pre initialization
|
||||
class cratefiller_preInit {
|
||||
preInit = 1;
|
||||
};
|
||||
|
||||
// Creates the different categories of the whitelisted items
|
||||
class cratefiller_presets {};
|
||||
|
||||
// Removes the given amount of the selected item from the storage
|
||||
class cratefiller_removeEquipment {};
|
||||
|
||||
// Adds the items to the active storage
|
||||
class cratefiller_setInventory {};
|
||||
|
||||
// CBA Settings for this module
|
||||
class cratefiller_settings {};
|
||||
|
||||
// Displays the items of the active storage
|
||||
class cratefiller_showInventory {};
|
||||
|
||||
// Reads all saved presets and lists them
|
||||
class cratefiller_showPresets {};
|
||||
|
||||
// Sorts the displaynames of the given item array
|
||||
class cratefiller_sortList {};
|
||||
};
|
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
KP LIBERATION MODULE UI FILE
|
||||
|
||||
File: ui.hpp
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-05
|
||||
Last Update: 2019-04-05
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Initializes the ui defines, dialogs and elements which are brought by this module.
|
||||
*/
|
||||
|
||||
#include "ui\KPLIB_cratefiller.hpp"
|
|
@ -0,0 +1,226 @@
|
|||
/*
|
||||
KP Liberation cratefiller dialog
|
||||
|
||||
File: KPLIB_cratefiller.hpp
|
||||
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
|
||||
Date: 2019-04-05
|
||||
Last Update: 2019-04-07
|
||||
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
Description:
|
||||
Just a placeholder file for the example module.
|
||||
*/
|
||||
|
||||
|
||||
class KPLIB_cratefiller {
|
||||
idd = 758026;
|
||||
movingEnable = 0;
|
||||
|
||||
class controlsBackground {
|
||||
|
||||
class KPLIB_DialogTitle: KPGUI_PRE_DialogTitleS {
|
||||
text = "$STR_KPLIB_DIALOG_CRATEFILLER_TITLE";
|
||||
};
|
||||
|
||||
class KPLIB_DialogArea: KPGUI_PRE_DialogBackgroundS {};
|
||||
|
||||
// Crates
|
||||
|
||||
class KPLIB_TransportTitle: KPGUI_PRE_InlineTitle {
|
||||
text = "$STR_KPLIB_DIALOG_CRATEFILLER_TITLETRANSPORT";
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,1,2);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,0,48);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,2);
|
||||
h = KP_GETH(KP_HEIGHT_VAL_S,16);
|
||||
};
|
||||
|
||||
// Equipment
|
||||
|
||||
class KP_EquipmentTitle: KPLIB_TransportTitle {
|
||||
text = "$STR_KPLIB_DIALOG_CRATEFILLER_TITLEEQUIPMENT";
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,2);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,0,48);
|
||||
};
|
||||
|
||||
// Inventory
|
||||
|
||||
class KP_InventoryTitle: KPLIB_TransportTitle {
|
||||
text = "$STR_KPLIB_DIALOG_CRATEFILLER_TITLEINVENTORY";
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,5,48);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
class controls {
|
||||
|
||||
// Crates
|
||||
|
||||
class KPLIB_ComboCargo: KPGUI_PRE_Combo {
|
||||
idc = 75802;
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,1,2);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,3,48);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,(24/11));
|
||||
h = KP_GETH(KP_HEIGHT_VAL_S,24);
|
||||
tooltip = "$STR_KPLIB_DIALOG_CRATEFILLER_INVENTORY_TT";
|
||||
onLBSelChanged = "[] call KPLIB_fnc_cratefiller_showInventory";
|
||||
};
|
||||
|
||||
class KPLIB_RefreshCargo: KPGUI_PRE_CloseCross {
|
||||
text = "KPGUI\res\icon_refresh.paa";
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,23,24);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,3,48);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,24);
|
||||
h = KP_GETH(KP_HEIGHT_VAL_S,24);
|
||||
tooltip = "$STR_KPLIB_DIALOG_CRATEFILLER_REFRESH_TT";
|
||||
action = "[] call KPLIB_fnc_cratefiller_getNearStorages";
|
||||
};
|
||||
|
||||
// Equipment
|
||||
|
||||
class KPLIB_ComboEquipment: KPGUI_PRE_Combo {
|
||||
idc = 75810;
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,1);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,3,48);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,2);
|
||||
h = KP_GETH(KP_HEIGHT_VAL_S,24);
|
||||
tooltip = "$STR_KPLIB_DIALOG_CRATEFILLER_CATEGORY_TT";
|
||||
onLBSelChanged = "[] call KPLIB_fnc_cratefiller_createEquipmentList";
|
||||
};
|
||||
|
||||
class KPLIB_ComboWeapons: KPLIB_ComboEquipment {
|
||||
idc = 75811;
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,5,48);
|
||||
tooltip = "$STR_KPLIB_DIALOG_CRATEFILLER_WEAPONSELECTION_TT";
|
||||
onLBSelChanged = "[] call KPLIB_fnc_cratefiller_createSubList";
|
||||
};
|
||||
|
||||
class KPLIB_EquipmentList: KPGUI_PRE_ListBox {
|
||||
idc = 75812;
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,1);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,8,48);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,(16/7));
|
||||
h = KP_GETH(KP_HEIGHT_VAL_S,(48/38));
|
||||
};
|
||||
|
||||
class KPLIB_ButtonAddEquipment: KPGUI_PRE_InlineButton {
|
||||
text = "+ 1";
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,7,16);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,16,96);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,16);
|
||||
h = KP_GETH(KP_HEIGHT_VAL_S,(96/19));
|
||||
onButtonClick = "[1] call KPLIB_fnc_cratefiller_addEquipment";
|
||||
};
|
||||
|
||||
class KPLIB_ButtonAddEquipment5: KPLIB_ButtonAddEquipment {
|
||||
text = "+ 5";
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,35,96);
|
||||
onButtonClick = "[5] call KPLIB_fnc_cratefiller_addEquipment";
|
||||
};
|
||||
|
||||
class KPLIB_ButtonAddEquipment10: KPLIB_ButtonAddEquipment {
|
||||
text = "+ 10";
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,54,96);
|
||||
onButtonClick = "[10] call KPLIB_fnc_cratefiller_addEquipment";
|
||||
};
|
||||
|
||||
class KPLIB_ButtonAddEquipment20: KPLIB_ButtonAddEquipment {
|
||||
text = "+ 20";
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,73,96);
|
||||
onButtonClick = "[20] call KPLIB_fnc_cratefiller_addEquipment";
|
||||
};
|
||||
|
||||
// Inventory
|
||||
|
||||
class KPLIB_ExportName: KPGUI_PRE_EditBox {
|
||||
idc = 75820;
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,2,4);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,8,48);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,4);
|
||||
h = KP_GETH(KP_HEIGHT_VAL_S,24);
|
||||
tooltip = "$STR_KPLIB_DIALOG_CRATEFILLER_EXPORT_TT";
|
||||
};
|
||||
|
||||
class KPLIB_ImportName: KPGUI_PRE_Combo {
|
||||
idc = 75821;
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,3,4);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,8,48);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,4);
|
||||
h = KP_GETH(KP_HEIGHT_VAL_S,24);
|
||||
tooltip = "$STR_KPLIB_DIALOG_CRATEFILLER_IMPORT_TT";
|
||||
};
|
||||
|
||||
class KPLIB_ButtonExport: KPGUI_PRE_InlineButton {
|
||||
text = "Export";
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,2,4);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,10,48);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,4);
|
||||
h = KP_GETH(KP_HEIGHT_VAL_S,24);
|
||||
onButtonClick = "[] call KPLIB_fnc_cratefiller_export";
|
||||
};
|
||||
|
||||
class KPLIB_ButtonImport: KPLIB_ButtonExport {
|
||||
text = "Import";
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,3,4);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,(24/5));
|
||||
onButtonClick = "[] call KPLIB_fnc_cratefiller_import";
|
||||
};
|
||||
|
||||
class KPLIB_DeletePreset: KPGUI_PRE_CloseCross {
|
||||
text = "KPGUI\res\icon_recyclebin.paa";
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,23,24);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,10,48);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,24);
|
||||
h = KP_GETH(KP_HEIGHT_VAL_S,24);
|
||||
tooltip = "$STR_KPLIB_DIALOG_CRATEFILLER_DELETE_TT";
|
||||
action = "[] call KPLIB_fnc_cratefiller_deletePreset";
|
||||
};
|
||||
|
||||
class KPLIB_InventoryList: KPGUI_PRE_ListBox {
|
||||
idc = 75822;
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,8,16);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,12,48);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,(16/7));
|
||||
h = KP_GETH(KP_HEIGHT_VAL_S,(48/34));
|
||||
};
|
||||
|
||||
class KPLIB_ButtonRemoveEquipment: KPGUI_PRE_InlineButton {
|
||||
text = "- 1";
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,15,16);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,24,96);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,16);
|
||||
h = KP_GETH(KP_HEIGHT_VAL_S,(96/17));
|
||||
onButtonClick = "[1] call KPLIB_fnc_cratefiller_removeEquipment";
|
||||
};
|
||||
|
||||
class KPLIB_ButtonRemoveEquipment5: KPLIB_ButtonRemoveEquipment {
|
||||
text = "- 5";
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,41,96);
|
||||
onButtonClick = "[5] call KPLIB_fnc_cratefiller_removeEquipment";
|
||||
};
|
||||
|
||||
class KPLIB_ButtonRemoveEquipment10: KPLIB_ButtonRemoveEquipment {
|
||||
text = "- 10";
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,58,96);
|
||||
onButtonClick = "[10] call KPLIB_fnc_cratefiller_removeEquipment";
|
||||
};
|
||||
|
||||
class KPLIB_ButtonRemoveEquipmentClear: KPLIB_ButtonRemoveEquipment {
|
||||
text = "Clear";
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,75,96);
|
||||
onButtonClick = "[0] call KPLIB_fnc_cratefiller_removeEquipment";
|
||||
};
|
||||
|
||||
class KPLIB_ProgressBar : KPGUI_PRE_ProgressBar {
|
||||
idc = 75823;
|
||||
x = KP_GETCX(KP_X_VAL_S,KP_WIDTH_VAL_S,0,1);
|
||||
y = KP_GETCY(KP_Y_VAL_S,KP_HEIGHT_VAL_S,46,48);
|
||||
w = KP_GETW(KP_WIDTH_VAL_S,1);
|
||||
h = KP_GETH(KP_HEIGHT_VAL_S,24);
|
||||
tooltip = "$STR_KPLIB_DIALOG_CRATEFILLER_FILLLEVEL_TT"
|
||||
};
|
||||
|
||||
class KP_DialogCross: KPGUI_PRE_DialogCrossS {};
|
||||
|
||||
};
|
||||
|
||||
};
|
|
@ -43,6 +43,7 @@ With these additions the intended complexity comes into the mission. It is highl
|
|||
23 Logistic
|
||||
24 Enemy Commander
|
||||
25 Friendly Commander Managing Dialog
|
||||
26 Cratefiller
|
||||
```
|
||||
### TBA
|
||||
Mod specific compatibility modules
|
||||
|
|
|
@ -897,8 +897,8 @@
|
|||
<German>Vorratsstand:</German>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_RESUPPLY_AMMOSTATE">
|
||||
<English>%1 empty or used from %2</English>
|
||||
<German>%1 leer oder angebrochen von %2</German>
|
||||
<English>%1 from %2 magazines full</English>
|
||||
<German>%1 von %2 Magazinen voll</German>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_RESUPPLY_FUELSTATE">
|
||||
<English>%1 from %2 gallons left</English>
|
||||
|
@ -940,6 +940,103 @@
|
|||
<English>Total costs:</English>
|
||||
<German>Gesamtkosten:</German>
|
||||
</Key>
|
||||
|
||||
<!-- CRATEFILLER DIALOG -->
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_LISTWEAPONS">
|
||||
<English>Weapons</English>
|
||||
<German>Waffen</German>
|
||||
<Polish>Bronie</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_LISTMAGAZINES">
|
||||
<English>Magazines</English>
|
||||
<German>Magazine</German>
|
||||
<Polish>Magazynki</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_LISTATTACHMENTS">
|
||||
<English>Weapon attachments</English>
|
||||
<German>Waffenzubehör</German>
|
||||
<Polish>Akcesoria do broni</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_LISTGRENADES">
|
||||
<English>Grenades</English>
|
||||
<German>Granaten</German>
|
||||
<Polish>Granaty</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_LISTEXPLOSIVES">
|
||||
<English>Explosives</English>
|
||||
<German>Sprengstoffe</German>
|
||||
<Polish>Ładunki wybuchowe</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_LISTVARIOUS">
|
||||
<English>Others</English>
|
||||
<German>Sonstiges</German>
|
||||
<Polish>Inne</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_LISTBACKPACKS">
|
||||
<English>Backpacks</English>
|
||||
<German>Rucksäcke</German>
|
||||
<Polish>Plecaki</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_TITLE">
|
||||
<English>KP Cratefiller</English>
|
||||
<German>KP Kistenfüller</German>
|
||||
<Polish>KP Cratefiller</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_TITLETRANSPORT">
|
||||
<English>Transport medium</English>
|
||||
<German>Transportmedium</German>
|
||||
<Polish>Środek transportu</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_TITLEEQUIPMENT">
|
||||
<English>Equipment</English>
|
||||
<German>Ausrüstung</German>
|
||||
<Polish>Ekwipunek</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_TITLEINVENTORY">
|
||||
<English>Inventory</English>
|
||||
<German>Inventar</German>
|
||||
<Polish>Ekwipunek</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_INVENTORY_TT">
|
||||
<English>Select an inventory that you want to edit.</English>
|
||||
<German>Wähle einen Laderaum aus, den du bearbeiten möchtest.</German>
|
||||
<Polish>Wybierz ekwipunek który chcesz edytować.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_REFRESH_TT">
|
||||
<English>Search for new inventories.</English>
|
||||
<German>Nach neuem Laderaum suchen.</German>
|
||||
<Polish>Szukaj nowych ekwipunków.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_CATEGORY_TT">
|
||||
<English>Choose a category from which you want to stow items.</English>
|
||||
<German>Wähle eine Kategorie aus, von der du Gegenstände verladen willst.</German>
|
||||
<Polish>Wybierz kategorie z której chcesz pobrać przedmioty.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_WEAPONSELECTION_TT">
|
||||
<English>Choose a weapon to find the right magazines or attachments.</English>
|
||||
<German>Wähle eine Waffe um die passenden Magazine oder Zubehör zu finden.</German>
|
||||
<Polish>Wybierz broń do której mają być wyszukane magazynki oraz dodatki.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_EXPORT_TT">
|
||||
<English>Enter the name of the preset to be exported.</English>
|
||||
<German>Trage den Namen für das zu exportierende Ausrüstungsset ein.</German>
|
||||
<Polish>Wpisz nazwę szablonu do wyeksportowania.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_IMPORT_TT">
|
||||
<English>Select the preset to be imported.</English>
|
||||
<German>Wähle das zu importierende Ausrüstungsset.</German>
|
||||
<Polish>Wybierz szablon do zaimportowania.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_DELETE_TT">
|
||||
<English>Deletes the selected preset.</English>
|
||||
<German>Löscht das ausgewählte Ausrüstungsset.</German>
|
||||
<Polish>Usuwa wybrany szablon.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_DIALOG_CRATEFILLER_FILLLEVEL_TT">
|
||||
<English>Shows the current cargo space.</English>
|
||||
<German>Zeigt den aktuellen Laderaumstand.</German>
|
||||
<Polish>Pokazuje aktualny stan załadunku.</Polish>
|
||||
</Key>
|
||||
</Package>
|
||||
|
||||
|
||||
|
@ -1008,6 +1105,58 @@
|
|||
<Italian>Mancano ancora %1 minuti al respawn.</Italian>
|
||||
<Portuguese>Falta(m) %1 minuto(s) de tempo de espera do respawn móvel.</Portuguese>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_HINT_NOTENOUGHSTORAGE">
|
||||
<English>Not enough storage space left.</English>
|
||||
<German>Nicht genügend freie Lagerplätze vorhanden.</German>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_HINT_NOTENOUGHRESOURCES">
|
||||
<English>Not enough resources available.</English>
|
||||
<German>Nicht genügend Ressourcen vorhanden.</German>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_HINT_VEHICLECHANGES">
|
||||
<English>Vehicle state changed, refresh your selection to try again.</English>
|
||||
<German>Fahrzeugzustand hat sich geändert. Aktualisiere deine Auswahl und versuche es erneut.</German>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_HINT_RANGE">
|
||||
<English>Selected transport medium is out of range.</English>
|
||||
<German>Ausgewähltes Transportmedium ist außer Reichweite.</German>
|
||||
<Polish>Wybrany środek transportu jest poza zasięgiem.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_HINT_FULL">
|
||||
<English>The selected storage doesn't have sufficient space.</English>
|
||||
<German>Der ausgewählte Laderaum hat keinen ausreichenden Platz.</German>
|
||||
<Polish>Wybrany kontener nie ma dość wolnego miejsca.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_HINT_ADDED">
|
||||
<English>%1 was loaded %2 times.</English>
|
||||
<German>%1 wurde %2 mal geladen.</German>
|
||||
<Polish>%1 zostało załadowane %2 razy.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_HINT_SELECTION">
|
||||
<English>Incomplete selection.</English>
|
||||
<German>Unvollständige Auswahl.</German>
|
||||
<Polish>Niepełny wybór.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_HINT_NAME">
|
||||
<English>Invalid name.</English>
|
||||
<German>Ungültiger Name.</German>
|
||||
<Polish>Nieprawidłowa nazwa.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_HINT_NOSTORAGE">
|
||||
<English>No storage selected.</English>
|
||||
<German>Kein Laderaum ausgewählt.</German>
|
||||
<Polish>Nie wybrano skrzyni.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_HINT_CLEARFULL">
|
||||
<English>Selected storage is emptied.</English>
|
||||
<German>Ausgewählter Laderaum wurde geleert.</German>
|
||||
<Polish>Wybrana skrzynia została opróżniona.</Polish>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_HINT_UNLOAD">
|
||||
<English>%1 was unloaded %2 times.</English>
|
||||
<German>%1 wurde %2 mal entladen.</German>
|
||||
<Polish>%1 zostało wyładowane %2 razy.</Polish>
|
||||
</Key>
|
||||
</Package>
|
||||
|
||||
|
||||
|
@ -1539,6 +1688,20 @@
|
|||
<English>Defines the price of 1000 fuel cargo for ACE refuel vehicles.</English>
|
||||
<German>Definiert die Kosten für 1000 Treibstoffvorrat für ein ACE Tank Fahrzeug.</German>
|
||||
</Key>
|
||||
|
||||
<!-- CRATEFILLER CATEGORY -->
|
||||
<Key ID="STR_KPLIB_SETTINGS_CRATEFILLER">
|
||||
<English>KPLIB - Cratefiller</English>
|
||||
<German>KPLIB - Kistenfüller</German>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_SETTINGS_CRATEFILLER_ACTIVATE">
|
||||
<English>Enable Cratefiller</English>
|
||||
<German>Kistenfüller aktivieren</German>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_SETTINGS_CRATEFILLER_ACTIVATE_TT">
|
||||
<English>Enables/Disables the Liberation cratefiller.</English>
|
||||
<German>Aktiviert/Deaktiviert den Liberation Kistenfüller.</German>
|
||||
</Key>
|
||||
</Package>
|
||||
|
||||
|
||||
|
@ -1683,6 +1846,10 @@
|
|||
<English>Resupply</English>
|
||||
<German>Versorgung</German>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_LOGISTIC_CRATEFILLER">
|
||||
<English>Cratefiller</English>
|
||||
<German>Kistenfüller</German>
|
||||
</Key>
|
||||
</Package>
|
||||
|
||||
<!-- PERMISSIONS -->
|
||||
|
@ -1720,6 +1887,10 @@
|
|||
<English>Resupply</English>
|
||||
<German>Nachschub</German>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_PERMISSION_CRATEFILLER">
|
||||
<English>Cratefiller</English>
|
||||
<German>Kistenfüller</German>
|
||||
</Key>
|
||||
<Key ID="STR_KPLIB_PERMISSION_GROUPMISC">
|
||||
<English>-- Miscellaneous --</English>
|
||||
<German>-- Sonstiges --</German>
|
||||
|
|
Loading…
Reference in New Issue