big CBA rework & improvements #19

Merged
hizumi merged 7 commits from implement-cba-macros-for-some-modules into develop 2024-02-06 23:14:48 -06:00
88 changed files with 193 additions and 359 deletions
Showing only changes of commit 4cfa159ee9 - Show all commits

View File

@@ -17,6 +17,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "mission_settings.hpp" #include "mission_settings.hpp"
#include "framework\script_mod.hpp"
#include "defines\ApprovedAssets.hpp" #include "defines\ApprovedAssets.hpp"
#include "defines\BattalionInfo.hpp" #include "defines\BattalionInfo.hpp"
#include "defines\DisallowedEquipment.hpp" #include "defines\DisallowedEquipment.hpp"
@@ -94,7 +95,7 @@ class Params
class cfgFunctions class cfgFunctions
{ {
#include "functions\CfgFunctions.hpp" #include "framework\CfgFunctions.hpp"
}; };

View File

@@ -2,6 +2,7 @@ class milsim
{ {
class settings class settings
{ {
file = "framework\settings";
class setDefaults { postInit = 1; }; class setDefaults { postInit = 1; };
class addCBASettings { postInit = 1; }; class addCBASettings { postInit = 1; };
class addAARChatHandler { postInit = 1; }; class addAARChatHandler { postInit = 1; };
@@ -10,11 +11,13 @@ class milsim
class init class init
{ {
file = "framework\init";
class initServer { postInit = 1;}; //needs refactor class initServer { postInit = 1;}; //needs refactor
class initPlayerLocal { postInit = 1;}; class initPlayerLocal { postInit = 1;};
}; };
class fbcb2 { class fbcb2 {
file = "framework\fbcb2";
class initFBCB2 { postInit = 1; }; class initFBCB2 { postInit = 1; };
class processFBCB2RadioFrequencies {}; class processFBCB2RadioFrequencies {};
class processFBCB2SmokeColors {}; class processFBCB2SmokeColors {};
@@ -22,16 +25,17 @@ class milsim
class hintFBCB2AssetStatus {}; class hintFBCB2AssetStatus {};
}; };
class fbcb2_util { class fbcb2_util {
file = "functions\fbcb2\util"; file = "framework\fbcb2\util";
class createOrUpdateDiaryRecord {}; class createOrUpdateDiaryRecord {};
}; };
class fbcb2_radioFrequencies { class fbcb2_radioFrequencies {
file = "functions\fbcb2\radioFrequencies"; file = "framework\fbcb2\radioFrequencies";
class formatRadioElementForDiary {}; class formatRadioElementForDiary {};
class generateElementFrequencyRecordText {}; class generateElementFrequencyRecordText {};
}; };
class client { class client {
file = "framework\client";
class addZenModules { postInit = 1; }; class addZenModules { postInit = 1; };
class addDNI_PlayerFPS { postInit = 1; }; // needs refactor class addDNI_PlayerFPS { postInit = 1; }; // needs refactor
class bindEventHandlers { postInit = 1; }; class bindEventHandlers { postInit = 1; };
@@ -43,18 +47,21 @@ class milsim
}; };
class server { class server {
file = "framework\server";
class addServerStatsPFH {}; class addServerStatsPFH {};
class calculateServerStats {}; class calculateServerStats {};
class logPlayerInventory {}; class logPlayerInventory {};
}; };
class ambience { class ambience {
file = "framework\ambience";
class flakInitVehicle {}; class flakInitVehicle {};
class flakEH {}; class flakEH {};
}; };
class map class map
{ {
file = "framework\map";
class initMapCopy { postInit = 1; }; class initMapCopy { postInit = 1; };
class copyMapFromPlayer {}; //needs refactor class copyMapFromPlayer {}; //needs refactor
class getPlayerMapMarkers {}; //needs refactor class getPlayerMapMarkers {}; //needs refactor
@@ -62,9 +69,11 @@ class milsim
class mapMarkerToString {}; //needs refactor class mapMarkerToString {}; //needs refactor
class stringToMapMarker {}; //needs refactor class stringToMapMarker {}; //needs refactor
}; };
};
class util class milsim_util {
{ class functions {
file = "framework\util";
class logMissionInfo { postInit = 1; }; class logMissionInfo { postInit = 1; };
class addPlayerInfoToArray {}; class addPlayerInfoToArray {};
class log {}; class log {};
@@ -78,14 +87,9 @@ class milsim
class milsim_resupply { class milsim_resupply {
class functions { class functions {
file = "functions\resupply"; file = "framework\resupply\functions";
class createAmmoBox {}; class init {postInit=1;};
class createBox {}; class createBox {};
class createCSWBox {};
class createLaunchersBox {};
class createMedicalBox {};
class createMortarBox {};
class createWeaponsBox {};
class getSupplyCratesCfg {}; class getSupplyCratesCfg {};
class addArsenalObjectSpawnBoxActions {}; class addArsenalObjectSpawnBoxActions {};
class addCBASettings {postInit=1;}; class addCBASettings {postInit=1;};
@@ -94,7 +98,7 @@ class milsim_resupply {
class milsim_fbcb2_assets { class milsim_fbcb2_assets {
class functions { class functions {
file = "functions\fbcb2\assets"; file = "framework\fbcb2\assets";
class updateAssetDiary {}; class updateAssetDiary {};
class removeAssetDiaryRecords {}; class removeAssetDiaryRecords {};
class getMagsForWeapon {}; class getMagsForWeapon {};
@@ -103,21 +107,31 @@ class milsim_fbcb2_assets {
class getVehicleData {}; class getVehicleData {};
}; };
class assetsByBase { class assetsByBase {
file = "functions\fbcb2\assets\byBase"; file = "framework\fbcb2\assets\byBase";
class getAssetsByBase {}; class getAssetsByBase {};
class getStartingAssetsByBase {}; class getStartingAssetsByBase {};
class updateAssetsByBase {}; class updateAssetsByBase {};
}; };
class markers { class markers {
file = "functions\fbcb2\assets\markers"; file = "framework\fbcb2\assets\markers";
class showMarkersOnMap {}; class showMarkersOnMap {};
class removeMarkersOnMap {}; class removeMarkersOnMap {};
} };
};
class milsim_vehicleFlags {
class functions {
file = "framework\vehicleFlags\functions";
class init {postInit=1;};
class getActionsFlagCategories {};
class getVehicleFlagsCfg {};
class isClassExcluded {};
};
}; };
class milsim_reinsert { class milsim_reinsert {
class server { class server {
file = "functions\reinsert\server"; file = "framework\reinsert\server";
class initServer { postInit = 1; }; class initServer { postInit = 1; };
class addToQueue {}; class addToQueue {};
class globalShowQueue {}; class globalShowQueue {};
@@ -126,20 +140,10 @@ class milsim_reinsert {
class validateQueue {}; class validateQueue {};
}; };
class client { class client {
file = "functions\reinsert\client"; file = "framework\reinsert\client";
class initClient { postInit = 1; }; class initClient { postInit = 1; };
class addAceSelfActions {}; class addAceSelfActions {};
class addCheckQueueSelfAction {}; class addCheckQueueSelfAction {};
class requestShowQueue {}; class requestShowQueue {};
}; };
};
class milsim_vehicleFlags {
class functions {
file = "functions\vehicleFlags";
class initVehicleFlags {postInit = 1};
class getActionsFlagCategories {};
class getVehicleFlagsCfg {};
class isClassExcluded{};
};
}; };

View File

@@ -8,8 +8,8 @@ player addEventHandler["Respawn",
[ [
"client", "client",
"RESPAWNED WHILE UNCONSCIOUS", "RESPAWNED WHILE UNCONSCIOUS",
[_unit] call milsim_fnc_addPlayerInfoToArray [_unit] call milsim_util_fnc_addPlayerInfoToArray
] remoteExec ["milsim_fnc_log", 2]; ] remoteExec ["milsim_util_fnc_log", 2];
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0]; // format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
}; };
} }
@@ -43,11 +43,11 @@ addMissionEventHandler ["HandleChatMessage",
["ace_arsenal_displayClosed", { ["ace_arsenal_displayClosed", {
[player] remoteExec ["milsim_fnc_logPlayerInventory", 2]; [player] remoteExec ["milsim_util_fnc_logPlayerInventory", 2];
}] call CBA_fnc_addEventHandler; }] call CBA_fnc_addEventHandler;
[missionNamespace, "arsenalClosed", { [missionNamespace, "arsenalClosed", {
[player] remoteExec ["milsim_fnc_logPlayerInventory", 2]; [player] remoteExec ["milsim_util_fnc_logPlayerInventory", 2];
}] call BIS_fnc_addScriptedEventHandler; }] call BIS_fnc_addScriptedEventHandler;
diag_log text "[MILSIM] (client) event handlers bound"; diag_log text "[MILSIM] (client) event handlers bound";

View File

@@ -23,7 +23,7 @@ private _assetsStartedAtThisBaseVar = "milsim_fbcb2_assets_assetsStartedAtThisBa
private _asset = _x; private _asset = _x;
// avoid duplicates // avoid duplicates
if (_asset in _allSaved) then {continue}; if (_asset in _allSaved) then {continue};
private _closestBase = [_asset] call milsim_fnc_getNearestBase; private _closestBase = [_asset] call milsim_util_fnc_getNearestBase;
if (isNull _closestBase) then { if (isNull _closestBase) then {
// no base found // no base found
continue; continue;
@@ -66,7 +66,7 @@ private _assetsStartedAtThisBaseVar = "milsim_fbcb2_assets_assetsStartedAtThisBa
// avoid duplicates // avoid duplicates
if (_asset in _allSaved) then {continue}; if (_asset in _allSaved) then {continue};
private _closestBase = [_asset] call milsim_fnc_getNearestBase; private _closestBase = [_asset] call milsim_util_fnc_getNearestBase;
if (isNull _closestBase) then { if (isNull _closestBase) then {
// no base found // no base found
continue; continue;
@@ -156,10 +156,10 @@ if !(_isInit || _logCurrentAssets) exitWith {};
"fbcb2_assets", "fbcb2_assets",
"CURRENT ASSETS", "CURRENT ASSETS",
[ [
["baseName", [[_base] call milsim_fnc_getNameOfBase]], ["baseName", [[_base] call milsim_util_fnc_getNameOfBase]],
["asset", _x] ["asset", _x]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
} forEach _baseAssetsHashes; } forEach _baseAssetsHashes;
}; };
@@ -170,10 +170,10 @@ if !(_isInit || _logCurrentAssets) exitWith {};
"fbcb2_assets", "fbcb2_assets",
"STARTING ASSETS", "STARTING ASSETS",
[ [
["baseName", [[_base] call milsim_fnc_getNameOfBase]], ["baseName", [[_base] call milsim_util_fnc_getNameOfBase]],
["asset", _x] ["asset", _x]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
} forEach _baseAssetsHashes; } forEach _baseAssetsHashes;
}; };
} forEach milsim_baseObjects; } forEach milsim_baseObjects;

View File

@@ -180,6 +180,6 @@ private _distinctVehiclesClassNames = [];
["assetCount", count _vehicles], ["assetCount", count _vehicles],
["distinctAssetCount", count _distinctVehiclesClassNames] ["distinctAssetCount", count _distinctVehiclesClassNames]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
true; true;

View File

@@ -61,7 +61,7 @@ if (not (count _baseMarkerStore > 0)) then {
_newMarker setMarkerTypeLocal "mil_flag"; _newMarker setMarkerTypeLocal "mil_flag";
_newMarker setMarkerColorLocal "ColorGreen"; _newMarker setMarkerColorLocal "ColorGreen";
_newMarker setMarkerSizeLocal [0.7, 0.7]; _newMarker setMarkerSizeLocal [0.7, 0.7];
_newMarker setMarkerTextLocal ([_base] call milsim_fnc_getNameOfBase); _newMarker setMarkerTextLocal ([_base] call milsim_util_fnc_getNameOfBase);
_baseMarkerStore pushBack [ _baseMarkerStore pushBack [
_base, _base,

View File

@@ -4,7 +4,7 @@
//////////////////////////////////////// ////////////////////////////////////////
// Get info from missionConfigFile // Get info from missionConfigFile
//////////////////////////////////////// ////////////////////////////////////////
private _battalionInfoCfg = call milsim_fnc_getBattalionCfg; private _battalionInfoCfg = call milsim_util_fnc_getBattalionCfg;
private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren; private _battalionElementCfgs = [_battalionInfoCfg >> "Command"] call BIS_fnc_returnChildren;
//////////////////////////////////////// ////////////////////////////////////////

View File

@@ -62,8 +62,8 @@ _freqLeadingSpace = _freqLeadingSpace joinString "";
_ELEMENT_FREQ_SIZE, _ELEMENT_FREQ_SIZE,
_ELEMENT_FREQ_FONT, _ELEMENT_FREQ_FONT,
_FREQ_TEXT_COLOR, _FREQ_TEXT_COLOR,
[_role, "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString, [_role, "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString,
[_srStr, "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString, [_srStr, "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString,
_lrStr _lrStr
]; ];
} forEach (getArray (_cfg >> "frequencies")); } forEach (getArray (_cfg >> "frequencies"));

View File

@@ -51,8 +51,8 @@ private _headers = [
_ELEMENT_FREQ_SIZE, _ELEMENT_FREQ_SIZE,
_ELEMENT_FREQ_FONT, _ELEMENT_FREQ_FONT,
_FREQ_TEXT_COLOR, _FREQ_TEXT_COLOR,
["ROLE", "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString, ["ROLE", "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString,
["SR", "right", " ", _FREQ_PAD_LENGTH] call milsim_fnc_padString, ["SR", "right", " ", _FREQ_PAD_LENGTH] call milsim_util_fnc_padString,
"LR" "LR"
] ]
]; ];
@@ -71,7 +71,7 @@ if (_shouldProcessChildCfgs) then {
private _lines = [_cfg, _recurseCounter+1] call milsim_fnc_formatRadioElementForDiary; private _lines = [_cfg, _recurseCounter+1] call milsim_fnc_formatRadioElementForDiary;
// private _lines = [_cfg, _indentCount] call t; // private _lines = [_cfg, _indentCount] call t;
_allText pushBack (_lines joinString "<br/>"); _allText pushBack (_lines joinString "<br/>");
}] call milsim_fnc_recurseSubclasses; }] call milsim_util_fnc_recurseSubclasses;
} else { } else {
// or if the param was false, just add the battalion element // or if the param was false, just add the battalion element
private _lines = [_battalionElement, 1] call milsim_fnc_formatRadioElementForDiary; private _lines = [_battalionElement, 1] call milsim_fnc_formatRadioElementForDiary;

View File

@@ -0,0 +1,14 @@
if ( !hasInterface ) exitWith {};
if (!isServer) then {
["milsim_logText", {
params [["_strArray", [""], [[]]]];
{
diag_log text _x;
} forEach _strArray;
}] call CBA_fnc_addEventHandler;
};
["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups;
nil;

View File

@@ -13,8 +13,8 @@ private _fileForReinsertAction = [
{ // statement { // statement
params ["_target", "_player", "_params"]; params ["_target", "_player", "_params"];
// find nearest base or location // find nearest base or location
private _base = [_player] call milsim_fnc_getNearestBase; private _base = [_player] call milsim_util_fnc_getNearestBase;
private _baseName = [_base] call milsim_fnc_getNameOfBase; private _baseName = [_base] call milsim_util_fnc_getNameOfBase;
// send event to server // send event to server
["milsim_reinsert_fileReinsertRequest", [_player, _base]] call CBA_fnc_serverEvent; ["milsim_reinsert_fileReinsertRequest", [_player, _base]] call CBA_fnc_serverEvent;
// notify player their request was filed // notify player their request was filed
@@ -23,7 +23,7 @@ private _fileForReinsertAction = [
{ // condition { // condition
params ["_target", "_player", "_params"]; params ["_target", "_player", "_params"];
// find nearest base or location // find nearest base or location
private _base = [_player] call milsim_fnc_getNearestBase; private _base = [_player] call milsim_util_fnc_getNearestBase;
private _baseDistance = _player distance _base; private _baseDistance = _player distance _base;
private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400]; private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_setting_reinsertion_maxRangeToReady", 400];

View File

@@ -12,7 +12,7 @@ if (!isServer) exitWith {
["player", _player], ["player", _player],
["base", _base] ["base", _base]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
}; };
if ( if (
isNull _player || isNull _player ||
@@ -25,7 +25,7 @@ if (
["player", _player], ["player", _player],
["base", _base] ["base", _base]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
}; };
@@ -41,16 +41,16 @@ publicVariable "milsim_reinsert_reinsertionQueue";
// log to rpt // log to rpt
private _logParams = [ private _logParams = [
["filedAtBase", [_base] call milsim_fnc_getNameOfBase], ["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
["filedAtBaseDistance", _player distance _base], ["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call milsim_fnc_getNameOfBase], ["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
["closestBaseDistance", _player distance _nearestBase], ["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady], ["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled] ["inQueueDuration", diag_tickTime - _timeFiled]
]; ];
_logParams = [_player, _logParams] call milsim_fnc_addPlayerInfoToArray; _logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
[ [
"respawn_reinsertion", "respawn_reinsertion",
"PLAYER FILED REQUEST", "PLAYER FILED REQUEST",
_logParams _logParams
] call milsim_fnc_log; ] call milsim_util_fnc_log;

View File

@@ -21,7 +21,7 @@ if (count _timeoutPlayers > 0) then {
private _thisBase = _x; private _thisBase = _x;
// Add line for base name // Add line for base name
_playerLines pushBack ([[_thisBase] call milsim_fnc_getNameOfBase, 1, [0,1,0,1]]); _playerLines pushBack ([[_thisBase] call milsim_util_fnc_getNameOfBase, 1, [0,1,0,1]]);
// Get players under this base // Get players under this base
private _thisBasePlayers = _timeoutPlayers select {_x#1 isEqualTo _thisBase}; private _thisBasePlayers = _timeoutPlayers select {_x#1 isEqualTo _thisBase};
@@ -35,7 +35,7 @@ if (count _timeoutPlayers > 0) then {
{ // for each player under this base, add a line { // for each player under this base, add a line
_x params ["_player", "_base", "_timeFiled"]; _x params ["_player", "_base", "_timeFiled"];
// get the closest base to the player // get the closest base to the player
private _nearestBase = [_player] call milsim_fnc_getNearestBase; private _nearestBase = [_player] call milsim_util_fnc_getNearestBase;
// add player to array of players under bases // add player to array of players under bases
_playerLines pushBack ([format [ _playerLines pushBack ([format [
@@ -47,19 +47,19 @@ if (count _timeoutPlayers > 0) then {
// log to rpt // log to rpt
private _logParams = [ private _logParams = [
["filedAtBase", [_base] call milsim_fnc_getNameOfBase], ["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
["filedAtBaseDistance", _player distance _base], ["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call milsim_fnc_getNameOfBase], ["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
["closestBaseDistance", _player distance _nearestBase], ["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady], ["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled] ["inQueueDuration", diag_tickTime - _timeFiled]
]; ];
_logParams = [_player, _logParams] call milsim_fnc_addPlayerInfoToArray; _logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
[ [
"respawn_reinsertion", "respawn_reinsertion",
"PLAYER WAITING OVER TIMEOUT", "PLAYER WAITING OVER TIMEOUT",
_logParams _logParams
] call milsim_fnc_log; ] call milsim_util_fnc_log;
} forEach _thisBasePlayers; } forEach _thisBasePlayers;
} forEach _basesWithPeople; } forEach _basesWithPeople;

View File

@@ -7,7 +7,7 @@ if (!isServer) exitWith {
[ [
["player", _player] ["player", _player]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
}; };
if (isNull _player) exitWith { if (isNull _player) exitWith {
[ [
@@ -16,7 +16,7 @@ if (isNull _player) exitWith {
[ [
["player", _player] ["player", _player]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
}; };
// get entries for this player from queue // get entries for this player from queue
@@ -39,19 +39,19 @@ publicVariable "milsim_reinsert_reinsertionQueue";
// get first entry (longest wait) // get first entry (longest wait)
(_unitArrs#0) params ["_player", "_base", "_timeFiled"]; // _unitArr = [unit, base, timeInQueue] (_unitArrs#0) params ["_player", "_base", "_timeFiled"]; // _unitArr = [unit, base, timeInQueue]
// get the closest base to the player // get the closest base to the player
private _nearestBase = [_player] call milsim_fnc_getNearestBase; private _nearestBase = [_player] call milsim_util_fnc_getNearestBase;
// log to rpt // log to rpt
private _logParams = [ private _logParams = [
["filedAtBase", [_base] call milsim_fnc_getNameOfBase], ["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
["filedAtBaseDistance", _player distance _base], ["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call milsim_fnc_getNameOfBase], ["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
["closestBaseDistance", _player distance _nearestBase], ["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady], ["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled] ["inQueueDuration", diag_tickTime - _timeFiled]
]; ];
_logParams = [_player, _logParams] call milsim_fnc_addPlayerInfoToArray; _logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
[ [
"respawn_reinsertion", "respawn_reinsertion",
"PLAYER RESCINDED REQUEST", "PLAYER RESCINDED REQUEST",
_logParams _logParams
] call milsim_fnc_log; ] call milsim_util_fnc_log;

View File

@@ -25,12 +25,12 @@ if (isNull _userObject) exitWith {
}; };
// log to rpt // log to rpt
private _logParams = [_userObject, []] call milsim_fnc_addPlayerInfoToArray; private _logParams = [_userObject, []] call milsim_util_fnc_addPlayerInfoToArray;
[ [
"respawn_reinsertion", "respawn_reinsertion",
"SHOW QUEUE REQUESTED", "SHOW QUEUE REQUESTED",
_logParams _logParams
] call milsim_fnc_log; ] call milsim_util_fnc_log;
private _queue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []]; private _queue = missionNamespace getVariable ["milsim_reinsert_reinsertionQueue", []];
// get base objects from queue // get base objects from queue
@@ -48,7 +48,7 @@ if (count _basesWithPeople isEqualTo 0) then {
// forEach _basesWithPeople // forEach _basesWithPeople
{ {
private _thisBase = _x; private _thisBase = _x;
private _baseName = [_thisBase] call milsim_fnc_getNameOfBase; private _baseName = [_thisBase] call milsim_util_fnc_getNameOfBase;
// generate player lines for this base // generate player lines for this base
private _playerLines = _queue select { private _playerLines = _queue select {

View File

@@ -7,26 +7,26 @@ private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_settin
private _distanceToOriginalBase = _player distance _base; private _distanceToOriginalBase = _player distance _base;
// get the closest base to the player // get the closest base to the player
private _nearestBase = [_player] call milsim_fnc_getNearestBase; private _nearestBase = [_player] call milsim_util_fnc_getNearestBase;
private _isCloseEnoughToAnyBase = (_player distance _nearestBase) < _maxRangeToReady; private _isCloseEnoughToAnyBase = (_player distance _nearestBase) < _maxRangeToReady;
if (not _isCloseEnoughToAnyBase || not (alive _player)) then { if (not _isCloseEnoughToAnyBase || not (alive _player)) then {
// don't include player in updated queue // don't include player in updated queue
// log to rpt // log to rpt
private _logParams = [ private _logParams = [
["filedAtBase", [_base] call milsim_fnc_getNameOfBase], ["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
["filedAtBaseDistance", _player distance _base], ["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call milsim_fnc_getNameOfBase], ["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
["closestBaseDistance", _player distance _nearestBase], ["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady], ["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled] ["inQueueDuration", diag_tickTime - _timeFiled]
]; ];
_logParams = [_player, _logParams] call milsim_fnc_addPlayerInfoToArray; _logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
[ [
"respawn_reinsertion", "respawn_reinsertion",
"PLAYER DEQUEUED AUTOMATICALLY", "PLAYER DEQUEUED AUTOMATICALLY",
_logParams _logParams
] call milsim_fnc_log; ] call milsim_util_fnc_log;
// continue loop // continue loop
continue continue
}; };
@@ -36,19 +36,19 @@ private _maxRangeToReady = missionNamespace getVariable ["milsim_reinsert_settin
// if player's base has changed, log to rpt // if player's base has changed, log to rpt
if (_base != _nearestBase) then { if (_base != _nearestBase) then {
private _logParams = [ private _logParams = [
["filedAtBase", [_base] call milsim_fnc_getNameOfBase], ["filedAtBase", [_base] call milsim_util_fnc_getNameOfBase],
["filedAtBaseDistance", _player distance _base], ["filedAtBaseDistance", _player distance _base],
["closestBase", [_nearestBase] call milsim_fnc_getNameOfBase], ["closestBase", [_nearestBase] call milsim_util_fnc_getNameOfBase],
["closestBaseDistance", _player distance _nearestBase], ["closestBaseDistance", _player distance _nearestBase],
["maxDistanceSetting", _maxRangeToReady], ["maxDistanceSetting", _maxRangeToReady],
["inQueueDuration", diag_tickTime - _timeFiled] ["inQueueDuration", diag_tickTime - _timeFiled]
]; ];
_logParams = [_player, _logParams] call milsim_fnc_addPlayerInfoToArray; _logParams = [_player, _logParams] call milsim_util_fnc_addPlayerInfoToArray;
[ [
"respawn_reinsertion", "respawn_reinsertion",
"PLAYER BASE WAS UPDATED", "PLAYER BASE WAS UPDATED",
_logParams _logParams
] call milsim_fnc_log; ] call milsim_util_fnc_log;
}; };
} forEach milsim_reinsert_reinsertionQueue; } forEach milsim_reinsert_reinsertionQueue;

View File

@@ -1,3 +1,5 @@
#include "..\script_component.hpp"
// adds a scroll wheel action to all arsenal boxes to spawn different supply crate types // adds a scroll wheel action to all arsenal boxes to spawn different supply crate types
private _arsenalBoxClassName = "Land_PaperBox_open_full_F"; private _arsenalBoxClassName = "Land_PaperBox_open_full_F";
@@ -8,7 +10,7 @@ private _arsenalBoxes = (allMissionObjects _arsenalBoxClassName) select {
count (actionIDs _x) > 0; count (actionIDs _x) > 0;
}; };
private _supplyCratesCfg = call milsim_resupply_fnc_getSupplyCratesCfg; private _supplyCratesCfg = call FUNC(getSupplyCratesCfg);
private _supplyCrateTypesCfgs = _supplyCratesCfg call BIS_fnc_returnChildren; private _supplyCrateTypesCfgs = _supplyCratesCfg call BIS_fnc_returnChildren;
{ {
@@ -25,7 +27,7 @@ private _supplyCrateTypesCfgs = _supplyCratesCfg call BIS_fnc_returnChildren;
objNull, objNull,
configName _supplyCrateCfg, configName _supplyCrateCfg,
getPos _target getPos _target
] call milsim_resupply_fnc_createBox; ] call FUNC(createBox);
}, [_cfg], 0, false, true, "", ""]; }, [_cfg], 0, false, true, "", ""];
} forEach _supplyCrateTypesCfgs; } forEach _supplyCrateTypesCfgs;
} forEach _arsenalBoxes; } forEach _arsenalBoxes;

View File

@@ -0,0 +1,25 @@
#include "..\script_component.hpp"
[
QGVAR(setting_allowSupplyBoxScrollWheelSpawning), // variable
"CHECKBOX", // type
["Allow Spawning Boxes from Arsenal Box", "If true, adds scroll wheel options to arsenal boxes to spawn supply boxes"], // title
[QUOTE(SETTINGS_GROUP_NAME), QUOTE(COMPONENT_BEAUTIFIED)], // category
false, // default value
true, // global setting
{
params ["_value"];
[
QUOTE(COMPONENT),
"SETTING CHANGED",
[
[
"setting",
QGVAR(setting_allowSupplyBoxScrollWheelSpawning)
],
["newValue", _value]
]
] call EFUNC(util,log);
},
true // requires mission restart
] call CBA_fnc_addSetting;

View File

@@ -27,7 +27,8 @@
["weapon", (weaponCargo cursorObject) call BIS_fnc_consolidateArray] ["weapon", (weaponCargo cursorObject) call BIS_fnc_consolidateArray]
]]; ]];
*/ */
#include "..\script_component.hpp"
params [ params [
["_box", objNull, [objNull]], ["_box", objNull, [objNull]],
@@ -36,7 +37,7 @@ params [
]; ];
// get defs class // get defs class
private _supplyCratesCfg = call milsim_resupply_fnc_getSupplyCratesCfg; private _supplyCratesCfg = call FUNC(getSupplyCratesCfg);
if (!isClass _supplyCratesCfg) exitWith { if (!isClass _supplyCratesCfg) exitWith {
["Resupply Boxes: Failed to load crate definitions, possibly a bad edit?"] call BIS_fnc_error; ["Resupply Boxes: Failed to load crate definitions, possibly a bad edit?"] call BIS_fnc_error;
objNull; objNull;

View File

@@ -0,0 +1,2 @@
#include "..\script_component.hpp"
(missionConfigFile >> "SupplyCrates");

View File

@@ -0,0 +1,12 @@
#include "..\script_component.hpp"
// 5 seconds after the client is loaded, add the resupply action to all arsenal boxes
[
{time > 5},
{
if (missionNamespace getVariable [
QGVAR(setting_allowSupplyBoxScrollWheelSpawning),
false
]) then {call FUNC(addSpawnBoxActions)}
}
] call CBA_fnc_waitUntilAndExecute;

View File

@@ -0,0 +1,3 @@
#define COMPONENT resupply
#define COMPONENT_BEAUTIFIED Resupply
#include "../script_mod.hpp"

View File

@@ -0,0 +1,5 @@
// all text before cba include
#define SETTINGS_GROUP_NAME 17th Battalion
#include "\x\cba\addons\main\script_macros_mission.hpp"

10
framework/script_mod.hpp Normal file
View File

@@ -0,0 +1,10 @@
#define PREFIX milsim
#include "script_version.hpp"
#define VERSION MAJOR.MINOR.PATCHLVL
#define VERSION_STR MAJOR.MINOR.PATCHLVL
#define VERSION_AR MAJOR,MINOR,PATCHLVL
// should always be last
#include "script_macros.hpp"

View File

@@ -0,0 +1,4 @@
#define MAJOR 3
#define MINOR 2
#define PATCHLVL 1
#define BUILD 0

View File

@@ -1,5 +1,5 @@
/* /*
Function: milsim_fnc_logPlayerInventory Function: milsim_util_fnc_logPlayerInventory
Description: Description:
Checks a player's inventory for non-compliant items and logs results to all machines. Checks a player's inventory for non-compliant items and logs results to all machines.
@@ -22,7 +22,7 @@ if (!isPlayer _player) exitWith {
"logPlayerInventory", "logPlayerInventory",
"PARAM PLAYER IS NOT A PLAYER", "PARAM PLAYER IS NOT A PLAYER",
[["player", _player]] [["player", _player]]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
}; };
// testing // testing
@@ -55,8 +55,8 @@ _playerItems pushBack (uniform _player);
[ [
"logPlayerInventory", "logPlayerInventory",
"CHECKING PLAYER INVENTORY", "CHECKING PLAYER INVENTORY",
[_player] call milsim_fnc_addPlayerInfoToArray [_player] call milsim_util_fnc_addPlayerInfoToArray
] call milsim_fnc_log; ] call milsim_util_fnc_log;
//////////////////////////////////////// ////////////////////////////////////////
// HARDCODED DISALLOWED ITEMS - see functions/definitions/DisallowedEquipment.hpp // HARDCODED DISALLOWED ITEMS - see functions/definitions/DisallowedEquipment.hpp
@@ -117,8 +117,8 @@ if (count _allFoundItemsSoFar isEqualTo 0) exitWith {
[ [
"logPlayerInventory", "logPlayerInventory",
"PLAYER INVENTORY IS COMPLIANT", "PLAYER INVENTORY IS COMPLIANT",
[_player] call milsim_fnc_addPlayerInfoToArray [_player] call milsim_util_fnc_addPlayerInfoToArray
] call milsim_fnc_log; ] call milsim_util_fnc_log;
}; };
// Log all non-compliant items // Log all non-compliant items
@@ -138,7 +138,7 @@ if (count _allFoundItemsSoFar isEqualTo 0) exitWith {
["category", _categoryLabel], ["category", _categoryLabel],
["className", _itemClassName], ["className", _itemClassName],
["displayName", [_itemConfig] call BIS_fnc_displayName] ["displayName", [_itemConfig] call BIS_fnc_displayName]
]] call milsim_fnc_addPlayerInfoToArray ]] call milsim_util_fnc_addPlayerInfoToArray
] call milsim_fnc_log; ] call milsim_util_fnc_log;
} forEach _items; } forEach _items;
} forEach _foundItemsKeyValue; } forEach _foundItemsKeyValue;

View File

@@ -146,7 +146,7 @@
], ],
["newValue", _value] ["newValue", _value]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
} }
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
@@ -169,7 +169,7 @@
], ],
["newValue", _value] ["newValue", _value]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
} }
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
@@ -192,7 +192,7 @@
], ],
["newValue", _value] ["newValue", _value]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
} }
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
@@ -215,7 +215,7 @@
], ],
["newValue", _value] ["newValue", _value]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
} }
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
@@ -238,7 +238,7 @@
], ],
["newValue", _value] ["newValue", _value]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
} }
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;
@@ -264,7 +264,7 @@
], ],
["newValue", _value] ["newValue", _value]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;
} }
] call CBA_fnc_addSetting; ] call CBA_fnc_addSetting;

View File

@@ -8,8 +8,8 @@
[ [
"init", "init",
"CHAT COMMAND RESPAWN", "CHAT COMMAND RESPAWN",
[player] call milsim_fnc_addPlayerInfoToArray [player] call milsim_util_fnc_addPlayerInfoToArray
] remoteExec ["milsim_fnc_log", 2]; ] remoteExec ["milsim_util_fnc_log", 2];
// systemChat to all remote machines // systemChat to all remote machines
format["%1 claims they were glitched and respawned (%2)", name player, netID player] remoteExec["systemChat", -_clientID]; format["%1 claims they were glitched and respawned (%2)", name player, netID player] remoteExec["systemChat", -_clientID];

View File

@@ -1,5 +1,5 @@
/* /*
Function: milsim_fnc_log Function: milsim_util_fnc_log
Description: Description:
Used to log messages to the server RPT file. Used to log messages to the server RPT file.

View File

@@ -20,4 +20,4 @@
["LOGIC", playableSlotsNumber sideLogic] // 5 is LOGIC side ["LOGIC", playableSlotsNumber sideLogic] // 5 is LOGIC side
]] ]]
] ]
] call milsim_fnc_log; ] call milsim_util_fnc_log;

View File

@@ -1,6 +1,8 @@
if (!hasInterface) exitWith {}; if (!hasInterface) exitWith {};
private _vehicleFlagsCfg = call milsim_vehicleFlags_fnc_getVehicleFlagsCfg; #include "..\script_component.hpp"
private _vehicleFlagsCfg = call FUNC(getVehicleFlagsCfg);
if (!isClass _vehicleFlagsCfg) exitWith { if (!isClass _vehicleFlagsCfg) exitWith {
["WARNING: Vehicle Flags: Vehicle Flags config not found. Vehicle Flags will not be available."] call BIS_fnc_error; ["WARNING: Vehicle Flags: Vehicle Flags config not found. Vehicle Flags will not be available."] call BIS_fnc_error;
@@ -34,7 +36,7 @@ private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_
// _params params ["_parentActionID", "_flagCategories"]; // _params params ["_parentActionID", "_flagCategories"];
// check if vehicle is excluded // check if vehicle is excluded
private _excluded = [typeOf _target] call milsim_vehicleFlags_fnc_isClassExcluded; private _excluded = [typeOf _target] call FUNC(isClassExcluded);
if (_excluded || !alive _target) exitWith {false}; if (_excluded || !alive _target) exitWith {false};
true; true;
@@ -47,7 +49,7 @@ private _flagCategoryCfgs = (_vehicleFlagsCfg >> "FlagCategories") call BIS_fnc_
_params params ["_rootActionID", "_flagCategoryCfgs"]; _params params ["_rootActionID", "_flagCategoryCfgs"];
// return category child actions with individual flag actions nested as children // return category child actions with individual flag actions nested as children
[_rootActionID, _flagCategoryCfgs] call milsim_vehicleFlags_fnc_getActionsFlagCategories; [_rootActionID, _flagCategoryCfgs] call FUNC(getActionsFlagCategories);
}, // child code }, // child code
[_rootActionID, _flagCategoryCfgs], // params [_rootActionID, _flagCategoryCfgs], // params

View File

@@ -0,0 +1,3 @@
#define COMPONENT vehicleFlags
#define COMPONENT_BEAUTIFIED Vehicle Flags
#include "../script_mod.hpp"

View File

@@ -1,25 +0,0 @@
if ( !hasInterface ) exitWith {};
if (!isServer) then {
["milsim_logText", {
params [["_strArray", [""], [[]]]];
{
diag_log text _x;
} forEach _strArray;
}] call CBA_fnc_addEventHandler;
};
// 5 seconds after the client is loaded, add the resupply action to all arsenal boxes
[
{time > 5},
{
if (missionNamespace getVariable [
"milsim_resupply_setting_allowSupplyBoxScrollWheelSpawning",
false
]) then {call milsim_resupply_fnc_addSpawnBoxActions}
}
] call CBA_fnc_waitUntilAndExecute;
["InitializePlayer", [player, true]] call BIS_fnc_dynamicGroups;
nil;

View File

@@ -1,22 +0,0 @@
[
"milsim_resupply_setting_allowSupplyBoxScrollWheelSpawning", // variable
"CHECKBOX", // type
["Enabled", "If true, adds scroll wheel options to arsenal boxes to spawn supply boxes"], // title
["17th Battalion", "Resupply"], // category
false, // default value
true, // global setting
{
params ["_value"];
[
"resupply",
"SETTING CHANGED",
[
[
"setting",
"milsim_resupply_setting_allowSupplyBoxScrollWheelSpawning"
],
["newValue", _value]
]
] call milsim_fnc_log;
}
] call CBA_fnc_addSetting;

View File

@@ -1,36 +0,0 @@
/*
* Author: Hizumi
*
* Create Ammo resupply box for the 17th Battalion
*
* Arguments:
* 0: Vehicle - <OBJECT>
* 1: Position - <ARRAY>
*
* Return Value:
* Function executed <BOOL>
*
* Example:
* [box] call milsim_fnc_createAmmoBox; // create ammo box via init line of editor object
* [objNull, pos] call milsim_fnc_createAmmoBox; // create ammo box via zeus module
*
* Public: Yes
*
* Note: For gathering:
formatText ["%1", [
["containerClassname", typeOf cursorObject],
["backpack", (backpackCargo cursorObject) call BIS_fnc_consolidateArray],
["item", (itemCargo cursorObject) call BIS_fnc_consolidateArray],
["magazine", (magazineCargo cursorObject) call BIS_fnc_consolidateArray],
["magazineAmmo", magazinesAmmoCargo cursorObject],
["weapon", (weaponCargo cursorObject) call BIS_fnc_consolidateArray]
]];
*/
params [
["_box", objNull, [objNull]],
["_pos", [0,0,0], [[]], 3]
];
[_box, "AMMO LIGHT", _pos] call milsim_fnc_createBox;

View File

@@ -1,36 +0,0 @@
/*
* Author: Hizumi & IndigoFox
*
* Create Ammo resupply box for the 17th Battalion
*
* Arguments:
* 0: Vehicle - <OBJECT>
* 1: Position - <ARRAY>
*
* Return Value:
* Function executed <BOOL>
*
* Example:
* [box] call milsim_fnc_createCSWBox; // create ammo box via init line of editor object
* [objNull, pos] call milsim_fnc_createCSWBox; // create ammo box via zeus module
*
* Public: Yes
*
* Note: For gathering:
formatText ["%1", [
["containerClassname", typeOf cursorObject],
["backpack", (backpackCargo cursorObject) call BIS_fnc_consolidateArray],
["item", (itemCargo cursorObject) call BIS_fnc_consolidateArray],
["magazine", (magazineCargo cursorObject) call BIS_fnc_consolidateArray],
["magazineAmmo", magazinesAmmoCargo cursorObject],
["weapon", (weaponCargo cursorObject) call BIS_fnc_consolidateArray]
]];
*/
params [
["_box", objNull, [objNull]],
["_pos", [0,0,0], [[]], 3]
];
[_box, "CSW", _pos] call milsim_fnc_createBox;

View File

@@ -1,36 +0,0 @@
/*
* Author: Hizumi & IndigoFox
*
* Create Ammo resupply box for the 17th Battalion
*
* Arguments:
* 0: Vehicle - <OBJECT>
* 1: Position - <ARRAY>
*
* Return Value:
* Function executed <BOOL>
*
* Example:
* [box] call milsim_fnc_createLaunchersBox; // create ammo box via init line of editor object
* [objNull, pos] call milsim_fnc_createLaunchersBox; // create ammo box via zeus module
*
* Public: Yes
*
* Note: For gathering:
formatText ["%1", [
["containerClassname", typeOf cursorObject],
["backpack", (backpackCargo cursorObject) call BIS_fnc_consolidateArray],
["item", (itemCargo cursorObject) call BIS_fnc_consolidateArray],
["magazine", (magazineCargo cursorObject) call BIS_fnc_consolidateArray],
["magazineAmmo", magazinesAmmoCargo cursorObject],
["weapon", (weaponCargo cursorObject) call BIS_fnc_consolidateArray]
]];
*/
params [
["_box", objNull, [objNull]],
["_pos", [0,0,0], [[]], 3]
];
[_box, "LAUNCHERS", _pos] call milsim_fnc_createBox;

View File

@@ -1,26 +0,0 @@
/*
* Author: Hizumi
*
* Create Ammo resupply box for the 17th Battalion
*
* Arguments:
* 0: Vehicle - <OBJECT>
* 1: Position - <ARRAY>
*
* Return Value:
* Function executed <BOOL>
*
* Example:
* [box] call milsim_fnc_createMedicalBox; // create ammo box via init line of editor object
* [objNull, pos] call milsim_fnc_createMedicalBox // create ammo box via zeus module
*
* Public: Yes
*/
params [
["_box", objNull, [objNull]],
["_pos", [0,0,0], [[]], 3]
];
[_box, "MEDICAL", _pos] call milsim_fnc_createBox;

View File

@@ -1,36 +0,0 @@
/*
* Author: Hizumi & IndigoFox
*
* Create Mortar resupply box for the 17th Battalion
*
* Arguments:
* 0: Vehicle - <OBJECT>
* 1: Position - <ARRAY>
*
* Return Value:
* Function executed <BOOL>
*
* Example:
* [box] call milsim_fnc_createMortarBox; // create mortar ammo box via init line of editor object
* [objNull, pos] call milsim_fnc_createMortarBox; // create mortar ammo box via zeus module
*
* Public: Yes
*
* Note: For gathering:
formatText ["%1", [
["containerClassname", typeOf cursorObject],
["backpack", (backpackCargo cursorObject) call BIS_fnc_consolidateArray],
["item", (itemCargo cursorObject) call BIS_fnc_consolidateArray],
["magazine", (magazineCargo cursorObject) call BIS_fnc_consolidateArray],
["magazineAmmo", magazinesAmmoCargo cursorObject],
["weapon", (weaponCargo cursorObject) call BIS_fnc_consolidateArray]
]];
*/
params [
["_box", objNull, [objNull]],
["_pos", [0,0,0], [[]], 3]
];
[_box, "AMMO MORTAR", _pos] call milsim_fnc_createBox;

View File

@@ -1,36 +0,0 @@
/*
* Author: Hizumi
*
* Create Ammo resupply box for the 17th Battalion
*
* Arguments:
* 0: Vehicle - <OBJECT>
* 1: Position - <ARRAY>
*
* Return Value:
* Function executed <BOOL>
*
* Example:
* [box] call milsim_fnc_createWeaponsBox; // create ammo box via init line of editor object
* [objNull, pos] call milsim_fnc_createWeaponsBox; // create ammo box via zeus module
*
* Public: Yes
*
* Note: For gathering:
formatText ["%1", [
["containerClassname", typeOf cursorObject],
["backpack", (backpackCargo cursorObject) call BIS_fnc_consolidateArray],
["item", (itemCargo cursorObject) call BIS_fnc_consolidateArray],
["magazine", (magazineCargo cursorObject) call BIS_fnc_consolidateArray],
["magazineAmmo", magazinesAmmoCargo cursorObject],
["weapon", (weaponCargo cursorObject) call BIS_fnc_consolidateArray]
]];
*/
params [
["_box", objNull, [objNull]],
["_pos", [0,0,0], [[]], 3]
];
[_box, "AMMO HEAVY", _pos] call milsim_fnc_createBox;

View File

@@ -1 +0,0 @@
(missionConfigFile >> "SupplyCrates");