From 52a9845b50bd4cc01eb0f6ff7960302868516036 Mon Sep 17 00:00:00 2001 From: Ghostrider-GRG- Date: Fri, 6 Jul 2018 19:38:03 -0400 Subject: [PATCH] Build 146. Methods for dealing with a killed asset changed. After revision, the mission follows normal despawn timers but no loot crate is spawned. In addition, minor adjustments were made to the load order of mission system modules in blck_init_server.sqf. --- .../Compiles/Missions/GMS_fnc_endMission.sqf | 9 +- .../Missions/GMS_fnc_missionSpawner.sqf | 103 ++++++++------ .../custom_server/init/blck_init_server.sqf | 45 +++--- .../init/blck_init_server_145.sqf | 133 ++++++++++++++++++ @GMS/addons/custom_server/init/build.sqf | 4 +- 5 files changed, 218 insertions(+), 76 deletions(-) create mode 100644 @GMS/addons/custom_server/init/blck_init_server_145.sqf diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf index 4017cf4..2353ef0 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_endMission.sqf @@ -62,12 +62,12 @@ _fn_missionCleanup = { diag_log format["_fnc_endMission: Mission Aborted, setting all timers to 0"]; }; #endif - + /* if (_endCondition == 2) then { [["warning",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; }; - + */ [_blck_localMissionMarker select 0] call blck_fnc_deleteMarker; _cleanupCompositionTimer = 0; _cleanupAliveAITimer = 0; @@ -80,7 +80,7 @@ _fn_missionCleanup = { deleteVehicle _x; }forEach _vehicles; }; - if (_endCondition == 0) then // Normal Mission End State + if (_endCondition <= 0) then // Normal Mission End State { //diag_log format["_fnc_endMission: mission end condition == 0 | setting all timers to 0"]; private["_cleanupAliveAITimer","_cleanupCompositionTimer"]; @@ -105,7 +105,8 @@ _fn_missionCleanup = { _cleanupCompositionTimer = blck_cleanupCompositionTimer; _cleanupAliveAITimer = blck_AliveAICleanUpTimer; - [["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers; + if (_endCondition == 0) then {[["end",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;}; + if (_endCondition == -1) then {[["warning",_endMsg,_blck_localMissionMarker select 2]] call blck_fnc_messageplayers;}; [_blck_localMissionMarker select 0] call blck_fnc_deleteMarker; [_blck_localMissionMarker select 1, _markerClass] spawn blck_fnc_missionCompleteMarker; // Using a variable attached to the crate rather than the global setting to be sure we do not fill a crate twice. 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 4aed6ae..2395d89 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -503,42 +503,49 @@ if (_crateStolen) exitWith diag_log format["missionSpawner:: (542) Crate Stolen Callening _fnc_endMission - > players near = %1 and ai alive = %2 and crates stolen = %3",[_locations,10,true] call blck_fnc_playerInRangeArray, {alive _x} count _blck_AllMissionAI, _crateStolen]; [_mines,_objects,_crates, _blck_AllMissionAI,"Crate Removed from Mission Site Before Mission Completion: Mission Aborted",_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission; }; - +/* if ((_secureAsset) && !(alive _assetSpawned)) exitWith { [_mines,_objects,_crates, _blck_AllMissionAI,_assetKilledMsg,_blck_localMissionMarker,_coords,_markerClass, 2] call blck_fnc_endMission; }; - +*/ if (_spawnCratesTiming in ["atMissionEndGround","atMissionEndAir"]) then { - if (count _missionLootBoxes > 0) then + if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then { - _crates = [_coords,_missionLootBoxes,_loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - } - else - { - _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; - }; - - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["_fnc_missionSpawner (531): _crates = %1", _crates]}; - #endif - - if (blck_cleanUpLootChests) then - { - _objects append _crates; - }; + if (count _missionLootBoxes > 0) then + { + _crates = [_coords,_missionLootBoxes,_loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + } + else + { + _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming,_spawnCratesTiming, "end", _aiDifficultyLevel] call blck_fnc_spawnMissionCrates; + }; + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then {diag_log format["_fnc_missionSpawner (531): _crates = %1", _crates]}; + #endif + + if (blck_cleanUpLootChests) then + { + _objects append _crates; + }; - #ifdef blck_debugMode - if (blck_debugLevel > 0) then {diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]}; - #endif + #ifdef blck_debugMode + if (blck_debugLevel > 0) then {diag_log format["[blckeagls] missionSpawner:: (428) Crates Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]}; + #endif + }; }; + if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isEqualTo "atMissionCompletion") then { + if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then { - [_x] call blck_fnc_loadMissionCrate; - } forEach _crates; + { + [_x] call blck_fnc_loadMissionCrate; + } forEach _crates; + }; }; #ifdef blck_debugMode @@ -563,32 +570,40 @@ if (blck_showCountAliveAI) then //diag_log format["_fnc_missionSpawner (557) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]]; -if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then +if (_secureAsset && (alive _assetSpawned)) then { - //diag_log "Processing Mission End for Hostage Rescue"; - _assetSpawned setCaptive false; - _assetSpawned setVariable["GMSAnimations",[""],true]; - [_assetSpawned,""] remoteExec["switchMove",-2];; - uiSleep 0.1; - _assetSpawned enableAI "ALL"; - private _newPos = (getPos _assetSpawned) getPos [1000, random(360)]; - //diag_log format["processing domove for hostage with current pos = %1 and new pos = %2",getPos _assetSpawned, _newPos]; - (group _assetSpawned) setCurrentWaypoint [group _assetSpawned, 0]; - [group _assetSpawned,0] setWaypointPosition [_newPos,0]; - [group _assetSpawned,0] setWaypointType "MOVE"; -}; + if (_assetSpawned getVariable["assetType",0] isEqualTo 1) then + { + //diag_log "Processing Mission End for Hostage Rescue"; + _assetSpawned setCaptive false; + _assetSpawned setVariable["GMSAnimations",[""],true]; + [_assetSpawned,""] remoteExec["switchMove",-2];; + uiSleep 0.1; + _assetSpawned enableAI "ALL"; + private _newPos = (getPos _assetSpawned) getPos [1000, random(360)]; + //diag_log format["processing domove for hostage with current pos = %1 and new pos = %2",getPos _assetSpawned, _newPos]; + (group _assetSpawned) setCurrentWaypoint [group _assetSpawned, 0]; + [group _assetSpawned,0] setWaypointPosition [_newPos,0]; + [group _assetSpawned,0] setWaypointType "MOVE"; + }; -if (_assetSpawned getVariable["assetType",0] isEqualTo 2) then + if (_assetSpawned getVariable["assetType",0] isEqualTo 2) then + { + //diag_log format["Processing Mission End for Arrest of Leader %1 with endAnimation %2",_assetSpawned,_assetSpawned getVariable["endAnimation",""]]; + [_assetSpawned,""] remoteExec["switchMove",-2]; + _assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]],true]; + [_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2]; + }; +}; +if (_secureAsset && !(alive _assetSpawned)) then { - //diag_log format["Processing Mission End for Arrest of Leader %1 with endAnimation %2",_assetSpawned,_assetSpawned getVariable["endAnimation",""]]; - [_assetSpawned,""] remoteExec["switchMove",-2]; - _assetSpawned setVariable["GMSAnimations",_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]],true]; - [_assetSpawned,selectRandom(_assetSpawned getVariable["endAnimation",["AidlPercMstpSnonWnonDnon_AI"]])] remoteExec["switchMove",-2]; + _result = [_mines,_objects,_crates,_blck_AllMissionAI,_assetKilledMsg,_blck_localMissionMarker,_coords,_markerClass, -1] call blck_fnc_endMission; }; - //diag_log format["_fnc_missionSpawner (579) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]]; - -_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 0] call blck_fnc_endMission; +if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then +{ + _result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 0] call blck_fnc_endMission; +}; #ifdef blck_debugMode if (blck_debugLevel > 2) then {diag_log format["[blckeagls] missionSpawner:: (507)end of mission: blck_fnc_endMission has returned control to _fnc_missionSpawner"]}; diff --git a/@GMS/addons/custom_server/init/blck_init_server.sqf b/@GMS/addons/custom_server/init/blck_init_server.sqf index 07fe973..540fd73 100644 --- a/@GMS/addons/custom_server/init/blck_init_server.sqf +++ b/@GMS/addons/custom_server/init/blck_init_server.sqf @@ -36,11 +36,13 @@ blck_modType = call blck_fnc_getModType; publicVariable "blck_modType"; execVM "\q\addons\custom_server\Configs\blck_configs.sqf"; - waitUntil {(isNil "blck_configsLoaded") isEqualTo false;}; waitUntil{blck_configsLoaded}; blck_configsLoaded = nil; diag_log format["[blckeagls] blck_useHC = %1",blck_useHC]; +// Load any user-defined specifications or overrides +call compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Configs\blck_custom_config.sqf"; + // spawn map addons to give the server time to position them before spawning in crates etc. if (blck_spawnMapAddons) then { @@ -59,9 +61,17 @@ blck_worldSet = nil; // set up the lists of available missions for each mission category diag_log "[blckeagls] Loading Mission Lists"; #include "\q\addons\custom_server\Missions\GMS_missionLists.sqf"; +diag_log "[blckeagls] Mission Lists Loaded Successfully"; -// Load any user-defined specifications or overrides -call compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Configs\blck_custom_config.sqf"; +[] execVM "\q\addons\custom_server\Missions\Static\GMS_StaticMissions_init.sqf"; +[] execVM "q\addons\custom_server\Missions\UMS\GMS_UMS_init.sqf"; // loads functions and spawns any static missions. +diag_log "blck_init_server: ->> Static and UMS systems initialized."; + +#ifdef useDynamicSimulation +diag_log "[blckegls] dynamic simulation manager enabled"; +#else +diag_log "[blckegls] blckegls simulation manager enabled"; +#endif diag_log format["[blckeagls] version %1 Build %2 Loaded in %3 seconds",_blck_versionDate,_blck_version,diag_tickTime - _blck_loadingStartTime]; //,blck_modType]; diag_log format["blckeagls] waiting for players to join ---- >>>>"]; @@ -74,34 +84,20 @@ if !(blck_debugON || (blck_debugLevel isEqualTo 0)) then diag_log "[blckeagls] spawning Missions"; }; + if (blck_spawnStaticLootCrates) then { // Start the static loot crate spawner diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner Started"; - [] spawn compileFinal preprocessFileLineNumbers "\q\addons\custom_server\SLS\SLS_init.sqf"; - _wait = true; - while {_wait} do - { - if !(isNil "blck_SLSComplete") then { - if (blck_SLSComplete) then { - blck_SLSComplete = nil; - _wait = false; - }; - }; - diag_log format["Waiting for SLS to be completed at %1",diag_tickTime]; - uiSleep 1; - }; + [] execVM "\q\addons\custom_server\SLS\SLS_init.sqf"; + waitUntil {(isNil "blck_SLSComplete") isEqualTo false;}; + waitUntil {blck_SLSComplete}; + blck_SLSComplete = nil; diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner Done"; }else{ diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner disabled"; }; -#ifdef useDynamicSimulation -diag_log "[blckegls] dynamic simulation manager enabled"; -#else -diag_log "[blckegls] blckegls simulation manager enabled"; -#endif - //Start the mission timers if (blck_enableOrangeMissions > 0) then { @@ -127,7 +123,4 @@ if (blck_enableBlueMissions > 0) then // start the main thread for the mission system which monitors missions running and stuff to be cleaned up [] spawn blck_fnc_mainThread; -[] execVM "\q\addons\custom_server\Missions\Static\GMS_StaticMissions_init.sqf"; -[] execVM "q\addons\custom_server\Missions\UMS\GMS_UMS_init.sqf"; // loads functions and spawns any static missions. -//diag_log "blck_init_server: ->> Static and UMS systems initialized."; -diag_log "[blckeagls] Mission spawner started"; +diag_log "[blckeagls] < MISSION SYSTEM FULLY INITIALIZED AND RUNNING >"; diff --git a/@GMS/addons/custom_server/init/blck_init_server_145.sqf b/@GMS/addons/custom_server/init/blck_init_server_145.sqf new file mode 100644 index 0000000..07fe973 --- /dev/null +++ b/@GMS/addons/custom_server/init/blck_init_server_145.sqf @@ -0,0 +1,133 @@ +/* + By Ghostrider-GRG- + + -------------------------- + 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/ +*/ + +if ( !(isServer) || hasInterface) exitWith{}; + +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +if !(isNil "blck_Initialized") exitWith{}; +private["_blck_loadingStartTime"]; +_blck_loadingStartTime = diag_tickTime; +#include "\q\addons\custom_server\init\build.sqf"; +diag_log format["[blckeagls] Loading Server Mission System Version %2 Build Date %1",_blck_versionDate,_blck_version]; + +call compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\blck_variables.sqf"; +waitUntil {(isNil "blck_variablesLoaded") isEqualTo false;}; +waitUntil{blck_variablesLoaded}; +blck_variablesLoaded = nil; +//if !(blck_debugON) then {uiSleep 60;}; + +// compile functions +call compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\blck_functions.sqf"; +waitUntil {(isNil "blck_functionsCompiled") isEqualTo false;}; +waitUntil{blck_functionsCompiled}; +blck_functionsCompiled = nil; +diag_log format["[blckeagls] debug mode settings:blck_debugON = %1 blck_debugLevel = %2",blck_debugON,blck_debugLevel]; + +blck_modType = call blck_fnc_getModType; +publicVariable "blck_modType"; + +execVM "\q\addons\custom_server\Configs\blck_configs.sqf"; + +waitUntil {(isNil "blck_configsLoaded") isEqualTo false;}; +waitUntil{blck_configsLoaded}; +blck_configsLoaded = nil; +diag_log format["[blckeagls] blck_useHC = %1",blck_useHC]; +// spawn map addons to give the server time to position them before spawning in crates etc. +if (blck_spawnMapAddons) then +{ + call compileFinal preprocessFileLineNumbers "\q\addons\custom_server\MapAddons\MapAddons_init.sqf"; +}else{ + diag_log "[blckegls] Map Addons disabled"; +}; +blck_spawnMapAddons = nil; + +diag_log "[blckeagls] Loading Map-specific information"; +execVM "\q\addons\custom_server\Compiles\Functions\GMS_fnc_findWorld.sqf"; +waitUntil {(isNil "blck_worldSet") isEqualTo false;}; +waitUntil{blck_worldSet}; +blck_worldSet = nil; + +// set up the lists of available missions for each mission category +diag_log "[blckeagls] Loading Mission Lists"; +#include "\q\addons\custom_server\Missions\GMS_missionLists.sqf"; + +// Load any user-defined specifications or overrides +call compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Configs\blck_custom_config.sqf"; + +diag_log format["[blckeagls] version %1 Build %2 Loaded in %3 seconds",_blck_versionDate,_blck_version,diag_tickTime - _blck_loadingStartTime]; //,blck_modType]; +diag_log format["blckeagls] waiting for players to join ---- >>>>"]; + +if !(blck_debugON || (blck_debugLevel isEqualTo 0)) then +{ + waitUntil{{isPlayer _x}count allPlayers > 0}; + diag_log "[blckeagls] Player Connected, spawning missions"; +} else { + diag_log "[blckeagls] spawning Missions"; +}; + +if (blck_spawnStaticLootCrates) then +{ + // Start the static loot crate spawner + diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner Started"; + [] spawn compileFinal preprocessFileLineNumbers "\q\addons\custom_server\SLS\SLS_init.sqf"; + _wait = true; + while {_wait} do + { + if !(isNil "blck_SLSComplete") then { + if (blck_SLSComplete) then { + blck_SLSComplete = nil; + _wait = false; + }; + }; + diag_log format["Waiting for SLS to be completed at %1",diag_tickTime]; + uiSleep 1; + }; + diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner Done"; +}else{ + diag_log "[blckeagls] SLS:: -- >> Static Loot Spawner disabled"; +}; + +#ifdef useDynamicSimulation +diag_log "[blckegls] dynamic simulation manager enabled"; +#else +diag_log "[blckegls] blckegls simulation manager enabled"; +#endif + +//Start the mission timers +if (blck_enableOrangeMissions > 0) then +{ + //[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange] spawn blck_fnc_missionTimer;//Starts major mission system (Orange Map Markers) + [_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange,blck_enableOrangeMissions] call blck_fnc_addMissionToQue; +}; +if (blck_enableGreenMissions > 0) then +{ + //[_missionListGreen,_pathGreen,"GreenMarker","green",blck_TMin_Green,blck_TMax_Green] spawn blck_fnc_missionTimer;//Starts major mission system 2 (Green Map Markers) + [_missionListGreen,_pathGreen,"GreenMarker","green",blck_TMin_Green,blck_TMax_Green,blck_enableGreenMissions] call blck_fnc_addMissionToQue; +}; +if (blck_enableRedMissions > 0) then +{ + //[_missionListRed,_pathRed,"RedMarker","red",blck_TMin_Red,blck_TMax_Red] spawn blck_fnc_missionTimer;//Starts minor mission system (Red Map Markers)//Starts minor mission system 2 (Red Map Markers) + [_missionListRed,_pathRed,"RedMarker","red",blck_TMin_Red,blck_TMax_Red,blck_enableRedMissions] call blck_fnc_addMissionToQue; +}; +if (blck_enableBlueMissions > 0) then +{ + //[_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue] spawn blck_fnc_missionTimer;//Starts minor mission system (Blue Map Markers) + [_missionListBlue,_pathBlue,"BlueMarker","blue",blck_TMin_Blue,blck_TMax_Blue,blck_enableBlueMissions] call blck_fnc_addMissionToQue; +}; + +// start the main thread for the mission system which monitors missions running and stuff to be cleaned up +[] spawn blck_fnc_mainThread; + +[] execVM "\q\addons\custom_server\Missions\Static\GMS_StaticMissions_init.sqf"; +[] execVM "q\addons\custom_server\Missions\UMS\GMS_UMS_init.sqf"; // loads functions and spawns any static missions. +//diag_log "blck_init_server: ->> Static and UMS systems initialized."; +diag_log "[blckeagls] Mission spawner started"; diff --git a/@GMS/addons/custom_server/init/build.sqf b/@GMS/addons/custom_server/init/build.sqf index bddde5e..2f38b3a 100644 --- a/@GMS/addons/custom_server/init/build.sqf +++ b/@GMS/addons/custom_server/init/build.sqf @@ -1,6 +1,6 @@ private ["_version","_versionDate"]; -blck_version = "6.84 Build 145"; +blck_version = "6.84 Build 146"; _blck_version = blck_version; -_blck_versionDate = "6-24-18 5:00 PM"; +_blck_versionDate = "7-7-18 5:00 PM"; blck_pvs_version = _blck_version; publicVariable blck_pvs_version;