Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logistic module pt. 2 #581

Merged
merged 29 commits into from
Apr 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
95a1ff2
Outsourced the camera feature to an own function
Dubjunk Mar 30, 2019
b713dc8
added resource check to the recycle function
Dubjunk Mar 31, 2019
3814f13
file header
Dubjunk Mar 31, 2019
9c401d9
some code tweaks and smaller changes
Dubjunk Apr 1, 2019
6bafd6d
implemented the resource pay on resupply
Dubjunk Apr 3, 2019
ebcef1d
several code optimizations
Dubjunk Apr 3, 2019
e26f87d
Added pre check for changed vehicle values
Dubjunk Apr 4, 2019
b7410df
Basic module implementation
Dubjunk Apr 5, 2019
01a488c
some more work on the dialog
Dubjunk Apr 5, 2019
8ef2499
some basic cratefiller functions
Dubjunk Apr 5, 2019
1775f00
ReadMe
Dubjunk Apr 5, 2019
1dfb042
setting to disable the cratefiller
Dubjunk Apr 6, 2019
c81f601
some tweaks
Dubjunk Apr 6, 2019
87a5606
added some more functions
Dubjunk Apr 6, 2019
0f2a07c
almost fully implemented the CF
Dubjunk Apr 6, 2019
49071d6
export / import functions
Dubjunk Apr 6, 2019
478ebe3
Added stringtable entries
Dubjunk Apr 6, 2019
6df7ec0
Merge branch 'v0.97S11' into v0.97S11-569
Dubjunk Apr 7, 2019
e7d175a
Update Missionframework/stringtable.xml
Wyqer Apr 7, 2019
191a76b
Update Missionframework/stringtable.xml
Wyqer Apr 7, 2019
72682fc
Update Missionframework/stringtable.xml
Wyqer Apr 7, 2019
5a01320
Update Missionframework/stringtable.xml
Wyqer Apr 7, 2019
d93e7a1
Update Missionframework/stringtable.xml
Wyqer Apr 7, 2019
e242732
Update Missionframework/stringtable.xml
Wyqer Apr 7, 2019
a2539c8
Suggestions by @Wyqer
Dubjunk Apr 7, 2019
ea58027
Merge branch 'v0.97S11-569' of https://github.com/KillahPotatoes/KP-L…
Dubjunk Apr 7, 2019
acd28d5
Update Missionframework/modules/10_resources/fnc/fn_res_refund.sqf
Wyqer Apr 7, 2019
b557300
Merge branch 'v0.97S11' into v0.97S11-569
Wyqer Apr 7, 2019
4ab38d5
Merge branch 'v0.97S11' into v0.97S11-569
Wyqer Apr 7, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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