diff --git a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_XferGroup.sqf b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_XferGroup.sqf index 7710af6..5866d45 100644 --- a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_XferGroup.sqf +++ b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_XferGroup.sqf @@ -1,5 +1,4 @@ /* - Killed handler for _units By Ghostrider-GRG- -------------------------- @@ -18,9 +17,6 @@ _group = _this select 0; _client = clientOwner; { _unit = _x; - _localEH = []; _tempEH = ["reloaded",_unit addEventHandler ["reloaded", {_this call compile preprocessfilelinenumbers blck_EH_unitWeaponReloaded;}]]; - _localEH pushBack _tempEH; - _x setVariable["localEH",_localEH,true]; }forEach (units _group); diag_log format["blckHC:: group %1 transferred to HC %1",_group,_client]; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_leastBurdened.sqf b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_leastBurdened.sqf index 87930c2..e67aca3 100644 --- a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_leastBurdened.sqf +++ b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_leastBurdened.sqf @@ -15,11 +15,12 @@ params["_HC_List"]; if (count _HC_List == 0) exitWith {_result = objNull; _result}; if (count _HC_List == 1) exitWith {_result = _HC_List select 0; _result}: private["_result","_fewestGroupsAssigned","_leastBurdened","_groupsAssigned"]; -_fewestGroupsAssigned = [_HC_List select 0] call blck_fnc_HC_countGroupsAssigned; -_leastBurdened = _HC_List select 0; +_fewestGroupsAssigned = 1000000; { - _groupsAssigned = [_x] call blck_fnc_HC_countGroupsAssigned; - if (_groupsAssigned < _fewestGroupsAssigned) then + _ownerHC = owner _x; + _groupsAssigned = {(groupOwner _x) isEqualTo _ownerHC} count allGroups; + diag_log format["_fnc_HC_leastBurdened: HC %1 | groupsAssigned %2",_x,_groupsAssigned]; + if ([_x] call blck_fnc_HC_countGroupsAssigned < _fewestGroupsAssigned) then { _leastBurdened = _x; _fewestGroupsAssigned = _groupsAssigned; diff --git a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_passToHCs.sqf b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_passToHCs.sqf index 0bc07e7..5713c45 100644 --- a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_passToHCs.sqf +++ b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_passToHCs.sqf @@ -1,5 +1,4 @@ /* - Killed handler for _units By Ghostrider-GRG- -------------------------- @@ -20,52 +19,30 @@ blck_fnc_countGroupsAssigned = { _result }; - -//diag_log format["_fnc_passToHCs:: function called at server time %1",diag_tickTime]; private["_numTransfered","_clientId","_allGroups","_groupsOwned","_idHC","_id","_swap","_rc"]; _numTransfered = 0; _idHC = -2; -blck_connectedHCs = call blck_fnc_HC_getListConnected; // Double check on this function; seems overly complicated. -//diag_log format["_fnc_passToHCs:: blck_connectedHCs = %1 | count _HCs = %2 | server FPS = %3",blck_connectedHCs,count blck_connectedHCs,diag_fps]; -if ( (count blck_connectedHCs) > 0) then +blck_connectedHCs = entities "HeadlessClient_F"; +diag_log format["_fnc_passToHCs:: blck_connectedHCs = %1 | count _HCs = %2 | server FPS = %3",blck_connectedHCs,count blck_connectedHCs,diag_fps]; +if !(blck_connectedHCs isEqualTo []) then { _idHC = [blck_connectedHCs] call blck_fnc_HC_leastBurdened; - //diag_log format["passToHCs: evaluating passTos for HC %1 || owner HC = %2",_idHC, owner _idHC]; { - // Pass the AI - if (_x getVariable["blck_group",false]) then { - //diag_log format["group belongs to blckeagls mission system so time check if we should transfer it"]; - //diag_log format["Owner of group %1 is %2",_x,groupOwner _x]; if ((groupOwner _x) == 2) then { - //diag_log format["blckeagls group %1 is on the server: we should be moved to HC %2 with _idHC %3",_x,_idHC]; - //_x setVariable["owner",owner _idHC]; - //_x setVariable["Group",group (driver _x)),true] private _sgor = _x setGroupOwner (owner _idHC); - //diag_log format["setGroupOwner returned %1",_sgor]; - //diag_log format["_veh %1 variable owner set to %2",getVariable _veh["owner",-1]]; - //diag_log format["_veh %1 Group set to %2",_veh getVariable["Group",grpNull]]; if (_sgor) then { [_x] remoteExec["blck_fnc_HC_XferGroup",_idHC]; _numTransfered = _numTransfered + 1; - //diag_log format["group %1 transferred to %2",_x, groupOwner _x]; + diag_log format["group %1 transferred to %2",_x, groupOwner _x]; } else { - //diag_log format["something went wrong with the transfer of group %1",_x]; + diag_log format["something went wrong with the transfer of group %1",_x]; }; }; - } else { - //diag_log format["group %1 does not belong to blckeagls mission system",_x]; }; } forEach (allGroups); diag_log format["[blckeagls] _passToHCs:: %1 groups transferred to HC %2",_numTransfered,_idHC]; - //_numTransfered = 0; - // Note : the owner of a vehicle is the owner of the driver so vehicles are automatically transferred to the HC when the group to which the driver is assigned is transferred. - -} else { - #ifdef blck_debugMode - if (blck_debugLevel > 2) then {diag_log "_fnc_passToHCs:: No headless clients connected"}; - #endif }; 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 13fa778..b1115c5 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner.sqf @@ -189,24 +189,8 @@ private _params = [_coords,_minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_ _temp = [_coords, _minNoAI,_maxNoAI,_missionGroups,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnMissionAI; -#ifdef blck_debugMode -if (blck_debugLevel > 2) then { - diag_log format["missionSpawner :: (264) blck_fnc_spawnMissionAI returned a value of _temp = %1",_temp]; uiSleep 1; -}; - _abort = _temp select 1; -if (blck_debugLevel > 2) then { - diag_log format["missionSpawner :: (269) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; -}; -#endif -if (_abort) exitWith -{ - if (blck_debugLevel > 1) then { - diag_log "missionSpawner:: (277) grpNull returned, mission termination criteria met, calling blck_fnc_endMission" - }; - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; if !(_abort) then { _blck_AllMissionAI append (_temp select 0); @@ -223,41 +207,17 @@ _assetSpawned = objNull; if !(_hostageConfig isEqualTo []) then { _temp = [_coords,_hostageConfig] call blck_fnc_spawnHostage; - //diag_log format["_fnc_missionSpawner: _fnc_spawnHostage returned %1",_temp]; _assetSpawned = _temp select 0; _objects pushBack (_temp select 1); - //diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - //diag_log format["_fnc_missionSpawner: _fnc_spawnHostage returned object %1",_temp select 1]; _blck_AllMissionAI pushBack _assetSpawned; }; if !(_enemyLeaderConfig isEqualTo []) then { _temp = [_coords,_enemyLeaderConfig] call blck_fnc_spawnLeader; - //diag_log format["_fnc_missionSpawner: _fnc_spawnLeader return _temp = %1",_temp]; _assetSpawned = _temp select 0; _objects pushBack (_temp select 1); - //diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - //diag_log format["_fnc_missionSpawner: building spawned by _fnc_spawnLeader = %1",_temp select 1]; _blck_AllMissionAI pushBack _assetSpawned; - //diag_log format["_fnc_missionSpawner (261): _blck_AllMissionAI",_blck_AllMissionAI]; -}; - -#ifdef blck_debugMode - if (blck_debugLevel >= 1) then { - diag_log format["_fnc_missionSpawner: _assetSpawned = %1",_assetSpawned]; - }; -#endif - -uiSleep delayTime; -_temp = [[],[],false]; -_abort = false; - - - -if (_abort) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; }; uiSleep delayTime; @@ -266,19 +226,7 @@ _abort = false; // Deal with helicopter patrols _temp = []; - -#ifdef blck_debugMode -if (blck_debugLevel > 1) then -{ - diag_log format["[blckeagls] missionSpawner:: (351) calling in heli patrol: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - _noChoppers = [_noChoppers] call blck_fnc_getNumberFromRange; - -#ifdef blck_debugMode -if (blck_debugLevel > 1) then {diag_log format["_missionSpawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]}; -#endif if (_noChoppers > 0) then { for "_i" from 1 to (_noChoppers) do @@ -290,13 +238,11 @@ if (_noChoppers > 0) then if (typeName _temp isEqualTo "ARRAY") then { _abort = _temp select 2; - blck_monitoredVehicles pushBack (_temp select 0); - _blck_AllMissionAI append (_temp select 1); - }; - if (_abort) then - { - _objects pushback (_temp select 0); - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; + if !(_abort) then + { + blck_monitoredVehicles pushBack (_temp select 0); + _blck_AllMissionAI append (_temp select 1); + }; }; }; }; @@ -306,35 +252,23 @@ uisleep 3; if (count _garrisonedBuilding_ATLsystem > 0) then { _temp = [_coords, _garrisonedBuilding_ATLsystem, _aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_ATLsystem; - //diag_log format["_missionspawner: garrisoned a building using ATL format, function returned %1",_temp]; - // _return = [_group,_buildingsSpawned,_staticsSpawned]; _objects append (_temp select 1); blck_monitoredVehicles append (_temp select 2); _blck_AllMissionAI append (units (_temp select 0)); }; uiSleep 3; -//diag_log format["_missionSpawner: _garrisonedBuildings_BuildingPosnSystem = %1",_garrisonedBuildings_BuildingPosnSystem]; if (count _garrisonedBuildings_BuildingPosnSystem > 0) then { - // params["_center","_garrison","_aiDifficultyLevel","_uniforms","_headGear","_vests","_backpacks","_weaponList","_sideArms"]; _temp = [_coords, _garrisonedBuildings_BuildingPosnSystem, _aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_garrisonBuilding_RelPosSystem; - diag_log format["_missionspawner: garrisoned a building using relPos format, function returned %1",_temp]; - // _return = [_group,_buildingsSpawned,_staticsSpawned]; _objects append (_temp select 1); blck_monitoredVehicles append (_temp select 2); _blck_AllMissionAI append (units (_temp select 0)); }; -////////////////////////// -// Spawn Crates and Emplaced Weapons Last to try to force them to correct positions relative to spawned buildinga or other objects. -#ifdef blck_debugMode -if (blck_debugLevel > 0) then {diag_log format["missionSpawner:: (389) preparing to spawn emplaced weapons for _coords %4 | _markerClass %3 | blck_useStatic = %1 | _noEmplacedWeapons = %2",blck_useStatic,_noEmplacedWeapons,_markerClass,_coords];}; -#endif uiSleep 15; private["_noEmplacedToSpawn"]; _noEmplacedToSpawn = [_noEmplacedWeapons] call blck_fnc_getNumberFromRange; -//diag_log format["_fnc_missionSpawner: -> _noEmplacedToSpawn = %1 | blck_useStatic = %2",_noEmplacedToSpawn,blck_useStatic]; if (blck_useStatic && (_noEmplacedToSpawn > 0)) then { _temp = [_coords,_missionEmplacedWeapons,useRelativePos,_noEmplacedToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,_weaponList,_sideArms] call blck_fnc_spawnEmplacedWeaponArray; @@ -350,10 +284,7 @@ if (blck_useStatic && (_noEmplacedToSpawn > 0)) then _blck_AllMissionAI append (_temp select 1); }; }; -if (_abort) exitWith -{ - [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 1] call blck_fnc_endMission; -}; + _vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange; if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then { @@ -413,7 +344,6 @@ if (_noPara > 0 && (random(1) < _chancePara) && _paraTriggerDistance == 0) then }; }; -// Define Triggers for mission end private["_missionComplete","_endIfPlayerNear","_endIfAIKilled","_secureAsset","_crateStolen","_locations"]; _missionComplete = -1; _startTime = diag_tickTime; @@ -425,7 +355,7 @@ switch (_endCondition) do case "allKilledOrPlayerNear": {_secureAsset = false; _endIfPlayerNear = true;_endIfAIKilled = true;}; case "assetSecured": {_secureAsset = true; _endIfPlayerNear = false; _endIfAIKilled = false;}; }; -//diag_log format["_fnc_missionSpawner: _secureAsset = %1",_secureAsset]; + if (blck_showCountAliveAI) then { if !(_marker isEqualTo "") then @@ -444,7 +374,6 @@ private _spawnPara = if (random(1) < _chancePara) then {true} else {false}; } forEach _crates; private["_minNoAliveForCompletion","_result","_minPercentageKilled"]; -//diag_log format["_missionSpawner (447): count _blck_AllMissionAI = %2 || (round(blck_killPercentage * (count _blck_AllMissionAI))) = %1", round(blck_killPercentage * (count _blck_AllMissionAI)), count _blck_AllMissionAI]; _minNoAliveForCompletion = (count _blck_AllMissionAI) - (round(blck_killPercentage * (count _blck_AllMissionAI))); if (_secureAsset) then {_minNoAliveForCompletion = _minNoAliveForCompletion + 1}; @@ -463,17 +392,20 @@ while {_missionComplete isEqualTo -1} do { if (({alive _x} count _blck_AllMissionAI) <= _minNoAliveForCompletion) then {_missionComplete = 1}; }; - if (_spawnCratesTiming isEqualTo "atMissionSpawn") then + + if (_spawnCratesTiming isEqualTo "atMissionSpawnGround") then { - // Re-evaluate this - may not need the forEach - //{ - if ({[_x] call blck_fnc_crateMoved} count _crates > 0) then + { + private _d = _x distance (_x getVariable ["crateSpawnPos",_coords]); + diag_log format["crate %1 moved %2 at %3",_x,_d,diag_tickTime]; + if (_d > 25) exitWith { _missionComplete = 1; _crateStolen = true; }; - //}forEach _crates; + }forEach _crates; }; + if (_secureAsset) then { if !(alive _assetSpawned) then @@ -527,15 +459,9 @@ while {_missionComplete isEqualTo -1} do 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 (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then @@ -575,15 +501,6 @@ if (_spawnCratesTiming isEqualTo "atMissionSpawnGround" && _loadCratesTiming isE }; }; -#ifdef blck_debugMode -if (blck_debugLevel > 0) then -{ - diag_log format["[blckeagls] missionSpawner:: (586) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; - diag_log format["missionSpawner :: (587) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; - diag_log format["[blckeagls] missionSpawner:: (588) calling endMission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; -}; -#endif - private["_result"]; // Force passing the mission name for informational purposes. _blck_localMissionMarker set [2, _markerMissionName]; @@ -595,20 +512,15 @@ if (blck_showCountAliveAI) then }forEach blck_missionMarkers; }; -//diag_log format["_fnc_missionSpawner (557) Build 123: _secureAsset = %1 | {alive _assetSpawned} = %2 | assetType = %3",_secureAsset,alive _assetSpawned, _assetSpawned getVariable["assetType",-1]]; - if (_secureAsset && (alive _assetSpawned)) then { 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"; @@ -616,7 +528,6 @@ if (_secureAsset && (alive _assetSpawned)) 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]; @@ -626,7 +537,7 @@ if (_secureAsset && !(alive _assetSpawned)) then { _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]]; + if (!(_secureAsset) || (_secureAsset && (alive _assetSpawned))) then { _result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_markerClass, 0] call blck_fnc_endMission; diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf index ef8c6da..581c46d 100644 --- a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf +++ b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf @@ -15,12 +15,9 @@ private["_group","_isLegal","_weapon","_lastkill","_kills","_message","_killstreakMsg"]; params["_unit","_killer","_isLegal"]; -// if blck_cleanupAt > 0 then the death was already processed. if (_unit getVariable["blck_cleanupAt",-1] > 0) exitWith {}; -//diag_log format["_fnc_processAIKills:: function called with _this = %1",_this]; _unit setVariable ["blck_cleanupAt", (diag_tickTime) + blck_bodyCleanUpTimer, true]; -//diag_log format["_fnc_processAIKills: _unit = %1 | vehicle unit = %2",_unit, vehicle _unit]; blck_deadAI pushback _unit; _group = group _unit; @@ -51,7 +48,6 @@ if ((diag_tickTime - _lastkill) < 240) then _killer setVariable["blck_kills",0]; }; -//_unit action ["Eject", vehicle _unit]; [_unit, ["Eject", vehicle _unit]] remoteExec ["action",(owner _unit)]; if (blck_useKillMessages) then { @@ -65,16 +61,13 @@ if (blck_useKillMessages) then _message = format["[blck] %1 killed with %2 from %3 meters",name _killer,getText(configFile >> "CfgWeapons" >> _weapon >> "DisplayName"), round(_unit distance _killer)]; }; _message =_message + _killstreakMsg; - diag_log format["[blck] unit killed message is %1",_message,""]; [["aikilled",_message,"victory"],allPlayers] call blck_fnc_messageplayers; }; -//diag_log format["calling blck_fnc_rewardKiller for death of unit %1 and killer %2",_unit,_killer]; + [_unit,_killer] call blck_fnc_rewardKiller; if (blck_showCountAliveAI) then { - //diag_log "_fnc_processAIKills: Updating Map Marker AI Counts - blck_missionMarkers items are"; { - //diag_log format["_fnc_processAIKills: blck_missionMarkers itm %1 = %2",_forEachIndex,_x]; [_x select 0, _x select 1, _x select 2] call blck_fnc_updateMarkerAliveCount; } forEach blck_missionMarkers; };