First module appearing in 3den (not zeus yet). Created custom PREP macros for compiling functions similar to CBA/ACE.

This commit is contained in:
Clarky committed 2026-08-28 18:14:49 +10:00
1 parent 2a7c28af5f
commit c5755fb259
42 files changed
+1805 -7

No files matched your search

Binary file not shown.
+1
View File
@@ -0,0 +1 @@
z\clf\addons\logistics
@@ -0,0 +1,7 @@
/*
class CfgEditorSubcategories {
class GVAR(subcategory) {
displayName = CSTRING(Category_Logistics);
};
};
*/
+8
View File
@@ -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));
}
}
+11
View File
@@ -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";
//};
};
+31
View File
@@ -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)
+1
View File
@@ -0,0 +1 @@
#include "script_component.hpp"
+51
View File
@@ -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"
+4
View File
@@ -0,0 +1,4 @@
#include "script_component.hpp"
#include "XEH_PREP.hpp"
+40
View File
@@ -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 {};
};
};
};
*/
+75
View File
@@ -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."
};
};
};
+27 -5
View File
@@ -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"
+16
View File
@@ -0,0 +1,16 @@
/*
* Author: Clarky
* Description:
* Describe the function
*
* Arguments:
* 0: Object <OBJECT>
* 1: Integer <INT>
*
* Usage:
* [_object, _integer] call CLF_fnc_template
*
*/
params ["_object", "_integer"];
@@ -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.<br />Current Load: %3/%4.",
_amount,
_vehicleCurrentMateriel + _amount,
_vehicleCurrentMateriel + _amount + _vehicleCurrentOre,
_vehicleMax
]
],
_player
] call CBA_fnc_targetEvent;
@@ -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.<br />Current Load: %3/%4.",
_amount,
_vehicleCurrentOre + _amount,
_vehicleCurrentOre + _amount + _vehicleCurrentMateriel,
_vehicleMax
]
],
_player
] call CBA_fnc_targetEvent;
@@ -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;
@@ -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;
@@ -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 <OBJECT>
* 1: Engineering Bay <OBJECT>
*
* 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
];
@@ -0,0 +1,33 @@
/*
* Author: Clarky
* Usage:
* [hq, this] call CLRK_fnc_initVehicleFactoryInteractions;
*  
* Intended to run locally on each client.
*
*/
params ["_engineering"];
_factory addAction [
"<t color='#71BDA6'>Open Vehicle Engineering</t>",
{
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
];
@@ -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 <OBJECT>
* 1: Side <STR>
*
* 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
];
@@ -0,0 +1,32 @@
/*
* Author: Clarky
* Usage:
* [this] call CLRK_fnc_initBaseHQInteractions;
*  
* Intended to run locally on each client.
*
*/
params ["_fob"];
_fob addAction [
"<t color='#FFD700'>Check Total Materiel</t>",
{
params ["_target", "_caller"];
[
"CLRK_MaterielCheck",
[
_target,
_caller
]
] call CBA_fnc_serverEvent;
},
nil,
1,
true,
false,
"",
"true",
6
];
@@ -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 <OBJECT>
* 1: Side <STR>
* 2: Conversion Rate <INT>
*
* 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;
@@ -0,0 +1,55 @@
/*
* Author: Clarky
* Usage:
* [this] call CLRK_fnc_initBaseHQInteractions;
*  
* Intended to run locally on each client.
*
*/
params ["_factory"];
_factory addAction [
"<t color='#b96331'>Check Total Ore</t>",
{
params ["_target", "_caller"];
[
"CLRK_OreCheck",
[
_target,
_caller
]
] call CBA_fnc_serverEvent;
},
nil,
1,
true,
false,
"",
"true",
6
];
_factory addAction [
"<t color='#FFD700'>Check Total Materiel</t>",
{
params ["_target", "_caller"];
[
"CLRK_MaterielCheck",
[
_target,
_caller
]
] call CBA_fnc_serverEvent;
},
nil,
1,
true,
false,
"",
"true",
6
];
@@ -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 <OBJECT>
* 1: Side <STR>
*
* 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
];
@@ -0,0 +1,79 @@
/*
* Author: Clarky
* Usage:
* [this] call CLRK_fnc_initBaseHQInteractions;
*  
* Intended to run locally on each client.
*
*/
params ["_hq"];
_hq addAction [
"<t color='#FFD700'>Check Total Materiel</t>",
{
params ["_target", "_caller"];
[
"CLRK_MaterielCheck",
[
_target,
_caller
]
] call CBA_fnc_serverEvent;
},
nil,
1,
true,
false,
"",
"true",
6
];
_hq addAction [
"<t color='#55cbda'>Check Fortify Budget</t>",
{
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 [
"<t color='#da55ce'>Add Fortify Budget - $100</t>",
{
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
];
@@ -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 <OBJECT>
* 1: Depot <OBJECT>
* 2: Max Materiel <INT>
* 3: Current Materiel <INT>
* 4: Generation Rate <INT>
*
* 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;
};
@@ -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 [
"<t color='#FFD700'>Check Materiel Status</t>",
{
params ["_target", "_caller"];
private _current =
_target getVariable ["currentMateriel", 0];
private _max =
_target getVariable ["maxMateriel", 300];
[
"CLRK_ShowMessage",
[
3,
1,
format
[
"SUPPLY DEPOT STORAGE<br />Materiel: %1 / %2",
_current,
_max
]
],
_caller
] call CBA_fnc_targetEvent;
},
nil,
1,
true,
false,
"",
"true",
6
];
@@ -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 <OBJECT>
* 1: Depot <OBJECT>
* 2: Max Ore <INT>
* 3: Current Ore <INT>
* 4: Generation Rate <INT>
*
* 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;
};
@@ -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 [
"<t color='#b96331'>Check Ore Status</t>",
{
params ["_target", "_caller"];
private _current =
_target getVariable ["currentOre", 0];
private _max =
_target getVariable ["maxOre", 300];
[
"CLRK_ShowMessage",
[
3,
1,
format
[
"ORE DEPOT STORAGE<br />Ore: %1 / %2",
_current,
_max
]
],
_caller
] call CBA_fnc_targetEvent;
},
nil,
1,
true,
false,
"",
"true",
6
];
@@ -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 <OBJECT>
* 1: Max Load <INT>
* 2: Current Materiel <INT>
* 3: Current Ore <INT>
* 4: Transfer Rate <INT>
*
* 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
];
@@ -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 [
"<t color='#FFD700'>Check Storage Status</t>",
{
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<br />Materiel: %1<br />Ore: %2<br />Capacity: %3 / %4<br />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
"<t color='#c4ff22'>Load Materiel</t>", // 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
"<t color='#c4ff22'>Unload Materiel</t>", // 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
"<t color='#b96331'>Load Ore</t>", // 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
"<t color='#b96331'>Unload Ore</t>", // 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;
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
@@ -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;
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
+13
View File
@@ -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;
*/
+1 -1
View File
@@ -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
+14
View File
@@ -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
+4 -1
View File
@@ -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
*/
*/