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 aaf1d00..c6bf181 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_deleteMarker.sqf @@ -1,10 +1,15 @@ -//////////////////////////////////////////// -// Delete and change Mission Markers -// by Ghostrider-GFG- -////////////////////////////////////////// -// delete a marker +/* + Killed handler for _units + By Ghostrider-GRG- -//diag_log format["blck_fnc_deleteMarker:: _this = %1",_this]; + -------------------------- + 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["_markerName"]; _markerName = _this select 0; deleteMarker _markerName; diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_markerSetAliveAICount.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_markerSetAliveAICount.sqf index 9d57755..5204919 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_markerSetAliveAICount.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_markerSetAliveAICount.sqf @@ -1,6 +1,15 @@ /* - Set Alive AI Count + Killed handler for _units + 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/ */ +//#include "\q\addons\custom_server\Configs\blck_defines.hpp"; params["_mArray","_count"]; diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_missionCompleteMarker.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_missionCompleteMarker.sqf index 5bee6f6..f572e9b 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_missionCompleteMarker.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_missionCompleteMarker.sqf @@ -1,10 +1,15 @@ -//////////////////////////////////////////// -// Create, delete and change Mission Markers -// 7/10/15 -// by Ghostrider-GRG- -////////////////////////////////////////// -// spawn a temporary marker to indicate the position of a 'completed' mission -// this will not show to JIP players +/* + Killed handler for _units + 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/ +*/ +//#include "\q\addons\custom_server\Configs\blck_defines.hpp"; private["_location","_MainMarker","_name"]; //diag_log format["blck_fnc_missionCompleteMarker:: _this = %1",_this]; 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 7eea2d0..cd3fc03 100644 --- a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_spawnMarker.sqf +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_spawnMarker.sqf @@ -1,8 +1,15 @@ -//////////////////////////////////////////// -// Create Mission Markers -// by Ghostrider-GRG- -////////////////////////////////////////// -// spawn a round marker of a size and color specified in passed parameters +/* + Killed handler for _units + 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/ +*/ +//#include "\q\addons\custom_server\Configs\blck_defines.hpp"; private["_blck_fn_configureRoundMarker"]; _blck_fn_configureRoundMarker = { 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 86076dc..d8a9af7 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,3 +1,16 @@ +/* + Killed handler for _units + 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/ +*/ +//#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + diag_log format["_fnc_HC_XferGroup:: _this = %1",_this]; private["_group","_client","_unit","_tempEH"]; _group = _this select 0; @@ -9,11 +22,5 @@ _client = clientOwner; _tempEH = ["reloaded",_unit addEventHandler ["reloaded", {_this call compile preprocessfilelinenumbers blck_EH_unitWeaponReloaded;}]]; _localEH pushBack _tempEH; _x setVariable["localEH",_localEH,true]; - if(_unit != vehicle _unit) then - { - //diag_log format["_fnc_HC_XferGroup: _unit %1 is in vehicle %2",_unit, vehicle _unit]; - blck_HC_monitoredVehicles pushBack (vehicle _unit); - //diag_log format["_fnc_HC_XferGroup: blck_HC_monitoredVehicles = %1", blck_HC_monitoredVehicles]; - }; }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_countGroupsAssigned.sqf b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_countGroupsAssigned.sqf index 4c8fa74..85ae40c 100644 --- a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_countGroupsAssigned.sqf +++ b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_countGroupsAssigned.sqf @@ -1,19 +1,15 @@ - /* -blck_fnc_HC_XferGroup = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_XferGroup.sqf"; -//blck_fnc_HC_XferVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_XferVehicle.sqf"; -blck_fnc_onPlayerDisconnected = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_onPlayerDisconnected.sqf"; -//blck_fnc_HC_groupsAssigned = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_groupsAssigned.sqf"; -blck_fnc_HC_monitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HCmonitor.sqf"; -blck_fnc_HC_vehicleMonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_vehicleMonitor.sqf"; -blck_fnc_monitorHC = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_monitorHC.sqf"; -blck_fnc_passToHCs = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_passToHCs.sqf"; -blck_fnc_HC_getListConnected = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_getListConnected.sqf"; -blck_fnc_HC_leastBurdened = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_leastBurdened.sqf"; -blck_fnc_HC_countGroupsAssigned = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_countGroupsAssigned.sqf"; + Killed handler for _units + 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/ */ -//blck_fnc_HC_countGroupsAssigned = +//#include "\q\addons\custom_server\Configs\blck_defines.hpp"; params["_HC"]; private["_result"]; diff --git a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_getListConnected.sqf b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_getListConnected.sqf index 08e7e94..fa0e980 100644 --- a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_getListConnected.sqf +++ b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_getListConnected.sqf @@ -1,9 +1,18 @@ +/* + Killed handler for _units + 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/ +*/ +//#include "\q\addons\custom_server\Configs\blck_defines.hpp"; //blck_fnc_HC_getListConnected = +private _hcs = entities "HeadlessClient_F"; +//diag_log format["_fnc_HC_getListConected: _hcs = %1",_hcs]; +_hcs -private _hcs = []; -{ - if !(_x in _hcs) then {_hcs pushBack _x}; -}forEach entities "HeadlessClient_F"; -_hcs \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_groupsAssigned.sqf b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_groupsAssigned.sqf index 290b873..0d1b3a2 100644 --- a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_groupsAssigned.sqf +++ b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HC_groupsAssigned.sqf @@ -1,18 +1,19 @@ /* - * passToHCs.sqf - * - * In the mission editor, name the Headless Clients "HC", "HC2", "HC3" without the quotes - * - * In the mission init.sqf, call passToHCs.sqf with: - * execVM "passToHCs.sqf"; - * - * It seems that the dedicated server and headless client processes never use more than 20-22% CPU each. - * With a dedicated server and 3 headless clients, that's about 88% CPU with 10-12% left over. Far more efficient use of your processing power. - * - */ + Killed handler for _units + 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/ +*/ +//#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +private _clientId = clientOwner; +private _groupsOwned = {groupOwner _x isEqualTo _clientId)} count allGroups; +//diag_log format["_fnc_HC_groupsAssigned:: %1 groups running on client %2",_groupsOwned,_clientId]; +_groupsOwned +//[_clientId,_groupsOwned] remoteExec ["blck_fnc_updateClientGroupCounts",2]; -_clientId = clientOwner; -_allGroups = allGroups; -_groupsOwned = {groupOwner _x isEqualTo _clientId)} count allGroups; -[_clientId,_groupsOwned] remoteExec ["blck_fnc_updateClientGroupCounts",2]; -diag_log format["_fnc_HC_groupsAssigned:: %1 groups running on client %2",_groupsOwned,_clientId]; 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 476bdc5..87930c2 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 @@ -1,23 +1,20 @@ - /* -blck_fnc_HC_XferGroup = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_XferGroup.sqf"; -//blck_fnc_HC_XferVehicle = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_XferVehicle.sqf"; -blck_fnc_onPlayerDisconnected = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_onPlayerDisconnected.sqf"; -//blck_fnc_HC_groupsAssigned = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_groupsAssigned.sqf"; -blck_fnc_HC_monitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HCmonitor.sqf"; -blck_fnc_HC_vehicleMonitor = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_vehicleMonitor.sqf"; -blck_fnc_monitorHC = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_monitorHC.sqf"; -blck_fnc_passToHCs = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_passToHCs.sqf"; -blck_fnc_HC_getListConnected = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_getListConnected.sqf"; -blck_fnc_HC_leastBurdened = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_leastBurdened.sqf"; -blck_fnc_HC_countGroupsAssigned = compileFinal preprocessFileLineNumbers "\q\addons\custom_server\Compiles\HC\GMS_fnc_HC_countGroupsAssigned.sqf"; + Killed handler for _units + 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/ */ -//blck_fnc_HC_leastBurdened = +//#include "\q\addons\custom_server\Configs\blck_defines.hpp"; params["_HC_List"]; -private["_result","_fewestGroupsAssigned","_leastBurdened","_groupsAssigned"]; 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; { @@ -28,5 +25,5 @@ _leastBurdened = _HC_List select 0; _fewestGroupsAssigned = _groupsAssigned; }; }forEach _HC_List; -//diag_log format["_fnc_leastBurdened:: _fewestGroupsAssigned = %1 and _leastBurdened = %2",_fewestGroupsAssigned,_leastBurdened]; +diag_log format["_fnc_leastBurdened:: _fewestGroupsAssigned = %1 and _leastBurdened = %2",_fewestGroupsAssigned,_leastBurdened]; _leastBurdened diff --git a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HCmonitor.sqf b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HCmonitor.sqf index 9dc9531..f21ef65 100644 --- a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HCmonitor.sqf +++ b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_HCmonitor.sqf @@ -1,8 +1,17 @@ /* + Killed handler for _units + By Ghostrider-GRG- - vehicles = count blck_HC_monitoredVehicles; - */ -diag_log "_fnc_HC_monitor.sqf"; + -------------------------- + 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"; + +diag_log "_fnc_HC_monitor.sqf "; _blckGroups = 0; _otherGroups = 0; _totalGroups = 0; @@ -11,28 +20,6 @@ diag_log "_fnc_HC_monitor.sqf"; _timer3min = 0; while {true} do { - if (diag_tickTime > _timerOneSec) then - { - _timerOneSec = diag_tickTime + 1; - [] call blck_fnc_HC_vehicleMonitor; - }; - if (diag_tickTime > _timerSixtySec) then - { - _timerSixtySec = diag_tickTime + 60; - private _theGroups = blck_HC_monitoredGroups; - { - if (isNull _x) then {blck_HC_monitoredGroups = blck_HC_monitoredGroups - [_x]}; - if ( {alive _x} count (units _x) == 0) then { blck_HC_monitoredGroups = blck_HC_monitoredGroups - [_x]}; - } forEach _theGroups; - //_blckGroups = count blck_HC_monitoredGroups; - //_totalGroups = {(groupOwner _x) isEqualTo clientOwner} count allGroups; - //_totalGroups = _blckGroups + _otherGroups; - //diag_log format["blckHC:: headless client %1 ",_blckGroups,_otherGroups]; - }; - if (diag_tickTime > _timer3min) then - { - _timer3min = diag_tickTime + 300; - diag_log format["blckHC:: headless client %1 | time stamp %2 | %3 fps | _blckGroups = %4 _otherGroups = %5 | vehicles %6",clientOwner,diag_tickTime,diag_fps, count blck_HC_monitoredGroups,{ ((groupOwner _x) isEqualTo clientOwner) && !(_x getVariable["blck_group",true])} count allGroups, count blck_HC_monitoredVehicles ]; - }; + uiSleep 1; }; diff --git a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_onPlayerDisconnected.sqf b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_onPlayerDisconnected.sqf index 38f60a1..7414b90 100644 --- a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_onPlayerDisconnected.sqf +++ b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_onPlayerDisconnected.sqf @@ -1,3 +1,16 @@ +/* + Killed handler for _units + 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/ +*/ +//#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + params["_name","_owner"]; //diag_log format["_fnc_onPlayerDisconnected triggered with _name = %1 and _owner = %2",_name,_owner]; private["_HCownerids","_groupLocalEH","_vehicleLocalEH"]; 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 4c56ada..e55a261 100644 --- a/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_passToHCs.sqf +++ b/@GMS/addons/custom_server/Compiles/HC/GMS_fnc_passToHCs.sqf @@ -1,52 +1,67 @@ +/* + Killed handler for _units + 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/ +*/ +//#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + +if (!isServer) exitWith {}; +blck_fnc_countGroupsAssigned = { + params["_HC"]; + private["_result"]; + _result = {(groupOwner _x) == (owner _HC)} count allGroups; + //diag_log format["_fnc_countGroupsAssigned = %1",_result]; + _result +}; + //diag_log format["_fnc_passToHCs:: function called at server time %1",diag_tickTime]; private["_numTransfered","_clientId","_allGroups","_groupsOwned","_idHC","_id","_swap","_rc"]; -blck_connectedHCs = call blck_fnc_HC_getListConnected; -diag_log format["_fnc_passToHCs:: blck_connectedHCs = %1 | count _HCs = %2 | server FPS = %3",blck_connectedHCs,count blck_connectedHCs,diag_fps]; +_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 { _idHC = [blck_connectedHCs] call blck_fnc_HC_leastBurdened; - diag_log format["passToHCs: evaluating passTos for HC %1 || owner HC = %2",_idHC, owner _idHC]; + //diag_log format["passToHCs: evaluating passTos for HC %1 || owner HC = %2",_idHC, owner _idHC]; { // Pass the AI - _numTransfered = 0; + if (_x getVariable["blck_group",false]) then { - if ((leader _x) != vehicle (leader _x)) 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 { - private _v = vehicle (leader _x); - blck_monitoredVehicles = blck_monitoredVehicles - [_v]; - blck_HC_monitoredVehicles pushBack _v; - }; - //diag_log format["group belongs to blckeagls mission system so time to transfer it"]; - if ((typeName _x) isEqualTo "GROUP") then - { - _id = groupOwner _x; - //diag_log format["Owner of group %1 is %2",_x,_id]; - if (_id > 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 { - //diag_log format["group %1 is already assigned to an HC with _id of %2",_x,_id]; - _swap = false; - } else { - //diag_log format["group %1 should be moved to HC %2 with _idHC %3",_x,_idHC]; - _x setVariable["owner",owner _idHC]; - _rc = _x setGroupOwner (owner _idHC); [_x] remoteExec["blck_fnc_HC_XferGroup",_idHC]; - if ( _rc ) then - { - _numTransfered = _numTransfered + 1; - //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]; - }; + _numTransfered = _numTransfered + 1; + //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]; }; }; } else { //diag_log format["group %1 does not belong to blckeagls mission system",_x]; }; } forEach (allGroups); - //diag_log format["_passToHCs:: %1 groups transferred to HC %2",_numTransfered,_idHC]; - _numTransfered = 0; + 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 { diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf index 706fcbc..0c2b044 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionAI.sqf @@ -70,7 +70,7 @@ if ( (count _missionGroups > 0) && _noAIGroups > 0) then else { _newAI = units _newGroup; - blck_monitoredMissionAIGroups pushback _newGroup; + //blck_monitoredMissionAIGroups pushback _newGroup; #ifdef blck_debugMode if (blck_debugLevel >= 2) then { diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf index 435faef..2fe90dd 100644 --- a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_spawnMissionVehiclePatrols.sqf @@ -74,10 +74,10 @@ if (_missionPatrolVehicles isEqualTo []) then { _abort = true; }; - if !(isNull _vehGroup) then - { - blck_monitoredMissionAIGroups pushBack _vehGroup; - }; + //if !(isNull _vehGroup) then + //{ + //blck_monitoredMissionAIGroups pushBack _vehGroup; + //}; #ifdef blck_debugMode 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 92e23d4..3d2eada 100644 --- a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf +++ b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_processAIKill.sqf @@ -21,19 +21,7 @@ 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]; -/* -if (_unit != (vehicle _unit) then -{ - diag_log format["_fnc_processAIKills: evaluating status of crew of vehicle %1",vehicle _unit] - if ( {alive _x} count (crew (vehicle _unit)) < 1) then - { - diag_log format["_fnc_processAIKills: all crew dead, releasing vehicle"]; - [vehicle _unit] call blck_fnc_releaseVehicleToPlayers; - } else { - diag_log format["_fnc_processAIKills: vehicle %1 still has %2 crew alive",vehicle _unit, {alive _x} crew (vehicle _unit)]; - }; -}; -*/ + blck_deadAI pushback _unit; _group = group _unit; [_unit] joinSilent grpNull; @@ -65,8 +53,8 @@ if ((diag_tickTime - _lastkill) < 240) then _killer setVariable["blck_kills",0]; }; -_unit action ["Eject", vehicle _unit]; - +//_unit action ["Eject", vehicle _unit]; +[_unit, ["Eject", vehicle _unit]] remoteExec ["action",(owner _unit)]; if (blck_useKillMessages) then { _weapon = currentWeapon _killer; diff --git a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnParaUnits.sqf b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnParaUnits.sqf index 1db1cb8..588dca8 100644 --- a/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnParaUnits.sqf +++ b/@GMS/addons/custom_server/Compiles/Units/GMS_fnc_spawnParaUnits.sqf @@ -67,6 +67,6 @@ for "_i" from 1 to _numAI do }; -blck_monitoredMissionAIGroups pushback _paraGroup; +//blck_monitoredMissionAIGroups pushback _paraGroup; _paraGroup diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_EH_processAIVehicleKill.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_EH_processAIVehicleKill.sqf index c086eb1..59508f0 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_EH_processAIVehicleKill.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_EH_processAIVehicleKill.sqf @@ -11,6 +11,6 @@ http://creativecommons.org/licenses/by-nc-sa/4.0/ */ //#include "\q\addons\custom_server\Configs\blck_defines.hpp"; -diag_log format["_EH_processAIVehicleKill: _this = %1",_this]; +//diag_log format["_EH_processAIVehicleKill: _this = %1",_this]; if !(isDedicated) exitWith {}; _this call blck_fnc_processAIVehicleKill; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_destroyVehicleAndCrew.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_destroyVehicleAndCrew.sqf index 369aca5..6594767 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_destroyVehicleAndCrew.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_destroyVehicleAndCrew.sqf @@ -1,8 +1,16 @@ -//_fn_destroyVehicleAndCrew = { +/* + Killed handler for _units + 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/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; params["_veh"]; - //private["_crew"]; - //_crew = crew _veh; - //diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; {[_x] call blck_fnc_deleteAI;} forEach (crew _veh); [_veh] call blck_fnc_deleteAIvehicle; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_releaseVehicleToPlayers.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_releaseVehicleToPlayers.sqf index f181b96..bed3ea3 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_releaseVehicleToPlayers.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_releaseVehicleToPlayers.sqf @@ -1,23 +1,50 @@ +/* + Killed handler for _units + 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/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; params["_veh"]; - //blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; - _veh setVehicleLock "UNLOCKED" ; - //_v setVariable["releasedToPlayers",true]; - //[_v] call blck_fnc_emptyObject; + blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + //diag_log format["_fnc_releaseVehicleToPlayersl: _veh = %1 | (owner _veh) = %2",_veh,(owner _veh)]; + //diag_log format["_fnc_releaseVehicleToPlayersl: initial lock state of vehicle 51 = %2",_veh,locked _veh]; + //_veh setVehicleLock "UNLOCKED" ; + _locked = true; + _count = 0; + _timeIn = diag_tickTime; + while {_count < 2} do + { + //diag_log format["_fnc_releaseVehicleToPlayersl: attempting to unlock vehicle %1",_veh]; + [_veh,"UNLOCKED"] remoteExec ["setVehicleLock",0]; // unlock on all clients so we don't have to worry about any change of ownership when the driver is ejected. + // a bit of bandwidth seems worth ensuring that vehicles do in fact get unlocked. + uiSleep 0.1; + _count = _count + 1; + diag_log format["_fnc_releaseVehicleToPlayersl: locked state of vehicle %1 = ^%2",_veh, locked _veh]; + //if ((_veh locked) isEqualTo "UNLOCKED" || (diag_tickTime - _timeIn) > 5) then {_locked = false}; + }; + // {player setAmmo [primaryWeapon player, 1];} remoteExec ["bis_fnc_call", 0]; + //{[_veh setVehicleLock "UNLOCKED"];} remoteExec ["BIS_fnc_call",(owner _veh)]; { _veh removealleventhandlers _x; } forEach ["GetIn","GetOut","fired","hit","hitpart","reloaded","dammaged","HandleDamage"]; { _veh removeAllMPEventHandlers _x; } forEach ["MPHit","MPKilled"]; - _veh setVariable["blck_releasedAt",diag_tickTime,true]; _veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer,true]; - if ((damage _veh) > 0.5) then {_veh setDamage 0.5}; - //diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1 and blck_deleteAT = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; + if ((damage _veh) > 0.6) then {_veh setDamage 0.6}; + #ifdef blck_debugMode if (blck_debugLevel > 2) then { diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; }; #endif +//diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_reloadVehicleAmmo.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_reloadVehicleAmmo.sqf index 088472c..851f2de 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_reloadVehicleAmmo.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_reloadVehicleAmmo.sqf @@ -1,6 +1,18 @@ -//_fn_reloadAmmo = { +/* + Killed handler for _units + 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/ +*/ +#include "\q\addons\custom_server\Configs\blck_defines.hpp"; + params["_veh"]; private ["_crew","_mag","_allMags","_cnt"]; // https://community.bistudio.com/wiki/fullCrew diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli.sqf index 281a1dd..e283092 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_spawnMissionHeli.sqf @@ -149,7 +149,7 @@ if !(isNull _grpPilot) then }; #endif - blck_monitoredMissionAIGroups pushBack _grpPilot; + //blck_monitoredMissionAIGroups pushBack _grpPilot; }; //diag_log format["[blckeagls] _fnc_spawnMissionHeli:: _patrolHeli %1 | _grpPilot %2 | _abort %3",_patrolHeli,_grpPilot,_abort]; _return = [_patrolHeli,units _grpPilot,_abort]; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf index 48e9289..4144343 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf @@ -11,29 +11,13 @@ */ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; -//diag_log format["_fnc_vehicleMonitor: starting function at diag_tickTime = %1",diag_tickTime]; - -#ifdef blck_debugMode - //diag_log format["_fnc_vehicleMonitor:: blck_debugMode defined"]; -#endif - -private ["_vehList","_veh","_isEmplaced","_ownerIsPlayer","_allCrewDead","_deleteNow","_missionCompleted","_evaluate","_cleanupTimer"]; +private ["_vehList","_veh","_isEmplaced","_ownerIsPlayer","_allCrewDead","_deleteNow","_evaluate"]; _vehList = +blck_monitoredVehicles; #ifdef blck_debugMode if (blck_debugLevel > 2) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; #endif -//diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles]; - -// Check for any vehicles no longer on an HC -{ - if ( (owner _x) == 2) then - { - // vehicle no longer on headless client - blck_HC_monitoredVehicles - blck_HC_monitoredVehicles - [_x]; - blck_monitoredVehicles pushBack _x; - }; -} forEach blck_HC_monitoredVehicles; +//diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 ",diag_tickTime,_vehList,blck_monitoredVehicles]; { /* @@ -41,34 +25,33 @@ if (blck_debugLevel > 2) then {diag_log format["_fnc_vehicleMonitor:: function c _isEmplaced _ownerIsPlayer _allCrewDead - _deleteNow + + _handleReloadRefuel (0) + _scheduleDeletion (2) [_allCrewDead && !_isEmplaced && !_scheduled] // all vehicles other than statics + _disableNow and schedule for deletion (1) [_allCrewDead && _isEmplaced] // emplaced weapons + _deleteNow (3) + _releaseToPlayer (4) [_allCrewDead && !_isEmplaced && _ownerIsPlayer] + _default (5) reload rearm */ - //diag_log format["_fnc_vehicleMonitor: evaluating vehicle %1",_x]; - if (local _x) then + + if (true) then { + private["_veh","_isEmplaced","_ownerIsPlayer","_allCrewDead","_deleteNow","_evaluate"]; _veh = _x; // (purely for clarity at this point, _x could be used just as well) + _isEmplaced = _veh getVariable["GRG_vehType","none"] isEqualTo "emplaced"; _ownerIsPlayer = if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then {true} else {false}; _allCrewDead = if (({alive _x} count (crew _veh)) == 0) then {true} else {false}; - //diag_log format["_fnc_vehicleMonitor: _allCrewDead = %1",_allCrewDead]; - _deletenow = false; - if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then {_deleteNow = true}; - _missionCompleted = if (_veh getVariable["missionCompleted",0] != 0) then {true} else {false}; - _evaluate = true; - - if (_ownerIsPlayer) then + _evaluate = 0; + if (_allCrewDead && _isEmplaced && (_veh getVariable["blck_deleteAt",0] == 0)) then {_evaluate = 1}; + if (_allCrewDead && !(_isEmplaced) && (_veh getVariable["blck_deleteAt",0] == 0)) then {_evaluate = 2}; + if ((_veh getVariable["blck_deleteAt",0] > 0) && (diag_tickTime > (_veh getVariable["blck_deleteAt",0]))) then {_evaluate = 3}; + if (/*_ownerIsPlayer*/ (owner _veh > 2) && !(owner _veh in blck_connectedHCs)) then {_evaluate = 4}; + //diag_log format["_fnc_vehicleMonitor: vehicle = %1 | owner = %2 | crew = %2",_veh, owner _veh, {alive _x} count (crew _veh)]; + switch (_evaluate) do { - // disable further monitoring and mark to never be deleted. - _evaluate = false; - _veh setVariable["blck_DeleteAt",0]; - blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; - //diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh]; - }; - - if (_allCrewDead && _evaluate) then - { - if (_isEmplaced) then - { + case 0:{[_veh] call blck_fnc_reloadVehicleAmmo;}; + case 1:{ if (blck_killEmptyStaticWeapons) then { #ifdef blck_debugMode @@ -79,37 +62,23 @@ if (blck_debugLevel > 2) then {diag_log format["_fnc_vehicleMonitor:: function c }else { [_veh] call blck_fnc_releaseVehicleToPlayers; }; - _evaluate = false; - } else { + }; + case 2:{ if (blck_killEmptyAIVehicles) then { _veh setDamage 0.7; _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; } else { - //diag_log format["_fnc_vehicleMonitor:: case of RELEASE where vehicle = %1 and Vehicle is typeOf %2",_veh, typeOf _veh]; [_veh] call blck_fnc_releaseVehicleToPlayers; }; - _evaluate = false; }; - }; - - if (_missionCompleted && !(_allCrewDead)) then - { - //diag_log format["_fnc_vehicleMonitor:: case of mission vehicle with AI alive at mission end: schedule destruction with _veh = %1 and typeOf _veh = %2",_veh, typeOf _veh]; - _cleanupTimer = _veh getVariable["blck_DeleteAt",0]; // The time delete to deleting any alive AI units - if (_cleanupTimer == 0) then {_veh setVariable["blck_DeleteAt",diag_tickTime + blck_vehicleDeleteTimer]}; - _evaluate = false; - }; - - if (_evaluate) then - { - [_veh] call blck_fnc_reloadVehicleAmmo; - }; - - if (_deleteNow) then - { - [_veh] call blck_fnc_destroyVehicleAndCrew; - _evaluate = false; + case 3:{ + [_veh] call blck_fnc_destroyVehicleAndCrew; + }; + case 4:{ + _veh setVariable["blck_DeleteAt",nil]; + blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + }; }; }; }forEach _vehList; diff --git a/@GMS/addons/custom_server/Compiles/blck_variables.sqf b/@GMS/addons/custom_server/Compiles/blck_variables.sqf index 5a3c4d6..62b529b 100644 --- a/@GMS/addons/custom_server/Compiles/blck_variables.sqf +++ b/@GMS/addons/custom_server/Compiles/blck_variables.sqf @@ -12,7 +12,7 @@ */ #include"\q\addons\custom_server\Configs\blck_defines.hpp"; -blck_debugON = false; +blck_debugON = true; blck_debugLevel = 0; // Sets level of detail for debugging info - WIP. blck_minFPS = 8; @@ -36,8 +36,8 @@ blck_connectedHCs = []; blck_missionMarkers = []; blck_groupsOnHC = []; blck_vehiclesOnHC = []; -blck_HC_monitoredVehicles = []; -blck_HC_monitoredGroups = []; +//blck_HC_monitoredVehicles = []; +//blck_HC_monitoredGroups = []; #ifdef useDynamicSimulation "Group" setDynamicSimulationDistance 1800; enableDynamicSimulationSystem true;