From 34e2ea6b9f8e45e1d33bbb7c4c476ae62b9102b9 Mon Sep 17 00:00:00 2001 From: Chris Cardozo Date: Sat, 9 May 2020 11:59:39 -0400 Subject: [PATCH] Added one new function, cleaned up a few others --- .../Functions/GMS_fnc_deleteMarker.sqf | 2 +- .../GMS_fnc_getAllBlckeaglsMarkers.sqf | 18 ++++++ .../Functions/GMS_fnc_isBlackeaglsMarker.sqf | 15 +++++ .../Compiles/Functions/GMS_fnc_mainThread.sqf | 7 ++- .../Functions/GMS_fnc_nearestMarkerOfType.sqf | 11 ++++ .../Functions/GMS_fnc_spawnMarker.sqf | 43 +++++++------ .../Missions/GMS_fnc_missionSpawner.sqf | 1 + .../Missions/GMS_fnc_spawnPendingMissions.sqf | 24 +------ .../custom_server/Compiles/blck_functions.sqf | 2 + .../custom_server/Compiles/blck_variables.sqf | 2 +- .../custom_server/init/blck_init_server.sqf | 12 +--- @GMS/addons/custom_server/init/build.sqf | 4 +- changeLog.sqf | 62 ++++++++++++------- 13 files changed, 123 insertions(+), 80 deletions(-) create mode 100644 @GMS/addons/custom_server/Compiles/Functions/GMS_fnc_getAllBlckeaglsMarkers.sqf create mode 100644 @GMS/addons/custom_server/Compiles/Functions/GMS_fnc_isBlackeaglsMarker.sqf diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf index f6e4120..575e665 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf @@ -10,7 +10,7 @@ */ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; params[["_markerName",""]]; - +//diag_log format["_fnc_deleteMarker: _markName = %1",_markerName]; if (_markerName isEqualTo "" || !(typeName _markerName isEqualTo "STRING")) exitWith {diag_log format"[blckeagls] illeagal or missing marker name: typeName _markerName = %1 | _makerName = %2",typeName _markerName,_markerName}; deleteMarker _markerName; deleteMarker ("label" + _markerName); diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_getAllBlckeaglsMarkers.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_getAllBlckeaglsMarkers.sqf new file mode 100644 index 0000000..08e13bd --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_getAllBlckeaglsMarkers.sqf @@ -0,0 +1,18 @@ +/* + By Ghostrider [GRG] + Copyright 2016 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +private _m = []; +{ + if (_x call blck_fnc_isBlackeaglsMarker) then {_m pushBack _x}; +} forEach allMapMarkers; +diag_log format["_fnc_getAllBlackeaglsMarkers: _bem = %1",_m]; +_m + diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_isBlackeaglsMarker.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_isBlackeaglsMarker.sqf new file mode 100644 index 0000000..6971f7d --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_isBlackeaglsMarker.sqf @@ -0,0 +1,15 @@ +/* + By Ghostrider [GRG] + Copyright 2016 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +private _m = _this; +private _r = if ( ([_m,0,(count blck_missionMarkerRootName) - 1] call BIS_fnc_trimString) isEqualTo blck_missionMarkerRootName) then {true} else {false}; +_r \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf index 38b59d7..156fa0e 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_mainThread.sqf @@ -33,7 +33,12 @@ while {true} do if (blck_simulationManager isEqualTo blck_useBlckeaglsSimulationManagement) then {[] call blck_fnc_simulationManager}; [] call blck_fnc_sm_staticPatrolMonitor; [] call blck_fnc_vehicleMonitor; - + //[] call blck_fnc_cleanupAliveAI; + //[] call blck_fnc_cleanupObjects; + //[] call blck_fnc_cleanupDeadAI; + #ifdef GRGserver + [] call blck_fnc_broadcastServerFPS; + #endif }; if (diag_tickTime > _timer20sec) then { diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_nearestMarkerOfType.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_nearestMarkerOfType.sqf index 113fc74..f44dc87 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_nearestMarkerOfType.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_nearestMarkerOfType.sqf @@ -1,3 +1,14 @@ +/* + By Ghostrider [GRG] + Copyright 2016 + -------------------------- + License + -------------------------- + All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License. + + http://creativecommons.org/licenses/by-nc-sa/4.0/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; /* Purpose: returns the nearest marker of a specific type Parameters: type of marker to search for as a "STRING" diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_spawnMarker.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_spawnMarker.sqf index ff3259c..e770812 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_spawnMarker.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_spawnMarker.sqf @@ -8,37 +8,36 @@ http://creativecommons.org/licenses/by-nc-sa/4.0/ */ -//#include "\q\addons\custom_server\Configs\blck_defines.hpp"; +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; private["_blck_fn_configureRoundMarker"]; _blck_fn_configureRoundMarker = { - private["_name","_pos","_color","_size","_MainMarker","_arrowMarker","_labelMarker","_labelType"]; params["_name","_pos","_color","_text","_size","_labelType","_mShape","_mBrush"]; if ((_pos distance [0,0,0]) < 10) exitWith {}; - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerColor _color; - _MainMarker setMarkerShape "ELLIPSE"; - _MainMarker setMarkerBrush "Grid"; - _MainMarker setMarkerSize _size; // + private _marker = createMarker [_name, _pos]; + _marker setMarkerColor _color; + _marker setMarkerShape "ELLIPSE"; + _marker setMarkerBrush "Grid"; + _marker setMarkerSize _size; // if (count toArray(_text) > 0) then { switch (_labelType) do { case "arrow": { - _name = "label" + _name; - _textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) - (_size select 0), 0]; - _arrowMarker = createMarker [_name, _textPos]; + _name = _name + "label"; + private _textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) - (_size select 0), 0]; + private _arrowMarker = createMarker [_name, _textPos]; _arrowMarker setMarkerShape "Icon"; _arrowMarker setMarkerType "HD_Arrow"; _arrowMarker setMarkerColor "ColorBlack"; _arrowMarker setMarkerText _text; - //_MainMarker setMarkerDir 37; + //_marker setMarkerDir 37; }; case "center": { _name = "label" + _name; - _labelMarker = createMarker [_name, _pos]; + private _labelMarker = createMarker [_name, _pos]; _labelMarker setMarkerShape "Icon"; _labelMarker setMarkerType "mil_dot"; _labelMarker setMarkerColor "ColorBlack"; @@ -47,26 +46,26 @@ _blck_fn_configureRoundMarker = { }; }; if (isNil "_labelMarker") then {_labelMarker = ""}; - _labelMarker + _marker }; _blck_fn_configureIconMarker = { - private["_MainMarker"]; + params["_name","_pos",["_color","ColorBlack"],["_text",""],["_icon","mil_triangle"]]; - _name = "label" + _name; - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerShape "Icon"; - _MainMarker setMarkerType _icon; - _MainMarker setMarkerColor _color; - _MainMarker setMarkerText _text; - _MainMarker + //_name = "label" + _name; + private _marker = createMarker [_name, _pos]; + _marker setMarkerShape "Icon"; + _marker setMarkerType _icon; + _marker setMarkerColor _color; + _marker setMarkerText _text; + _marker }; params["_mArray","_mBrush"]; private["_marker"]; _mArray params["_missionMarkerName","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerTypeInfo"]; - +_missionMarkerName = blck_missionMarkerRootName + _missionMarkerName; _markerTypeInfo params[["_mShape","mil_dot"],["_mSize",[0,0]],["_mBrush","GRID"]]; if (toUpper(_mShape) in ["ELLIPSE","RECTANGLE"]) then // not an Icon .... diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf index beb5e43..b594b67 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -556,6 +556,7 @@ if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isE private["_result"]; // Force passing the mission name for informational purposes. _blck_localMissionMarker set [2, _markerMissionName]; +// delete the prior instance of this mission. if (blck_showCountAliveAI) then { _marker setMarkerText format["%1: All AI Dead",_markerMissionName]; diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnPendingMissions.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnPendingMissions.sqf index b009c95..5c11b29 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnPendingMissions.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnPendingMissions.sqf @@ -31,35 +31,17 @@ if (blck_missionsRunning >= blck_maxSpawnedMissions) exitWith { private["_coords","_compiledMission","_search","_readyToSpawnQue","_missionToSpawn","_allowReinforcements"]; _readyToSpawnQue = []; -{ // 0 1 2 3 3 5 6 - // _mission = [_compiledMissionsList,format["%1%2",_marker,_i],_difficulty,_tMin,_tMax,_waitTime,[0,0,0]]; - //diag_log format["_fnc_spawnPendingMissions: diag_tickTime %6 _marker %1 _difficulty %2 _tMin %3 _tMax %4 _waitTime %5",_x select 1, _x select 2, _x select 3, _x select 4, _x select 5, diag_tickTime]; +{ if ( (diag_tickTime > (_x select 5)) && ((_x select 5) > 0) ) then { _readyToSpawnQue pushback _x; - //diag_log format["_fnc_spawnPendingMissions: adding mission with _marker %1 _difficulty %2",_x select 1, _x select 2]; - //diag_log format["_fnc_spawnPendingMissions: count _readyToSpawnQue = %1",count _readyToSpawnQue]; }; } forEach blck_pendingMissions; -#ifdef blck_debugMode -if (blck_debugLevel > 2) then -{ - diag_log format["_fnc_spawnPendingMissions:: --- >> _readyToSpawnQue diag_tickTime %6 _marker %1 _difficulty %2 _tMin %3 _tMax %4 _waitTime %5",_readyToSpawnQue select 1, _readyToSpawnQue select 2, _readyToSpawnQue select 3, _readyToSpawnQue select 4, _readyToSpawnQue select 5, diag_tickTime]; -}; -#endif -//diag_log format["_fnc_spawnPendingMissions: count _readyToSpawnQue = %1", count _readyToSpawnQue]; + if (count _readyToSpawnQue > 0) then { _missionToSpawn = selectRandom _readyToSpawnQue; - - #ifdef blck_debugMode - { - if (blck_debugLevel > 2) then - { - //if (_foreachindex > 0) then {diag_log format["_fnc_spawnPendingMissions: _missionToSpawn %1 = %2",_foreachindex, _missionToSpawn select _foreachindex]}; - }; - }forEach _missionToSpawn; - #endif + diag_log format["_fnc_spawnPendingMIssions: blc markers = %1",[] call blck_fnc_getAllBlackeaglsMarkers]; _coords = [] call blck_fnc_FindSafePosn; diff --git a/@GMS/addons/custom_server/Compiles/blck_functions.sqf b/@GMS/addons/custom_server/Compiles/blck_functions.sqf index 9f4a702..e71f339 100644 --- a/@GMS/addons/custom_server/Compiles/blck_functions.sqf +++ b/@GMS/addons/custom_server/Compiles/blck_functions.sqf @@ -45,6 +45,8 @@ private _functions = [ ["blck_fnc_setAILocality","\q\addons\custom_server\Compiles\Functions\GMS_fnc_setAILocality.sqf"], ["blck_fnc_ai_offloadToClients","\q\addons\custom_server\Compiles\Functions\GMS_fnc_ai_offloadToClients.sqf"], ["blck_fnc_findRandomLocationWithinCircle","\q\addons\custom_server\Compiles\Functions\GMS_fnc_findRandomLocationWithinCircle.sqf"], + ["blck_fnc_getAllBlackeaglsMarkers" ,"\q\addons\custom_server\Compiles\Functions\GMS_fnc_getAllBlckeaglsMarkers.sqf"], + ["blck_fnc_isBlackeaglsMarker","\q\addons\custom_server\Compiles\Functions\GMS_fnc_isBlackeaglsMarker.sqf"], // Player-related functions ["GMS_fnc_handlePlayerUpdates","\q\addons\custom_server\Compiles\Units\GMS_fnc_handlePlayerUpdates.sqf"], diff --git a/@GMS/addons/custom_server/Compiles/blck_variables.sqf b/@GMS/addons/custom_server/Compiles/blck_variables.sqf index 555d3b9..212edcf 100644 --- a/@GMS/addons/custom_server/Compiles/blck_variables.sqf +++ b/@GMS/addons/custom_server/Compiles/blck_variables.sqf @@ -37,8 +37,8 @@ blck_pendingMissions = []; blck_missionsRunning = 0; blck_missionsRun = 0; blck_activeMissions = []; -//blck_deadAI = []; blck_connectedHCs = []; +blck_missionMarkerRootName = "blckeagls_marker"; blck_missionMarkers = []; blck_heliCrashSites = []; blck_temporaryMarkers = []; diff --git a/@GMS/addons/custom_server/init/blck_init_server.sqf b/@GMS/addons/custom_server/init/blck_init_server.sqf index d4c7bd6..368e70e 100644 --- a/@GMS/addons/custom_server/init/blck_init_server.sqf +++ b/@GMS/addons/custom_server/init/blck_init_server.sqf @@ -227,14 +227,4 @@ blck_pvs_version = blck_versionNumber; publicVariable "blck_pvs_version"; diag_log format["[blckeagls] version %1 Build %2 Date %4 Loaded in %3 seconds",blck_versionNumber,blck_buildNumber,diag_tickTime - _blck_loadingStartTime,blck_buildDate]; //,blck_modType]; -if (blck_debugOn || (blck_debugLevel >= 1)) then -{ - private _pos = [] call blck_fnc_findSafePosn; - private _root = ""; - private _path = "default"; - private _mission = "bunkerMission"; - private _compiledMission = compilefinal preprocessFileLineNumbers format["\q\addons\custom_server\Missions\%1\%2.sqf",_path,_mission]; - diag_log format["[blckeagls] mission test sequence run for mission path %1 name %2",_path,_mission]; - [_pos,"testMarkerGRG","blue"] spawn _compiledMission; - diag_log format["testmarker mission spawned at %1",diag_tickTime]; -}; + diff --git a/@GMS/addons/custom_server/init/build.sqf b/@GMS/addons/custom_server/init/build.sqf index 45e433a..ef1dda5 100644 --- a/@GMS/addons/custom_server/init/build.sqf +++ b/@GMS/addons/custom_server/init/build.sqf @@ -1,4 +1,4 @@ -#define blck_buildNumber 202 +#define blck_buildNumber 203 #define blck_versionNumber 6.96 -#define blck_buildDate "5-6-20" +#define blck_buildDate "5-8-20" diff --git a/changeLog.sqf b/changeLog.sqf index 2c5fd8a..0b31ed0 100644 --- a/changeLog.sqf +++ b/changeLog.sqf @@ -4,10 +4,28 @@ Loosely based on the AI mission system by blckeagls ver 2.0.2 Contributions by Narines: bug fixes, testing, infinite ammo fix. Ideas or code from that by He-Man, Vampire and KiloSwiss have been used for certain functions. Many thanks for new Coding and ideas from Grahame. -A huge thank you to Ignaz-HeMan for many changes to resolve bugs and improve coding efficiency. Significant Changes: ===================== +6.96 Build 203 +FIXED: few minor bug fixes. +FIXED: Static Mission Loot vehicles are no longer deleted by Epoch servers when players enter them. +FIXED: an error in coordinates for some randomly spawned missions tha added an extra 0 to the array with the coordinaates. +Added: a define for NIA all in one in blck_defines; +Added a few preconfigures variables with lists of NIA Armas items. +Added: an optional parameter to define the location of a mission as one of one or more locations in an array + _defaultMissionLocations = []; + +Added: a function that returns an array of all mission markers used by blckeagls for mission makers and server owners + blck_fnc_getAllBlackeaglsMarkers + Returns: an array with all markers used by the mission system. + +Removed: some debugging and map sepcific settings from blck_custom_config.sqf +Changed: some code for finding locations for a new mission. + +6.96 Build 199 +Added support for Arma servers not running Epoch or Exile + 6.96 Build 197 Sorted some wisses with the dynamic UMS spawner. Removing debugging info @@ -30,23 +48,24 @@ Updates to simulation managers. All actions on dead AI are handled throug units blck_graveyardGroup All use of blck_deadAI has been deleted. -6.94 Build 181 -1. code and logic for generating waypoints updated. -2. this code, and that for reload events, is broadcast to clients -3. blckClient has been tweaked to inactivate some code on any connected HC. -4. Script errors that prevented the HC from starting and being passed AI were fixed. - -6.92 Build 180 -======= - -1. Support for claim-vehicle scripts is now built-in +6.92 Build 184 +Fixed an issues that caused blckeagls to load before exile servers were ready to accept players. +Added checks that ensure that live AI and mission scenery do not despawn when players are nearby. +Decreased the frequency with which some checks (dead AI, live AI, scenery at completed missions) is checked. +Redid a few lops that should be using the more speedy deleteAt rather than forEach methods. +worked on killed and hit EH so that these can run on the client owning the unit and server with each having a specific role + - note that this requires that the code be streamed to clients and compiled on the HC. +Updates to client to reduce logging +Added a firedNear EH +Redid system for setting up combatmode and behavior to be context dependent +Redid setNextWaypont to include an antiStuck check and implement the above checks on behavior and combat mode. +Support for claim-vehicle scripts is now built-in blck_allowClaimVehicle = true; // To allow players to claim vehicles (Exile only). - Thanks to PRJX for the lead on the code. -2. Added a setting to disable having AI toss smoke before healing. Set: +Added a setting to disable having AI toss smoke before healing. Set: blck_useSmokeWhenHealing=false; // to disable this -3. Added an option to display kill notices using Toasts +Added an option to display kill notices using Toasts blck_aiKillUseToast=true; // in blckClient.sqf in the debug folder of your mission.pbo to enable these. -4. Added offloading of AI to clients (Experimental, waypoints may break when using this) +Added offloading of AI to clients //////// // Client Offloading and Headless Client Configurations blck_useHC = true; // Experimental (death messages and rewards not yet working). @@ -55,10 +74,12 @@ All use of blck_deadAI has been deleted. blck_ai_offload_notifyClient = false; // Set true if you want notifications when AI are offloaded to a client PC. Only for testing/debugging purposes. // TODO: set to false before release blck_limit_ai_offload_to_blckeagls = true; // when true, only groups spawned by blckeagls are evaluated. -5.Changed - Monitoring of groups refined to route mission groups that have left the mission area back to it. -6. Fixed - Vehicle unlock when empty of crew through adding a getOut event handler. -7. Code for spawning vehicles redone to reduced redundancy. -8. two code tweaks from the Tall Man (MGTDB) were added. + + + +Fixed - Vehicle unlock when empty of crew through adding a getOut event handler. +Code for spawning vehicles redone to reduced redundancy. +Monitoring of groups refined to route mission groups that have left the mission area back to it. V 6.90 Build 175 1. Added new settings to specify the number of crew per vehhicle to blck_config.sqf and blck_config_mil.sqf @@ -92,10 +113,9 @@ V 6.90 Build 175 8. Other minor coding fixes and optimizations. -6.88 Build 167 +6.88 This update consists primarily of a set of bug fixes and code tweaks. Many thanks to HeMan for his time in effort spent going through the scripts to troublehsoot and improve them. -The most important bug fix has been resolution of issues with use of headless clients. 6.86 Build 156 Added support for spawning infantry and statics inside buildings for forming a garrison using either of two methods.