Initial upload. Not currently functional as a mod. Includes some slightly refactored source code as well as the original mission this was debuted in zipped up as reference + example of usage.

This commit is contained in:
Clarky committed 2026-08-08 17:42:15 +10:00
commit 75b737230e
32 files changed
+2049

No files matched your search

+65
View File
@@ -0,0 +1,65 @@
/*
Author: Clarky
Usage:
[this, 1000, 0, false, 0] call CLF_fnc_initSupplyDepot;
Intended to run on the server, which calls a CBA event handler that runs a client-level script for adding relevant interactions
*/
params [["_hq", "", ["", objNull]], "_depot", "_maxMateriel", "_currentMateriel", "_isGenerator", "_materielRate"];
_depot setVariable ["isSupplyDepot", true, true];
_depot setVariable ["maxMateriel", _maxMateriel, true];
_depot setVariable ["currentMateriel", _currentMateriel, true];
_depot setVariable ["isGenerator", _isGenerator, true];
_depot setVariable ["materielRate", _materielRate, true];
if (_hq isNotEqualTo "") then {
_depot setVariable ["hq", _hq, true];
private _baseDetails = _hq getVariable "baseDetails";
private _depots = _baseDetails get "depots";
_depots pushBack _depot;
//_hq setVariable ["baseDetails", _baseDetails];
};
[_depot] remoteExecCall [
"CLF_fnc_initSupplyDepotInteractions",
0,
true
];
if (_depot getVariable "isGenerator") then {
[_depot, _materielRate] spawn {
params ["_depot", "_materielRate"];
while {alive _depot} do {
private _depotCurrent =
_depot getVariable "currentMateriel";
private _depotMax =
_depot getVariable "maxMateriel";
private _freeSpace =
_depotMax - _depotCurrent;
private _amount =
(_materielRate min _freeSpace);
_depot setVariable [
"currentMateriel",
_depotCurrent + _amount,
true
];
sleep 30;
};
};
};
/*
[
"CLF_SupplyDepotCreated",
[_depot]
] call CBA_fnc_globalEventJIP;
*/