Skip to content

Commit

Permalink
Merge pull request #581 from KillahPotatoes/v0.97S11-569
Browse files Browse the repository at this point in the history
Logistic module pt. 2
  • Loading branch information
Wyqer authored Apr 7, 2019
2 parents da47705 + 4ab38d5 commit d7a1fc8
Show file tree
Hide file tree
Showing 58 changed files with 2,199 additions and 105 deletions.
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"_thisType",
"BIS_fnc_reviveInit",
"CBA_Settings_fnc_init",
"CBA_fnc_compatibleMagazines",
"CBA_fnc_notify",
"KPLIB_eden_boxspawn",
"KPLIB_eden_potatospawn",
Expand All @@ -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",
Expand Down
45 changes: 43 additions & 2 deletions Missionframework/KPGUI/KPGUI_classes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 ---
*/
Expand Down
13 changes: 12 additions & 1 deletion Missionframework/KPGUI/KPGUI_defines.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 added Missionframework/KPGUI/res/icon_help.paa
Binary file not shown.
Binary file added Missionframework/KPGUI/res/icon_recyclebin.paa
Binary file not shown.
4 changes: 2 additions & 2 deletions Missionframework/KPLIB_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
};
3 changes: 2 additions & 1 deletion Missionframework/KPLIB_ui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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"
9 changes: 9 additions & 0 deletions Missionframework/modules/01_common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions Missionframework/modules/01_common/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};

Expand Down
79 changes: 79 additions & 0 deletions Missionframework/modules/10_resources/fnc/fn_res_refund.sqf
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion Missionframework/modules/10_resources/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 {};

Expand Down
6 changes: 6 additions & 0 deletions Missionframework/modules/11_permission/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
[
Expand Down
Loading

0 comments on commit d7a1fc8

Please sign in to comment.