-
-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #581 from KillahPotatoes/v0.97S11-569
Logistic module pt. 2
- Loading branch information
Showing
58 changed files
with
2,199 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Missionframework/modules/01_common/fnc/fn_common_cameraCircleTarget.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
Missionframework/modules/10_resources/fnc/fn_res_refund.sqf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.