From c5755fb2597d63caf06230a8d5a2626c3e671ce6 Mon Sep 17 00:00:00 2001 From: Clarky77 Date: Fri, 28 Aug 2026 18:14:49 +1000 Subject: [PATCH] First module appearing in 3den (not zeus yet). Created custom PREP macros for compiling functions similar to CBA/ACE. --- Addons/logistics.pbo | Bin 0 -> 48135 bytes Addons/logistics/$PBOPREFIX$ | 1 + Addons/logistics/CfgEditorSubcategories.hpp | 7 + Addons/logistics/CfgEventHandlers.hpp | 8 + Addons/logistics/CfgModuleCategories.hpp | 11 + Addons/logistics/XEH_PREP.hpp | 31 ++ Addons/logistics/XEH_postInit.sqf | 1 + Addons/logistics/XEH_preInit.sqf | 51 ++++ Addons/logistics/XEH_preStart.sqf | 4 + Addons/logistics/cfgFunctions.hpp | 40 +++ Addons/logistics/cfgVehicles.hpp | 75 +++++ Addons/logistics/config.cpp | 32 +- Addons/logistics/fn_template.sqf | 16 + .../functions/fn_vehicleLoadMateriel.sqf | 88 ++++++ .../logistics/functions/fn_vehicleLoadOre.sqf | 88 ++++++ .../functions/fn_vehicleUnloadMateriel.sqf | 93 ++++++ .../functions/fn_vehicleUnloadOre.sqf | 93 ++++++ .../functions/init/fn_initEngineeringBay.sqf | 43 +++ .../fn_initEngineeringBayInteractions.sqf | 33 ++ .../logistics/functions/init/fn_initFOB.sqf | 56 ++++ .../functions/init/fn_initFOBInteractions.sqf | 32 ++ .../functions/init/fn_initFactory.sqf | 130 ++++++++ .../init/fn_initFactoryInteractions.sqf | 55 ++++ Addons/logistics/functions/init/fn_initHQ.sqf | 96 ++++++ .../functions/init/fn_initHQInteractions.sqf | 79 +++++ .../functions/init/fn_initMaterielDepot.sqf | 83 +++++ .../init/fn_initMaterielDepotInteractions.sqf | 58 ++++ .../functions/init/fn_initOreDepot.sqf | 83 +++++ .../init/fn_initOreDepotInteractions.sqf | 58 ++++ .../functions/init/fn_initSupplyVehicle.sqf | 33 ++ .../init/fn_initSupplyVehicleInteractions.sqf | 287 ++++++++++++++++++ .../modules/fn_moduleInitEngineeringBay.sqf | 0 .../functions/modules/fn_moduleInitFOB.sqf | 0 .../modules/fn_moduleInitFactory.sqf | 0 .../functions/modules/fn_moduleInitHQ.sqf | 13 + .../modules/fn_moduleInitMaterielDepot.sqf | 0 .../modules/fn_moduleInitOreDepot.sqf | 0 .../modules/fn_moduleInitSupplyVehicle.sqf | 0 Addons/logistics/initSettings.inc.sqf | 13 + Addons/logistics/script_component.hpp | 2 +- Addons/logistics/script_macros.hpp | 14 + Addons/logistics/script_mod.hpp | 5 +- 42 files changed, 1805 insertions(+), 7 deletions(-) create mode 100644 Addons/logistics.pbo create mode 100644 Addons/logistics/$PBOPREFIX$ create mode 100644 Addons/logistics/CfgEditorSubcategories.hpp create mode 100644 Addons/logistics/CfgEventHandlers.hpp create mode 100644 Addons/logistics/CfgModuleCategories.hpp create mode 100644 Addons/logistics/XEH_PREP.hpp create mode 100644 Addons/logistics/XEH_postInit.sqf create mode 100644 Addons/logistics/XEH_preStart.sqf create mode 100644 Addons/logistics/fn_template.sqf create mode 100644 Addons/logistics/functions/fn_vehicleLoadMateriel.sqf create mode 100644 Addons/logistics/functions/fn_vehicleLoadOre.sqf create mode 100644 Addons/logistics/functions/fn_vehicleUnloadMateriel.sqf create mode 100644 Addons/logistics/functions/fn_vehicleUnloadOre.sqf create mode 100644 Addons/logistics/functions/init/fn_initEngineeringBay.sqf create mode 100644 Addons/logistics/functions/init/fn_initEngineeringBayInteractions.sqf create mode 100644 Addons/logistics/functions/init/fn_initFOB.sqf create mode 100644 Addons/logistics/functions/init/fn_initFOBInteractions.sqf create mode 100644 Addons/logistics/functions/init/fn_initFactory.sqf create mode 100644 Addons/logistics/functions/init/fn_initFactoryInteractions.sqf create mode 100644 Addons/logistics/functions/init/fn_initHQ.sqf create mode 100644 Addons/logistics/functions/init/fn_initHQInteractions.sqf create mode 100644 Addons/logistics/functions/init/fn_initMaterielDepot.sqf create mode 100644 Addons/logistics/functions/init/fn_initMaterielDepotInteractions.sqf create mode 100644 Addons/logistics/functions/init/fn_initOreDepot.sqf create mode 100644 Addons/logistics/functions/init/fn_initOreDepotInteractions.sqf create mode 100644 Addons/logistics/functions/init/fn_initSupplyVehicle.sqf create mode 100644 Addons/logistics/functions/init/fn_initSupplyVehicleInteractions.sqf create mode 100644 Addons/logistics/functions/modules/fn_moduleInitEngineeringBay.sqf create mode 100644 Addons/logistics/functions/modules/fn_moduleInitFOB.sqf create mode 100644 Addons/logistics/functions/modules/fn_moduleInitFactory.sqf create mode 100644 Addons/logistics/functions/modules/fn_moduleInitHQ.sqf create mode 100644 Addons/logistics/functions/modules/fn_moduleInitMaterielDepot.sqf create mode 100644 Addons/logistics/functions/modules/fn_moduleInitOreDepot.sqf create mode 100644 Addons/logistics/functions/modules/fn_moduleInitSupplyVehicle.sqf create mode 100644 Addons/logistics/initSettings.inc.sqf diff --git a/Addons/logistics.pbo b/Addons/logistics.pbo new file mode 100644 index 0000000000000000000000000000000000000000..65d696575f29b1a5c9485f9b641e4b7663bc24a7 GIT binary patch literal 48135 zcmeHw&2Jn@mS20l>)8?@EMOn(i{a?%=@r>ak(Ah)UaKX|7RjPm)BF;PRQC)?)F!L4 z$fSyu)tOlm*&H1fnDx4SFt%Y}Z0x~fU>C6c57=Ya@WF>&7`87y`{IKS>w_=en=k&o z_aY)Av$8%Yk=^PZ2`zP2WWGQ-Yj+#;|7!Or==y#XbdMIj^V#_GHbeczuM6-8fBDBJ z^gK!9S~u|{Px`Qc{`ap5pub)F@`Rp?0j+E<+7^F9cfE?P>3L|2!v6lvUz7g+`TzRa z2|W*K4K%|j9qv~*rPVU}r00>X3j6(YJ@eT`P3dyx{#PgTJgh-s zZ{Pb3Y5Wm-qvztr>mC*)@H@+XFHCI5f1x}6yBI4yPtdjyhdzqIJkAr5%x1;})zb-TPeRNOH6SOVF z;V<74IKMpj*$F+Ta8AQkzvIWW!Q`<$3I+C3M-Sqr_E8GUQ}1 zy49DTe0f68OYNg-D*)T8_Ya%k3`Ze&Lp*!j>oN2{)U(lB{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!h-KYz&K z3X~F|KG=fRP2Vb!H`Z<|>-Sve6aQS*mLF0apg|TJ95^dM6ekF)A{RqP+1wV~3LZAR zJASmgwTzIkTCYBsGey!j)uKNSRw5vssi;eG_3AKaau7{Xu4XL(US8Mj+Z5$$ZiRUy zb;&@zDCxuXANwxQtTmZE{K#TpigGm{`!LrssOpkjy-z|!_A>Q!Nv__H;C1Qd z@U&&Qx=Y7UHnT%AMa4Da;I!vXfUeEOxfVP9=vi*HOi`}p?z0FgQf{`=!nF2-Igp~E r+&N9UMBj6oz#qNy{|^4vrx)ix{L`~v{=0);{^wu(-_Fb5`0xK8lei?2 literal 0 HcmV?d00001 diff --git a/Addons/logistics/$PBOPREFIX$ b/Addons/logistics/$PBOPREFIX$ new file mode 100644 index 0000000..d5220d8 --- /dev/null +++ b/Addons/logistics/$PBOPREFIX$ @@ -0,0 +1 @@ +z\clf\addons\logistics \ No newline at end of file diff --git a/Addons/logistics/CfgEditorSubcategories.hpp b/Addons/logistics/CfgEditorSubcategories.hpp new file mode 100644 index 0000000..16b3c53 --- /dev/null +++ b/Addons/logistics/CfgEditorSubcategories.hpp @@ -0,0 +1,7 @@ +/* +class CfgEditorSubcategories { + class GVAR(subcategory) { + displayName = CSTRING(Category_Logistics); + }; +}; +*/ \ No newline at end of file diff --git a/Addons/logistics/CfgEventHandlers.hpp b/Addons/logistics/CfgEventHandlers.hpp new file mode 100644 index 0000000..9b0c4a6 --- /dev/null +++ b/Addons/logistics/CfgEventHandlers.hpp @@ -0,0 +1,8 @@ +class Extended_PreInit_EventHandlers +{ + class CLF_PreInit + { + // init = "call compile preprocessFileLineNumbers 'logistics\\XEH_preInit.sqf'"; + init = QUOTE(call COMPILE_SCRIPT(XEH_preInit)); + } +} \ No newline at end of file diff --git a/Addons/logistics/CfgModuleCategories.hpp b/Addons/logistics/CfgModuleCategories.hpp new file mode 100644 index 0000000..e982328 --- /dev/null +++ b/Addons/logistics/CfgModuleCategories.hpp @@ -0,0 +1,11 @@ +class CfgFactionClasses { + class NO_CATEGORY; + class CLF: NO_CATEGORY { + displayName = "Clarkson's Logi"; + priority = 2; + side = 7; + }; + //class CLF_Logistics: CLF { + // displayName = "CLF - Logistics"; + //}; +}; \ No newline at end of file diff --git a/Addons/logistics/XEH_PREP.hpp b/Addons/logistics/XEH_PREP.hpp new file mode 100644 index 0000000..1fd5a99 --- /dev/null +++ b/Addons/logistics/XEH_PREP.hpp @@ -0,0 +1,31 @@ + +// Root folder functions +PREP(vehicleLoadMateriel); +PREP(vehicleLoadOre); +PREP(vehicleUnloadMateriel); +PREP(vehicleUnloadOre); + +// Init folder functions +PREP_S(initEngineeringBay,init) +PREP_S(initEngineeringBayInteractions,init) +PREP_S(initFactory,init) +PREP_S(initFactoryInteractions,init) +PREP_S(initFOB,init) +PREP_S(initFOBInteractions,init) +PREP_S(initHQ,init) +PREP_S(initHQInteractions,init) +PREP_S(initMaterielDepot,init) +PREP_S(initMaterielDepotInteractions,init) +PREP_S(initOreDepot,init) +PREP_S(initOreDepotInteractions,init) +PREP_S(initSupplyVehicle,init) +PREP_S(initSupplyVehicleInteractions,init) + +// Module folder functions +PREP_S(moduleInitEngineeringBay,modules) +PREP_S(moduleInitFactory,modules) +PREP_S(moduleInitFOB,modules) +PREP_S(moduleInitHQ,modules) +PREP_S(moduleInitMaterielDepot,modules) +PREP_S(moduleInitOreDepot,modules) +PREP_S(moduleInitSupplyVehicle,modules) diff --git a/Addons/logistics/XEH_postInit.sqf b/Addons/logistics/XEH_postInit.sqf new file mode 100644 index 0000000..84f2529 --- /dev/null +++ b/Addons/logistics/XEH_postInit.sqf @@ -0,0 +1 @@ +#include "script_component.hpp" \ No newline at end of file diff --git a/Addons/logistics/XEH_preInit.sqf b/Addons/logistics/XEH_preInit.sqf index e69de29..5ae1813 100644 --- a/Addons/logistics/XEH_preInit.sqf +++ b/Addons/logistics/XEH_preInit.sqf @@ -0,0 +1,51 @@ +#include "script_component.hpp" +/* +// Example -- Registering a CBA Setting or compiling functions +[ + "My_Setting_Name", + "CHECKBOX", + ["My Setting", "Tooltip description"], + "My Category", + false, + 1, + {params ["_value"];} +] call CBA_settings_fnc_init; +*/ + +// Setting up for auto-naming of new bases etc. in mission +GVAR(baseNames) = [ + "Alpha", + "Bravo", + "Charlie", + "Delta", + "Echo", + "Foxtrot", + "Golf", + "Hotel", + "India", + "Jericho", + "Kilo", + "Lima", + "Mike", + "November", + "Oscar", + "Papa", + "Quebec", + "Romeo", + "Sierra", + "Tango", + "Uniform", + "Victor", + "Whiskey", + "X-ray", + "Yankee", + "Zulu" +]; + +// Initialise base indices for auto-assigning new base names +GVAR(bluforBaseIndex) = 0; +GVAR(opforBaseIndex) = 0; +GVAR(independentBaseIndex) = 0; +GVAR(civilianBaseIndex) = 0; + +#include "initSettings.inc.sqf" \ No newline at end of file diff --git a/Addons/logistics/XEH_preStart.sqf b/Addons/logistics/XEH_preStart.sqf new file mode 100644 index 0000000..76b104a --- /dev/null +++ b/Addons/logistics/XEH_preStart.sqf @@ -0,0 +1,4 @@ +#include "script_component.hpp" + +#include "XEH_PREP.hpp" + diff --git a/Addons/logistics/cfgFunctions.hpp b/Addons/logistics/cfgFunctions.hpp index e69de29..5efe153 100644 --- a/Addons/logistics/cfgFunctions.hpp +++ b/Addons/logistics/cfgFunctions.hpp @@ -0,0 +1,40 @@ + +/* +class CfgFunctions +{ + class CLF + { + tag = "CLF"; + + class LogisticsFunctions + { + file = "logistics\functions"; + + class vehicleLoadMateriel {}; + class vehicleLoadOre {}; + class vehicleUnloadMateriel {}; + class vehicleUnloadOre {}; + }; + class LogisticsInitFunctions + { + file = "logistics\functions\init"; + + class initEngineeringBay {}; + class initEngineeringBayInteractions {}; + class initFactory {}; + class initFactoryInteractions {}; + class initFOB {}; + class initFOBInteractions {}; + class initHQ {}; + class initHQInteractions {}; + class initMaterielDepot {}; + class initMaterielDepotInteractions {}; + class initOreDepot {}; + class initOreDepotInteractions {}; + class initSupplyVehicle {}; + class initSupplyVehicleInteractions {}; + }; + }; +}; + +*/ \ No newline at end of file diff --git a/Addons/logistics/cfgVehicles.hpp b/Addons/logistics/cfgVehicles.hpp index e69de29..ab6dc08 100644 --- a/Addons/logistics/cfgVehicles.hpp +++ b/Addons/logistics/cfgVehicles.hpp @@ -0,0 +1,75 @@ +class CfgVehicles +{ + // Declaring custom zeus/3den modules + class Logic; + class Module_F: Logic + { + class AttributesBase + { + class Default; + class Edit; + class Combo; + class Checkbox; + class ModuleDescription; + class Units; + }; + + // Description base classes (for more information see below): + class ModuleDescription + { + class Anything; + }; + }; + + // Base module class for any initialisation modules + class CLF_Init_Base: Module_F + { + scope = 2; + scopeCurator = 2; + isGlobal = 0; + isTriggerActivated = 1; + isDisposable = 1; + // is3DEN = 1; + curatorCanAttach = 1; + canSetArea = 0; // Allows for setting the area values in the Attributes menu in 3DEN + canSetAreaShape = 0; // Allows for setting "Rectangle" or "Ellipse" in Attributes menu in 3DEN + canSetAreaHeight = 0; // Allows for setting height or Z value in Attributes menu in 3DEN + }; + + class CLF_Init_HQ: CLF_Init_Base + { + author = "Clarky"; + displayName = "Initialise HQ"; + //icon = ""; + category = "CLF" + function = FUNC(moduleInitHQ); + functionPriority = 1; + + class Attributes : AttributesBase + { + class Side: Combo + { + displayName = "HQ Team"; + property = "CLF_Module_Base_Side"; + typeName = "STRING"; + tooltip = "Which team this object will be assigned to."; + defaultValue = 1; + + class Values + { + class westSide { name = "$STR_WEST"; value = 1; }; + class eastSide { name = "$STR_east"; value = 2; }; + class indSide { name = "$STR_guerrila"; value = 3; }; + class civSide { name = "$STR_civilian"; value = 4; } + }; + }; + + class ModuleDescription : ModuleDescription {}; + }; + + class ModuleDescription : ModuleDescription + { + description = "Initialises HQ object for given side." + }; + }; +}; diff --git a/Addons/logistics/config.cpp b/Addons/logistics/config.cpp index 01e2727..64d66de 100644 --- a/Addons/logistics/config.cpp +++ b/Addons/logistics/config.cpp @@ -1,17 +1,39 @@ +#include "script_component.hpp" class CfgPatches { class ClarkonsLogisticsFramework { - units[] = ; + units[] = { /*CLF_Init_Base*/ }; weapons[] = {}; - requiredVersion = 2.22; - requiredAddons[] = {"cba_main"}; + requiredVersion = REQUIRED_VERSION; + requiredAddons[] = { + "cba_main", + "cba_xeh" + }; author = "Clarky"; + VERSION_CONFIG; }; }; -#include "cfgFunctions.hpp" -#include "cfgVehicles.hpp" +/* +class CfgMods { + class PREFIX { + dir = "@ace"; + name = "Advanced Combat Environment 3"; + picture = "A3\Ui_f\data\Logos\arma3_expansion_alpha_ca"; + hidePicture = "true"; + hideName = "true"; + actionName = "Website"; + action = CSTRING(URL); + description = "Issue Tracker: https://github.com/acemod/ACE3/issues"; + }; +}; +*/ + +#include "CfgEventHandlers.hpp" +#include "CfgFunctions.hpp" +#include "CfgVehicles.hpp" +#include "CfgModuleCategories.hpp" // #include "ui\gui.hpp" \ No newline at end of file diff --git a/Addons/logistics/fn_template.sqf b/Addons/logistics/fn_template.sqf new file mode 100644 index 0000000..559e7ff --- /dev/null +++ b/Addons/logistics/fn_template.sqf @@ -0,0 +1,16 @@ +/* + * Author: Clarky + * Description: + * Describe the function + * + * Arguments: + * 0: Object + * 1: Integer + * + * Usage: + * [_object, _integer] call CLF_fnc_template + * + */ + + params ["_object", "_integer"]; + diff --git a/Addons/logistics/functions/fn_vehicleLoadMateriel.sqf b/Addons/logistics/functions/fn_vehicleLoadMateriel.sqf new file mode 100644 index 0000000..1e8d64e --- /dev/null +++ b/Addons/logistics/functions/fn_vehicleLoadMateriel.sqf @@ -0,0 +1,88 @@ +/* + Author: Clarky + Usage: + [ + "CLRK_fnc_VehicleLoaded", + [_target, _caller, _depot] + ] call CBA_fnc_serverEvent; + + Intended to be run by an event handler call from a vehicle load action from a player on a valid supply vehicle + +*/ + +params ["_vehicle", "_player", "_depot"]; + +if (!isServer) exitWith {}; + +if (isNull _vehicle) exitWith {hint "Vehicle ain't exist";}; +if (isNull _player) exitWith {hint "Player ain't exist";}; +if (isNull _depot) exitWith {hint "Depot ain't exist";}; + +if !(_vehicle getVariable ["isSupplyVehicle", false]) exitWith {hint "Vehicle ain't supply vehicle";}; + +private _vehicleCurrentMateriel = + _vehicle getVariable ["currentMateriel", 0]; +private _vehicleCurrentOre = + _vehicle getVariable ["currentOre", 0]; + +private _vehicleMax = + _vehicle getVariable ["maxLoad", 300]; + +private _transferRate = + _vehicle getVariable ["transferRate", 50]; + +private _depotCurrent = + _depot getVariable ["currentMateriel", 0]; + +private _freeSpace = + _vehicleMax - (_vehicleCurrentMateriel + _vehicleCurrentOre); + +if (_freeSpace <= 0) exitWith { + + [ + "CLRK_ShowMessage", + [1, 0, "Vehicle is already full."], + _player + ] call CBA_fnc_targetEvent; +}; + +if (_depotCurrent <= 0) exitWith { + + [ + "CLRK_ShowMessage", + [2, 0, "Depot has no Materiel available."], + _player + ] call CBA_fnc_targetEvent; +}; + +private _amount = + (_transferRate min _freeSpace) + min _depotCurrent; + +_vehicle setVariable [ + "currentMateriel", + _vehicleCurrentMateriel + _amount, + true +]; + +_depot setVariable [ + "currentMateriel", + _depotCurrent - _amount, + true +]; + +[ + "CLRK_ShowMessage", + [ + 0, + 0, + format [ + "Loaded %1 Materiel. Vehicle now contains %2.
Current Load: %3/%4.", + _amount, + _vehicleCurrentMateriel + _amount, + _vehicleCurrentMateriel + _amount + _vehicleCurrentOre, + _vehicleMax + ] + ], + _player +] call CBA_fnc_targetEvent; diff --git a/Addons/logistics/functions/fn_vehicleLoadOre.sqf b/Addons/logistics/functions/fn_vehicleLoadOre.sqf new file mode 100644 index 0000000..37db9ca --- /dev/null +++ b/Addons/logistics/functions/fn_vehicleLoadOre.sqf @@ -0,0 +1,88 @@ +/* + Author: Clarky + Usage: + [ + "CLRK_fnc_VehicleLoaded", + [_target, _caller, _depot] + ] call CBA_fnc_serverEvent; + + Intended to be run by an event handler call from a vehicle load action from a player on a valid supply vehicle + +*/ + +params ["_vehicle", "_player", "_depot"]; + +if (!isServer) exitWith {}; + +if (isNull _vehicle) exitWith {hint "Vehicle ain't exist";}; +if (isNull _player) exitWith {hint "Player ain't exist";}; +if (isNull _depot) exitWith {hint "Depot ain't exist";}; + +if !(_vehicle getVariable ["isSupplyVehicle", false]) exitWith {hint "Vehicle ain't supply vehicle";}; + +private _vehicleCurrentMateriel = + _vehicle getVariable ["currentMateriel", 0]; +private _vehicleCurrentOre = + _vehicle getVariable ["currentOre", 0]; + +private _vehicleMax = + _vehicle getVariable ["maxLoad", 300]; + +private _transferRate = + _vehicle getVariable ["transferRate", 50]; + +private _depotCurrent = + _depot getVariable ["currentOre", 0]; + +private _freeSpace = + _vehicleMax - (_vehicleCurrentMateriel + _vehicleCurrentOre); + +if (_freeSpace <= 0) exitWith { + + [ + "CLRK_ShowMessage", + [1, 0, "Vehicle is already full."], + _player + ] call CBA_fnc_targetEvent; +}; + +if (_depotCurrent <= 0) exitWith { + + [ + "CLRK_ShowMessage", + [2, 0, "Depot has no Ore available."], + _player + ] call CBA_fnc_targetEvent; +}; + +private _amount = + (_transferRate min _freeSpace) + min _depotCurrent; + +_vehicle setVariable [ + "currentOre", + _vehicleCurrentOre + _amount, + true +]; + +_depot setVariable [ + "currentOre", + _depotCurrent - _amount, + true +]; + +[ + "CLRK_ShowMessage", + [ + 0, + 0, + format [ + "Loaded %1 Ore. Vehicle now contains %2.
Current Load: %3/%4.", + _amount, + _vehicleCurrentOre + _amount, + _vehicleCurrentOre + _amount + _vehicleCurrentMateriel, + _vehicleMax + ] + ], + _player +] call CBA_fnc_targetEvent; diff --git a/Addons/logistics/functions/fn_vehicleUnloadMateriel.sqf b/Addons/logistics/functions/fn_vehicleUnloadMateriel.sqf new file mode 100644 index 0000000..212365c --- /dev/null +++ b/Addons/logistics/functions/fn_vehicleUnloadMateriel.sqf @@ -0,0 +1,93 @@ +/* + Author: Clarky + Usage: + [ + "CLRK_fnc_VehicleUnloaded", + [_target, _caller, _depot] + ] call CBA_fnc_serverEvent; + + Intended to be run by an event handler call from a vehicle unload action from a player on a valid supply vehicle + +*/ + +params ["_vehicle", "_player", "_depot"]; + +if (!isServer) exitWith {}; + +if (isNull _vehicle) exitWith {hint "Vehicle ain't exist";}; +if (isNull _player) exitWith {hint "Player ain't exist";}; +if (isNull _depot) exitWith {hint "Depot ain't exist";}; + +if !(_vehicle getVariable ["isSupplyVehicle", false]) exitWith {hint "Vehicle ain't supply vehicle";}; + +private _vehicleCurrent = + _vehicle getVariable ["currentMateriel", 0]; + +private _transferRate = + _vehicle getVariable ["transferRate", 50]; + +private _depotCurrent = + _depot getVariable ["currentMateriel", 0]; + +private _depotMax = + _depot getVariable ["maxMateriel", 300]; + +private _freeSpace = + _depotMax - _depotCurrent; + +if (_freeSpace <= 0) exitWith { + + [ + "CLRK_ShowMessage", + [ + 1, + 0, + "Depot is already full." + ], + _player + ] call CBA_fnc_targetEvent; +}; + +if (_vehicleCurrent <= 0) exitWith { + + [ + "CLRK_ShowMessage", + [ + 2, + 0, + "Vehicle has no Materiel available." + ], + _player + ] call CBA_fnc_targetEvent; +}; + +private _amount = + (_transferRate min _freeSpace) + min _vehicleCurrent; + +_vehicle setVariable [ + "currentMateriel", + _vehicleCurrent - _amount, + true +]; + +_depot setVariable [ + "currentMateriel", + _depotCurrent + _amount, + true +]; + +[ + "CLRK_ShowMessage", + [ + 0, + 0, + format [ + "Unloaded %1 materiel. Depot now contains %2/%3.", + _amount, + _depot getVariable ["currentMateriel",0], + _depotMax + ] + ], + _player +] call CBA_fnc_targetEvent; diff --git a/Addons/logistics/functions/fn_vehicleUnloadOre.sqf b/Addons/logistics/functions/fn_vehicleUnloadOre.sqf new file mode 100644 index 0000000..6a98bc7 --- /dev/null +++ b/Addons/logistics/functions/fn_vehicleUnloadOre.sqf @@ -0,0 +1,93 @@ +/* + Author: Clarky + Usage: + [ + "CLRK_fnc_VehicleUnloaded", + [_target, _caller, _depot] + ] call CBA_fnc_serverEvent; + + Intended to be run by an event handler call from a vehicle unload action from a player on a valid supply vehicle + +*/ + +params ["_vehicle", "_player", "_depot"]; + +if (!isServer) exitWith {}; + +if (isNull _vehicle) exitWith {hint "Vehicle ain't exist";}; +if (isNull _player) exitWith {hint "Player ain't exist";}; +if (isNull _depot) exitWith {hint "Depot ain't exist";}; + +if !(_vehicle getVariable ["isSupplyVehicle", false]) exitWith {hint "Vehicle ain't supply vehicle";}; + +private _vehicleCurrent = + _vehicle getVariable ["currentOre", 0]; + +private _transferRate = + _vehicle getVariable ["transferRate", 50]; + +private _depotCurrent = + _depot getVariable ["currentOre", 0]; + +private _depotMax = + _depot getVariable ["maxOre", 300]; + +private _freeSpace = + _depotMax - _depotCurrent; + +if (_freeSpace <= 0) exitWith { + + [ + "CLRK_ShowMessage", + [ + 1, + 0, + "Depot is already full." + ], + _player + ] call CBA_fnc_targetEvent; +}; + +if (_vehicleCurrent <= 0) exitWith { + + [ + "CLRK_ShowMessage", + [ + 2, + 0, + "Vehicle has no Ore available." + ], + _player + ] call CBA_fnc_targetEvent; +}; + +private _amount = + (_transferRate min _freeSpace) + min _vehicleCurrent; + +_vehicle setVariable [ + "currentOre", + _vehicleCurrent - _amount, + true +]; + +_depot setVariable [ + "currentOre", + _depotCurrent + _amount, + true +]; + +[ + "CLRK_ShowMessage", + [ + 0, + 0, + format [ + "Unloaded %1 Ore. Depot now contains %2/%3.", + _amount, + _depot getVariable ["currentOre",0], + _depotMax + ] + ], + _player +] call CBA_fnc_targetEvent; diff --git a/Addons/logistics/functions/init/fn_initEngineeringBay.sqf b/Addons/logistics/functions/init/fn_initEngineeringBay.sqf new file mode 100644 index 0000000..be8f29e --- /dev/null +++ b/Addons/logistics/functions/init/fn_initEngineeringBay.sqf @@ -0,0 +1,43 @@ +/* + * Author: Clarky + * Description: + * Initialises an Engineering Bay. Intended to be called as a function by internal processes, or exposed as a module in Eden and Zeus + * + * Arguments: + * 0: Linked HQ + * 1: Engineering Bay + * + * Usage: + * [_hq, this] call CLRK_fnc_initEngineeringBay + * + */ + +params [["_hq", "", ["", objNull]], "_engineering"]; + +if (!isServer) exitWith {}; + +_engineering setVariable ["isEngineeringBay", true, true]; + +// Wait to run the initialisaion for mission start -- Prevents base push until HQ object is initialised +if (_hq isNotEqualTo "") then { + [ + { + params ["_engineering", "_hq"]; + _engineering setVariable ["hq", _hq, true]; + private _baseDetails = _hq getVariable "baseDetails"; + private _buildings = _baseDetails get "buildings"; + _buildings pushBack _engineering; + }, + [_engineering, _hq], + 2 + ] call CBA_fnc_waitAndExecute; +}; + +// Set object to invulnerable -- May be removed once base building is fully implemented. +[_engineering, false] remoteExec ["allowDamage", 0, true]; + +[_engineering] remoteExecCall [ + "CLF_fnc_initEngineeringBayInteractions", + 0, + true +]; \ No newline at end of file diff --git a/Addons/logistics/functions/init/fn_initEngineeringBayInteractions.sqf b/Addons/logistics/functions/init/fn_initEngineeringBayInteractions.sqf new file mode 100644 index 0000000..55e5f93 --- /dev/null +++ b/Addons/logistics/functions/init/fn_initEngineeringBayInteractions.sqf @@ -0,0 +1,33 @@ +/* + * Author: Clarky + * Usage: + * [hq, this] call CLRK_fnc_initVehicleFactoryInteractions; + *   + * Intended to run locally on each client. + * +*/ + +params ["_engineering"]; + +_factory addAction [ + "Open Vehicle Engineering", + + { + params ["_target", "_caller"]; + // Load up the HQ as a variable for the player to access once proceeding through to building a vehicle + private _hq = _target getVariable ["hq", ""]; + if (_hq isNotEqualTo "") then { + uiNamespace setVariable ["localHQ", _hq]; + createDialog "VehicleFactoryDialog"; + } else { + hint "No attached HQ."; + }; + }, + nil, + 1, + true, + false, + "", + "true", // Figure out a way to lock this to player side checks (macros?) + 6 +]; \ No newline at end of file diff --git a/Addons/logistics/functions/init/fn_initFOB.sqf b/Addons/logistics/functions/init/fn_initFOB.sqf new file mode 100644 index 0000000..68e4a5d --- /dev/null +++ b/Addons/logistics/functions/init/fn_initFOB.sqf @@ -0,0 +1,56 @@ +/* + * Author: Clarky + * Description: + * Initialises a FOB type base. Intended to be called as a function by internal processes, or exposed as a module in Eden and Zeus + * + * Arguments: + * 0: FOB + * 1: Side + * + * Usage: + * [this, side] call CLRK_fnc_initHQ + * + */ + +params ["_fob", "_side"]; + +if (!isServer) exitWith {}; + +waitUntil { !isNull _fob; }; + +_fob setVariable ["isFOB", true, true]; + +// Set object to invulnerable -- May be removed once base building is fully implemented. +[_fob, false] remoteExec ["allowDamage", 0, true]; + +/* +// Set BaseID +private _baseID = format [ + "BASE_%1_%2", + diag_tickTime, + random[0,50,100] +]; + +_fob setVariable [ + "baseID", + _baseID, + true +];*/ + +_fob setVariable [ + "baseDetails", + createHashMapFromArray [ + //["id", _baseID], + ["hq", _fob], + ["buildings", []], + ["side", _side] + ], + true +]; + +// Initialise base HQ interactions for all clients +[_fob] remoteExecCall [ + "CLF_fnc_initFOBInteractions", + 0, + true +]; \ No newline at end of file diff --git a/Addons/logistics/functions/init/fn_initFOBInteractions.sqf b/Addons/logistics/functions/init/fn_initFOBInteractions.sqf new file mode 100644 index 0000000..5a9f5f3 --- /dev/null +++ b/Addons/logistics/functions/init/fn_initFOBInteractions.sqf @@ -0,0 +1,32 @@ +/* + * Author: Clarky + * Usage: + * [this] call CLRK_fnc_initBaseHQInteractions; + *   + * Intended to run locally on each client. + * + */ + +params ["_fob"]; + +_fob addAction [ + "Check Total Materiel", + + { + params ["_target", "_caller"]; + [ + "CLRK_MaterielCheck", + [ + _target, + _caller + ] + ] call CBA_fnc_serverEvent; + }, + nil, + 1, + true, + false, + "", + "true", + 6 +]; diff --git a/Addons/logistics/functions/init/fn_initFactory.sqf b/Addons/logistics/functions/init/fn_initFactory.sqf new file mode 100644 index 0000000..47d1eed --- /dev/null +++ b/Addons/logistics/functions/init/fn_initFactory.sqf @@ -0,0 +1,130 @@ +/* + * Author: Clarky + * Description: + * Initialises a Factory type base. Intended to be called as a function by internal processes, or exposed as a module in Eden and Zeus + * + * Arguments: + * 0: Factory + * 1: Side + * 2: Conversion Rate + * + * Usage: + * [this, side, 500] call CLRK_fnc_initHQ + * + */ + +params ["_factory", "_side", "_conversionAmount"]; + +if (!isServer) exitWith {}; + +waitUntil { !isNull _factory; }; + +_factory setVariable ["isFactory", true, true]; +_factory setVariable ["conversionAmount", _conversionAmount, true]; + +// Set object to invulnerable -- May be removed once base building is fully implemented. +[_factory, false] remoteExec ["allowDamage", 0, true]; + +/* +// Set BaseID +private _baseID = format [ + "BASE_%1_%2", + diag_tickTime, + random[0,50,100] +]; + +_factory setVariable [ + "baseID", + _baseID, + true +];*/ + +_factory setVariable [ + "baseDetails", + createHashMapFromArray [ + //["id", _baseID], + ["hq", _factory], + ["buildings", []], + ["supplyDepots", []], + ["oreDepots", []], + ["side", _side] + ], + true +]; + +// Initialise base HQ interactions for all clients +[_factory] remoteExecCall [ + "CLF_fnc_initFactoryInteractions", + 0, + true +]; + +[ + { + params ["_args", "_handle"]; + _args params ["_factory", "_conversionAmount"]; + + if (!alive _factory || isNull _factory) then { + [_handle] call CBA_fnc_removePerFrameHandler; + }; + + // Fetch linked depots - Exit out if none found + private _baseDetails = _factory getVariable "baseDetails"; + private _supplyDepots = _baseDetails get "supplyDepots"; + private _oreDepots = _baseDetails get "oreDepots"; + + if (_supplyDepots isEqualTo [] || _oreDepots isEqualTo []) exitWith {}; + + // Fetch all requisite details from linked details - For both Ore and Materiel Depots + private _currentOre = 0; + { + _currentOre = _currentOre + (_x getVariable ["currentOre", 0]); + } forEach _oreDepots; + + if !(_currentOre > 0) exitWith {}; + + private _freeSpace = 0; + + { + private _depotMateriel = _x getVariable "currentMateriel"; + private _depotMax = _x getVariable "maxMateriel"; + _freeSpace = _freeSpace + (_depotMax - _depotMateriel); + } forEach _supplyDepots; + + private _amountToConvert = _conversionAmount min _currentOre min _freeSpace; + + if (_amountToConvert == 0) exitWith {}; + + private _removeOre = _amountToConvert; + + { + // Get currently looped depot's materiel and draw down from it + private _depotOre = _x getVariable "currentOre"; + private _reduceAmount = _removeOre min _depotOre; + + _x setVariable ["currentOre", _depotOre - _reduceAmount, true]; + + // Update remaining amount to reduce + _removeOre = _removeOre - _reduceAmount; + } forEach _oreDepots; + + { + // If the _amount is now at 0, exit the loop early + if (_amount <= 0) exitWith {}; + + // Get currently looped depot's materiel and draw down from it + private _depotMateriel = _x getVariable "currentMateriel"; + private _depotMax = _x getVariable "maxMateriel"; + private _freeSpace = _depotMax - _depotMateriel; + private _addAmount = _amountToConvert min _freeSpace; + + _x setVariable ["currentMateriel", _depotMateriel + _addAmount, true]; + + // Update remaining amount to reduce + _amountToConvert = _amountToConvert - _addAmount; + } forEach _supplyDepots; + }, + 30, + [_factory, _conversionAmount] +] call CBA_fnc_addPerFrameHandler; + diff --git a/Addons/logistics/functions/init/fn_initFactoryInteractions.sqf b/Addons/logistics/functions/init/fn_initFactoryInteractions.sqf new file mode 100644 index 0000000..be868c2 --- /dev/null +++ b/Addons/logistics/functions/init/fn_initFactoryInteractions.sqf @@ -0,0 +1,55 @@ +/* + * Author: Clarky + * Usage: + * [this] call CLRK_fnc_initBaseHQInteractions; + *   + * Intended to run locally on each client. + * + */ + +params ["_factory"]; + + +_factory addAction [ + "Check Total Ore", + + { + params ["_target", "_caller"]; + [ + "CLRK_OreCheck", + [ + _target, + _caller + ] + ] call CBA_fnc_serverEvent; + }, + nil, + 1, + true, + false, + "", + "true", + 6 +]; + +_factory addAction [ + "Check Total Materiel", + + { + params ["_target", "_caller"]; + [ + "CLRK_MaterielCheck", + [ + _target, + _caller + ] + ] call CBA_fnc_serverEvent; + }, + nil, + 1, + true, + false, + "", + "true", + 6 +]; \ No newline at end of file diff --git a/Addons/logistics/functions/init/fn_initHQ.sqf b/Addons/logistics/functions/init/fn_initHQ.sqf new file mode 100644 index 0000000..415f08f --- /dev/null +++ b/Addons/logistics/functions/init/fn_initHQ.sqf @@ -0,0 +1,96 @@ +/* + * Author: Clarky + * Description: + * Initialises a Headquarters type base. Intended to be called as a function by internal processes, or exposed as a module in Eden and Zeus + * + * Arguments: + * 0: HQ + * 1: Side + * + * Usage: + * [this, side] call CLRK_fnc_initHQ + * + */ + +params ["_hq", "_side"]; + +if (!isServer) exitWith {}; + +waitUntil { !isNull _hq; }; + +_hq setVariable ["isHQ", true, true]; + +// Set object to invulnerable -- May be removed once base building is fully implemented. +[_hq, false] remoteExec ["allowDamage", 0, true]; + +/* +// Set BaseID +private _baseID = format [ + "BASE_%1_%2", + diag_tickTime, + random[0,50,100] +]; + +_hq setVariable [ + "baseID", + _baseID, + true +];*/ + +private _name = "" + +switch (_side) +{ + case west: + { + _name = GVAR(baseNames) select GVAR(bluforBaseIndex); + _hq setVariable ["baseName", _name, true]; + INC(GVAR(bluforBaseIndex)); + } + case east: + { + _name = GVAR(baseNames) select GVAR(opforBaseIndex); + _hq setVariable ["baseName", _name, true]; + INC(GVAR(opforBaseIndex)); + } + case independent: + { + _name = GVAR(baseNames) select GVAR(independentBaseIndex); + _hq setVariable ["baseName", _name, true]; + INC(GVAR(independentBaseIndex)); + } + case civilian: + { + _name = GVAR(baseNames) select GVAR(civilianBaseIndex); + _hq setVariable ["baseName", _name, true]; + INC(GVAR(civilianBaseIndex)); + } +} + +private _baseMarker = createMarker [format ["%1 [HQ]", _name], _hq]; +_baseMarker setMarkerShape "ICON"; +_baseMarker setMarkerType "mil_dot"; +_baseMarker setMarkerText format ["%1 [HQ]", _name]; +// TODO - Set colour based on side. Also figure out better icon. + +_hq setVariable ["baseMarker", _baseMarker, true]; + +_hq setVariable [ + "baseDetails", + createHashMapFromArray [ + //["id", _baseID], + ["hq", _hq], + ["buildings", []], + ["supplyDepots", []], + ["oreDepots", []], + ["side", _side] + ], + true +]; + +// Initialise base HQ interactions for all clients +[_hq] remoteExecCall [ + QFUNC(initHQInteractions), + 0, + true +]; \ No newline at end of file diff --git a/Addons/logistics/functions/init/fn_initHQInteractions.sqf b/Addons/logistics/functions/init/fn_initHQInteractions.sqf new file mode 100644 index 0000000..d292c03 --- /dev/null +++ b/Addons/logistics/functions/init/fn_initHQInteractions.sqf @@ -0,0 +1,79 @@ +/* + * Author: Clarky + * Usage: + * [this] call CLRK_fnc_initBaseHQInteractions; + *   + * Intended to run locally on each client. + * + */ + +params ["_hq"]; + +_hq addAction [ + "Check Total Materiel", + + { + params ["_target", "_caller"]; + [ + "CLRK_MaterielCheck", + [ + _target, + _caller + ] + ] call CBA_fnc_serverEvent; + }, + nil, + 1, + true, + false, + "", + "true", + 6 +]; + +_hq addAction [ + "Check Fortify Budget", + { + params ["_target", "_caller"]; + private _msg = format ["Current Fortify Budget: %1", [side _caller] call ace_fortify_fnc_getBudget]; + [ + "CLRK_ShowMessage", + [ + 3, + 1, + _msg + ], + _caller + ] call CBA_fnc_targetEvent; + }, + nil, + 1, + true, + false, + "", + "true", // Figure out a way to lock this to player side checks (macros?) + 6 +]; + +_hq addAction [ + "Add Fortify Budget - $100", + { + params ["_target", "_caller"]; + + [ + "CLRK_FortifyBudgetAdd", + [ + _target, + _caller + ] + ] call CBA_fnc_serverEvent; + //[side _caller, 100, true] call ace_fortify_fnc_updateBudget; + }, + nil, + 1, + true, + false, + "", + "true", // Figure out a way to lock this to player side checks (macros?) + 6 +]; diff --git a/Addons/logistics/functions/init/fn_initMaterielDepot.sqf b/Addons/logistics/functions/init/fn_initMaterielDepot.sqf new file mode 100644 index 0000000..59ae556 --- /dev/null +++ b/Addons/logistics/functions/init/fn_initMaterielDepot.sqf @@ -0,0 +1,83 @@ +/* + * Author: Clarky + * Description: + * Initialises a Materiel Depot. Intended to be called as a function by internal processes, or exposed as a module in Eden and Zeus + * + * Arguments: + * 0: Linked HQ + * 1: Depot + * 2: Max Materiel + * 3: Current Materiel + * 4: Generation Rate + * + * Usage: + * [_base, this, 1000, 0, false, 0] call CLRK_fnc_initSupplyDepot + * + */ + +params [["_base", "", ["", objNull]], "_depot", "_maxMateriel", "_currentMateriel", "_generationRate"]; + +if (!isServer) exitWith {}; + +_depot setVariable ["isSupplyDepot", true, true]; +_depot setVariable ["maxMateriel", _maxMateriel, true]; +_depot setVariable ["currentMateriel", _currentMateriel, true]; +_depot setVariable ["materielRate", _materielRate, true]; + +// Wait to run the initialisaion for mission start -- Prevents base push until HQ object is initialised +if (_base isNotEqualTo "") then { + [ + { + params ["_depot", "_base"]; + _depot setVariable ["hq", _base, true]; + private _baseDetails = _base getVariable "baseDetails"; + private _depots = _baseDetails get "supplyDepots"; + _depots pushBack _depot; + }, + [_depot, _base], + 2 + ] call CBA_fnc_waitAndExecute; +}; + +// Set object to invulnerable -- May be removed once base building is fully implemented. +[_depot, false] remoteExec ["allowDamage", 0, true]; + +[_depot] remoteExecCall [ + "CLF_fnc_initSupplyDepotInteractions", + 0, + true +]; + +// If a generation rate was supplied, spawn in per frame handler to generate resources every 30 seconds +if (_generationRate > 0) then { + [ + { + params ["_args", "_handle"]; + _args params ["_depot", "_materielRate"]; + + if (!alive _depot || isNull _depot) then { + [_handle] call CBA_fnc_removePerFrameHandler; + }; + + 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 + ]; + }, + 30, + [_depot, _materielRate] + ] call CBA_fnc_addPerFrameHandler; +}; diff --git a/Addons/logistics/functions/init/fn_initMaterielDepotInteractions.sqf b/Addons/logistics/functions/init/fn_initMaterielDepotInteractions.sqf new file mode 100644 index 0000000..e7f9658 --- /dev/null +++ b/Addons/logistics/functions/init/fn_initMaterielDepotInteractions.sqf @@ -0,0 +1,58 @@ +/* + Author: Clarky + Usage: + [this] call CLRK_fnc_initSupplyDepotInteractions; +   + Intended to run locally on each client. + +*/ + +params ["_depot"]; + +if (isNull _depot) exitWith {hint "Object ain't exist";}; +if !(_depot getVariable ["isSupplyDepot", false]) exitWith {hint "Object ain't supply depot";}; + +// Prevent duplicate actions if script runs again +if (_depot getVariable ["supplyInteractionsAdded", false]) exitWith {}; + +_depot setVariable ["supplyInteractionsAdded", true]; + +////////////////////////////////////////////////////////////////// +// INIT STATUS ACTION +////////////////////////////////////////////////////////////////// + +_depot addAction [ + "Check Materiel Status", + + { + params ["_target", "_caller"]; + + private _current = + _target getVariable ["currentMateriel", 0]; + + private _max = + _target getVariable ["maxMateriel", 300]; + + [ + "CLRK_ShowMessage", + [ + 3, + 1, + format + [ + "SUPPLY DEPOT STORAGE
Materiel: %1 / %2", + _current, + _max + ] + ], + _caller + ] call CBA_fnc_targetEvent; + }, + nil, + 1, + true, + false, + "", + "true", + 6 +]; \ No newline at end of file diff --git a/Addons/logistics/functions/init/fn_initOreDepot.sqf b/Addons/logistics/functions/init/fn_initOreDepot.sqf new file mode 100644 index 0000000..baf4281 --- /dev/null +++ b/Addons/logistics/functions/init/fn_initOreDepot.sqf @@ -0,0 +1,83 @@ +/* + * Author: Clarky + * Description: + * Initialises an Ore Depot. Intended to be called as a function by internal processes, or exposed as a module in Eden and Zeus + * + * Arguments: + * 0: Linked HQ + * 1: Depot + * 2: Max Ore + * 3: Current Ore + * 4: Generation Rate + * + * Usage: + * [_base, this, 1000, 0, false, 0] call CLRK_fnc_initOreDepot + * + */ + +params [["_base", "", ["", objNull]], "_depot", "_maxOre", "_currentOre", "_generationRate"]; + +if (!isServer) exitWith {}; + +_depot setVariable ["isOreDepot", true, true]; +_depot setVariable ["maxOre", _maxOre, true]; +_depot setVariable ["currentOre", _currentOre, true]; +_depot setVariable ["oreRate", _generationRate, true]; + +// Wait to run the initialisaion for mission start -- Prevents base push until HQ object is initialised +if (_base isNotEqualTo "") then { + [ + { + params ["_depot", "_base"]; + _depot setVariable ["hq", _base, true]; + private _baseDetails = _base getVariable "baseDetails"; + private _depots = _baseDetails get "oreDepots"; + _depots pushBack _depot; + }, + [_depot, _base], + 2 + ] call CBA_fnc_waitAndExecute; +}; + +// Set object to invulnerable -- May be removed once base building is fully implemented. +[_depot, false] remoteExec ["allowDamage", 0, true]; + +[_depot] remoteExecCall [ + "CLF_fnc_initOreDepotInteractions", + 0, + true +]; + +// If a generation rate was supplied, spawn in per frame handler to generate resources every 30 seconds +if (_generationRate > 0) then { + [ + { + params ["_args", "_handle"]; + _args params ["_depot", "_generationRate"]; + + if (!alive _depot || isNull _depot) then { + [_handle] call CBA_fnc_removePerFrameHandler; + }; + + private _depotCurrent = + _depot getVariable "currentOre"; + + private _depotMax = + _depot getVariable "maxOre"; + + private _freeSpace = + _depotMax - _depotCurrent; + + private _amount = + (_oreRate min _freeSpace); + + _depot setVariable [ + "currentOre", + _depotCurrent + _amount, + true + ]; + }, + 30, + [_depot, _oreRate] + ] call CBA_fnc_addPerFrameHandler; +}; diff --git a/Addons/logistics/functions/init/fn_initOreDepotInteractions.sqf b/Addons/logistics/functions/init/fn_initOreDepotInteractions.sqf new file mode 100644 index 0000000..bb27b63 --- /dev/null +++ b/Addons/logistics/functions/init/fn_initOreDepotInteractions.sqf @@ -0,0 +1,58 @@ +/* + Author: Clarky + Usage: + [this] call CLRK_fnc_initSupplyDepotInteractions; +   + Intended to run locally on each client. + +*/ + +params ["_depot"]; + +if (isNull _depot) exitWith {hint "Object ain't exist";}; +if !(_depot getVariable ["isOreDepot", false]) exitWith {hint "Object ain't ore depot";}; + +// Prevent duplicate actions if script runs again +if (_depot getVariable ["oreInteractionsAdded", false]) exitWith {}; + +_depot setVariable ["oreInteractionsAdded", true]; + +////////////////////////////////////////////////////////////////// +// INIT STATUS ACTION +////////////////////////////////////////////////////////////////// + +_depot addAction [ + "Check Ore Status", + + { + params ["_target", "_caller"]; + + private _current = + _target getVariable ["currentOre", 0]; + + private _max = + _target getVariable ["maxOre", 300]; + + [ + "CLRK_ShowMessage", + [ + 3, + 1, + format + [ + "ORE DEPOT STORAGE
Ore: %1 / %2", + _current, + _max + ] + ], + _caller + ] call CBA_fnc_targetEvent; + }, + nil, + 1, + true, + false, + "", + "true", + 6 +]; \ No newline at end of file diff --git a/Addons/logistics/functions/init/fn_initSupplyVehicle.sqf b/Addons/logistics/functions/init/fn_initSupplyVehicle.sqf new file mode 100644 index 0000000..1581926 --- /dev/null +++ b/Addons/logistics/functions/init/fn_initSupplyVehicle.sqf @@ -0,0 +1,33 @@ +/* + * Author: Clarky + * Description: + * Initialises a Supply Vehicle. Intended to be called as a function by internal processes, or exposed as a module in Eden and Zeus + * + * Arguments: + * 0: Vehicle + * 1: Max Load + * 2: Current Materiel + * 3: Current Ore + * 4: Transfer Rate + * + * Usage: + * [this, 500, 0, 0, 100] call CLRK_fnc_initSupplyVehicle + * + */ + +params ["_vehicle", "_maxLoad", "_currentMateriel", "_currentOre", "_transferRate"]; + +if (!isServer) exitWith {}; + +_vehicle setVariable ["isSupplyVehicle", true, true]; +_vehicle setVariable ["maxLoad", _maxMateriel, true]; +_vehicle setVariable ["currentMateriel", _currentMateriel, true]; +_vehicle setVariable ["currentOre", _currentOre, true]; +_vehicle setVariable ["transferRate", _transferRate, true]; + +[_vehicle] remoteExecCall [ + "CLF_fnc_initSupplyVehicleInteractions", + 0, + true +]; + diff --git a/Addons/logistics/functions/init/fn_initSupplyVehicleInteractions.sqf b/Addons/logistics/functions/init/fn_initSupplyVehicleInteractions.sqf new file mode 100644 index 0000000..e3facdf --- /dev/null +++ b/Addons/logistics/functions/init/fn_initSupplyVehicleInteractions.sqf @@ -0,0 +1,287 @@ +/* + * Author: Clarky + * Usage: + * [this] call CLRK_fnc_initSupplyVehicleInteractions; + *   + * Intended to run locally on each client. + * +*/ + +params ["_vehicle"]; + +if (isNull _vehicle) exitWith {hint "VEHICLE ERROR -- SUPPLY";}; +if !(_vehicle getVariable ["isSupplyVehicle", false]) exitWith {hint "SUPPLY VEHICLE INIT NOT FOUND";}; + +// Prevent duplicate actions if script runs again +if (_vehicle getVariable ["supplyInteractionsAdded", false]) exitWith {}; + +_vehicle setVariable ["supplyInteractionsAdded", true]; + +////////////////////////////////////////////////////////////////// +// INIT STATUS ACTION +////////////////////////////////////////////////////////////////// + +_vehicle addAction [ + "Check Storage Status", + { + params ["_target", "_caller"]; + + private _currentMateriel = + _target getVariable ["currentMateriel", 0]; + private _currentOre = + _target getVariable ["currentOre", 0]; + + private _max = + _target getVariable ["maxLoad", 300]; + + private _rate = + _target getVariable ["transferRate", 50]; + + [ + "CLRK_ShowMessage", + [ + 3, + 1, + format + [ + "SUPPLY VEHICLE STORAGE
Materiel: %1
Ore: %2
Capacity: %3 / %4
Transfer Rate: %5", + _currentMateriel, + _currentOre, + _currentMateriel + _currentOre, + _max, + _rate + ] + ], + _caller + ] call CBA_fnc_targetEvent; + }, + nil, + 1, + true, + false, + "", + "true", + 6 +]; + +////////////////////////////////////////////////////////////////// +// INIT LOAD ACTION +////////////////////////////////////////////////////////////////// + +/////////////////////////////////////// +// MATERIEL ACTIONS +/////////////////////////////////////// +[ + _vehicle, // Object the action is attached to + "Load Materiel", // Title of the action + "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa", // Idle icon shown on screen + "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa", // Progress icon shown on screen + "(([_this] call ace_common_fnc_isEngineer) || (missionNamespace getVariable 'allCanUseLogistics')) && + ( + (nearestObjects [_target, [], 15] findIf { + _x getVariable ['isSupplyDepot', false] + }) > -1 + ) && + (_target distance _this < 7)", // Condition for the action to be shown + "alive _target", // Condition for the action to progress + {}, // Code executed when action starts + {}, // Code executed on every progress tick + { + params ["_target", "_caller"]; + + private _depot = ( + nearestObjects [_target, [], 15] + select { + _x getVariable ["isSupplyDepot", false] + } + ) param [0, objNull]; + + if (isNull _depot) exitWith { + [ + "CLRK_ShowMessage", + [ + 1, + 0, + "No Materiel depot nearby." + ], + _caller + ] call CBA_fnc_targetEvent; + }; + + [ + "CLRK_VehicleLoadedMateriel", + [_target, _caller, _depot] + ] call CBA_fnc_serverEvent; + }, // Code executed on completion + {}, // Code executed on interrupted + [], // Arguments passed to the scripts as _this select 3 + 5, // Action duration in seconds + 0, // Priority + false, // Remove on completion + false, // Show in unconscious state + true // Show on screen +] call BIS_fnc_holdActionAdd; + +////////////////////////////////////////////////////////////////// +// INIT UNLOAD ACTION +////////////////////////////////////////////////////////////////// + +[ + _vehicle, // Object the action is attached to + "Unload Materiel", // Title of the action + "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unloaddevice_ca.paa", // Idle icon shown on screen + "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unloaddevice_ca.paa", // Progress icon shown on screen + "(([_this] call ace_common_fnc_isEngineer) || (missionNamespace getVariable 'allCanUseLogistics')) && + ( + (nearestObjects [_target, [], 15] findIf { + _x getVariable ['isSupplyDepot', false] + }) > -1 + ) && + (_target distance _this < 7)", // Condition for the action to be shown + "alive _target", // Condition for the action to progress + {}, // Code executed when action starts + {}, // Code executed on every progress tick + { + params ["_target", "_caller"]; + + private _depot = ( + nearestObjects [_target, [], 15] + select { + _x getVariable ["isSupplyDepot", false] + } + ) param [0, objNull]; + + if (isNull _depot) exitWith { + [ + "CLRK_ShowMessage", + [ + 1, + 0, + "No Materiel depot nearby." + ], + _caller + ] call CBA_fnc_targetEvent; + }; + + [ + "CLRK_VehicleUnloadedMateriel", + [_target, _caller, _depot] + ] call CBA_fnc_serverEvent; + }, // Code executed on completion + {}, // Code executed on interrupted + [], // Arguments passed to the scripts as _this select 3 + 5, // Action duration in seconds + 0, // Priority + false, // Remove on completion + false, // Show in unconscious state + true // Show on screen +] call BIS_fnc_holdActionAdd; + +/////////////////////////////////////// +// ORE ACTIONS +/////////////////////////////////////// +[ + _vehicle, // Object the action is attached to + "Load Ore", // Title of the action + "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa", // Idle icon shown on screen + "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_loaddevice_ca.paa", // Progress icon shown on screen + "(([_this] call ace_common_fnc_isEngineer) || (missionNamespace getVariable 'allCanUseLogistics')) && + ( + (nearestObjects [_target, [], 15] findIf { + _x getVariable ['isOreDepot', false] + }) > -1 + ) && + (_target distance _this < 7)", // Condition for the action to be shown + "alive _target", // Condition for the action to progress + {}, // Code executed when action starts + {}, // Code executed on every progress tick + { + params ["_target", "_caller"]; + + private _depot = ( + nearestObjects [_target, [], 15] + select { + _x getVariable ["isOreDepot", false] + } + ) param [0, objNull]; + + if (isNull _depot) exitWith { + [ + "CLRK_ShowMessage", + [ + 1, + 0, + "No Ore depot nearby." + ], + _caller + ] call CBA_fnc_targetEvent; + }; + + [ + "CLRK_VehicleLoadedOre", + [_target, _caller, _depot] + ] call CBA_fnc_serverEvent; + }, // Code executed on completion + {}, // Code executed on interrupted + [], // Arguments passed to the scripts as _this select 3 + 5, // Action duration in seconds + 0, // Priority + false, // Remove on completion + false, // Show in unconscious state + true // Show on screen +] call BIS_fnc_holdActionAdd; + +////////////////////////////////////////////////////////////////// +// INIT UNLOAD ACTION +////////////////////////////////////////////////////////////////// + +[ + _vehicle, // Object the action is attached to + "Unload Ore", // Title of the action + "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unloaddevice_ca.paa", // Idle icon shown on screen + "\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_unloaddevice_ca.paa", // Progress icon shown on screen + "(([_this] call ace_common_fnc_isEngineer) || (missionNamespace getVariable 'allCanUseLogistics')) && + ( + (nearestObjects [_target, [], 15] findIf { + _x getVariable ['isOreDepot', false] + }) > -1 + ) && + (_target distance _this < 7)", // Condition for the action to be shown + "alive _target", // Condition for the action to progress + {}, // Code executed when action starts + {}, // Code executed on every progress tick + { + params ["_target", "_caller"]; + + private _depot = ( + nearestObjects [_target, [], 15] + select { + _x getVariable ["isOreDepot", false] + } + ) param [0, objNull]; + + if (isNull _depot) exitWith { + [ + "CLRK_ShowMessage", + [ + 1, + 0, + "No Ore depot nearby." + ], + _caller + ] call CBA_fnc_targetEvent; + }; + + [ + "CLRK_VehicleUnloadedOre", + [_target, _caller, _depot] + ] call CBA_fnc_serverEvent; + }, // Code executed on completion + {}, // Code executed on interrupted + [], // Arguments passed to the scripts as _this select 3 + 5, // Action duration in seconds + 0, // Priority + false, // Remove on completion + false, // Show in unconscious state + true // Show on screen +] call BIS_fnc_holdActionAdd; \ No newline at end of file diff --git a/Addons/logistics/functions/modules/fn_moduleInitEngineeringBay.sqf b/Addons/logistics/functions/modules/fn_moduleInitEngineeringBay.sqf new file mode 100644 index 0000000..e69de29 diff --git a/Addons/logistics/functions/modules/fn_moduleInitFOB.sqf b/Addons/logistics/functions/modules/fn_moduleInitFOB.sqf new file mode 100644 index 0000000..e69de29 diff --git a/Addons/logistics/functions/modules/fn_moduleInitFactory.sqf b/Addons/logistics/functions/modules/fn_moduleInitFactory.sqf new file mode 100644 index 0000000..e69de29 diff --git a/Addons/logistics/functions/modules/fn_moduleInitHQ.sqf b/Addons/logistics/functions/modules/fn_moduleInitHQ.sqf new file mode 100644 index 0000000..e6b0aba --- /dev/null +++ b/Addons/logistics/functions/modules/fn_moduleInitHQ.sqf @@ -0,0 +1,13 @@ +params [ + ["_logic", objNull, [objNull]], // Argument 0 is module logic + ["_units", [], [[]]], // Argument 1 is a list of affected units (affected by value selected in the 'class Units' argument)) + ["_activated", true, [true]] // True when the module was activated, false when it is deactivated (i.e., synced triggers are no longer active) +]; + +if (!_activated) exitWith {}; + +private _side = _logic getVariable ["Side", -1]; + +{ + [_x, _side] remoteExec [QFUNC(initHQ), 2]; +} forEach synchronizedObjects _logic; diff --git a/Addons/logistics/functions/modules/fn_moduleInitMaterielDepot.sqf b/Addons/logistics/functions/modules/fn_moduleInitMaterielDepot.sqf new file mode 100644 index 0000000..e69de29 diff --git a/Addons/logistics/functions/modules/fn_moduleInitOreDepot.sqf b/Addons/logistics/functions/modules/fn_moduleInitOreDepot.sqf new file mode 100644 index 0000000..e69de29 diff --git a/Addons/logistics/functions/modules/fn_moduleInitSupplyVehicle.sqf b/Addons/logistics/functions/modules/fn_moduleInitSupplyVehicle.sqf new file mode 100644 index 0000000..e69de29 diff --git a/Addons/logistics/initSettings.inc.sqf b/Addons/logistics/initSettings.inc.sqf new file mode 100644 index 0000000..e3b5142 --- /dev/null +++ b/Addons/logistics/initSettings.inc.sqf @@ -0,0 +1,13 @@ +/* +[ + QXGVAR(settingHint), + "LIST", + [LLSTRING(settingHint), LLSTRING(settingHintDesc)], + LLSTRING(settingsCategory), + [ + [0, 1, 2], + [LLSTRING(settingHintNone), LLSTRING(settingHintHasTool), LLSTRING(settingHintEveryone)], + 2 + ] +] call CBA_fnc_addSetting; +*/ \ No newline at end of file diff --git a/Addons/logistics/script_component.hpp b/Addons/logistics/script_component.hpp index 34a8a15..303375e 100644 --- a/Addons/logistics/script_component.hpp +++ b/Addons/logistics/script_component.hpp @@ -3,7 +3,7 @@ #include "\z\clf\addons\logistics\script_mod.hpp" // #define DEBUG_MODE_FULL -// #define DISABLE_COMPILE_CACHE +#define DISABLE_COMPILE_CACHE // #define ENABLE_PERFORMANCE_COUNTERS //#ifdef DEBUG_ENABLED_MAIN diff --git a/Addons/logistics/script_macros.hpp b/Addons/logistics/script_macros.hpp index e69de29..a62ce7d 100644 --- a/Addons/logistics/script_macros.hpp +++ b/Addons/logistics/script_macros.hpp @@ -0,0 +1,14 @@ +#include "\x\cba\addons\main\script_macros_common.hpp" +#include "\x\cba\addons\xeh\script_xeh.hpp" + +// New PREP macros +#undef PREP +#ifdef DISABLE_COMPILE_CACHE + // no compile cache + #define PREP(fncName) TRIPLES(ADDON,fnc,fncName) = compile preprocessFileLineNumbers QPATHTOF(functions\DOUBLES(fnc,fncName).sqf) + #define PREP_S(fncName,subfolder) TRIPLES(ADDON,fnc,fncName) = compile preprocessFileLineNumbers QPATHTOF(functions\subfolder\DOUBLES(fnc,fncName).sqf) +#else + // compile cache + #define PREP(fncName) [QPATHTOF(functions\DOUBLES(fnc,fncName).sqf), QFUNC(fncName)] call CBA_fnc_compileFunction + #define PREP_S(fncName,subfolder) [QPATHTOF(functions\subfolder\DOUBLES(fnc,fncName).sqf), QFUNC(fncName)] call CBA_fnc_compileFunction +#endif \ No newline at end of file diff --git a/Addons/logistics/script_mod.hpp b/Addons/logistics/script_mod.hpp index 483f9ed..8e61759 100644 --- a/Addons/logistics/script_mod.hpp +++ b/Addons/logistics/script_mod.hpp @@ -2,6 +2,9 @@ #define MAINPREFIX z #define PREFIX clf +#define SUBPREFIX addons + +#define ADDON DOUBLES(PREFIX,COMPONENT) #include "script_version.hpp" @@ -23,4 +26,4 @@ #else #define COMPONENT_NAME QUOTE(CLF - COMPONENT_BEAUTIFIED) #endif -*/ \ No newline at end of file +*/