diff --git a/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_updateAllMarkerAliveCounts.sqf b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_updateAllMarkerAliveCounts.sqf new file mode 100644 index 0000000..7597e6b --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Functions/GMS_fnc_updateAllMarkerAliveCounts.sqf @@ -0,0 +1,16 @@ +/* + 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 "_fnc_updateAllMarkerAliveCounts called"; +/* +{ + diag_log format["_fnc_updateAllMarkerAliveCounts: _x = %1",_x]; + [_x select 0, _x select 1, _x select 2] call blck_fnc_updateMarkerAliveCount; +}forEach blck_missionMarkers; diff --git a/@GMS/addons/custom_server/Compiles/Functions/passToHC_default.sqf b/@GMS/addons/custom_server/Compiles/Functions/passToHC_default.sqf deleted file mode 100644 index 5cfe14b..0000000 --- a/@GMS/addons/custom_server/Compiles/Functions/passToHC_default.sqf +++ /dev/null @@ -1,287 +0,0 @@ -/* - * 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. - * - */ - -PassToHC_ReceiveMessage = compileFinal " - if (hasInterface && (serverCommandAvailable '#kick' || isServer)) then { - player globalChat (_this select 0); - }; -"; - -if (!isServer) exitWith {}; - -waitUntil{!isNil "f_param_headlessClient"}; - -if (f_param_headlessClient == 0) exitWith {}; - -private ["_HC_ID","_HC2_ID","_HC3_ID","_rebalanceTimer","_cleanUpThreshold","_maxWait","_loadBalance","_currentHC","_numTransfered","_swap","_rc","_numHC","_numHC2","_numHC3","_numDeleted"]; - -PassToHC_SendMessage = compileFinal " - diag_log text _this; - if (isServer && hasInterface) then { - [_this] call PassToHC_ReceiveMessage; - } else { - [[_this], 'PassToHC_ReceiveMessage', true, false] call BIS_fnc_MP; - }; -"; - -"passToHCs: Started" call PassToHC_SendMessage; - -waitUntil {!isNil "HC"}; -waitUntil {!isNull HC}; - -_HC_ID = -1; // Will become the Client ID of HC -_HC2_ID = -1; // Will become the Client ID of HC2 -_HC3_ID = -1; // Will become the Client ID of HC3 -_rebalanceTimer = 60; // Rebalance sleep timer in seconds -_cleanUpThreshold = 50; // Threshold of number of dead bodies + destroyed vehicles before forcing a clean up - -PassToHC_NumTransfered = 0; - -"passToHCs: Waiting for init scripts to settle before starting first pass..." call PassToHC_SendMessage; - -sleep 15; - -// If DAC is initializing after start delay wait until it finishes or timeout -if (!isNil "DAC_Basic_Value") then { - _maxWait = time + 30; - waituntil {sleep 1; (DAC_Basic_Value > 0) || time > _maxWait}; -}; - -// If UPSMON is initializing after start delay wait until it finishes or timeout -if (!isNil "UPSMON_INIT") then { - _maxWait = time + 30; - waituntil {sleep 1; (UPSMON_INIT > 0) || time > _maxWait}; -}; - -// Wait a bit more just in-case they scripts have not settled/synced yet -sleep 3; - -format["passToHCs: First pass beginning now..."] call PassToHC_SendMessage; - -while {true} do { - // Do not enable load balancing unless more than one HC is present - // Leave this variable false, we'll enable it automatically under the right conditions - _loadBalance = false; - - // Get HC Client ID else set variables to null - try { - _HC_ID = owner HC; - - if (_HC_ID > 2) then { - diag_log format ["passToHCs: Found HC with Client ID %1", _HC_ID]; - } else { - diag_log "passToHCs: [WARN] HC disconnected"; - - HC = objNull; - _HC_ID = -1; - }; - } catch { diag_log format ["passToHCs: [ERROR] [HC] %1", _exception]; HC = objNull; _HC_ID = -1; }; - - // Get HC2 Client ID else set variables to null - if (!isNil "HC2") then { - try { - _HC2_ID = owner HC2; - - if (_HC2_ID > 2) then { - diag_log format ["passToHCs: Found HC2 with Client ID %1", _HC2_ID]; - } else { - diag_log "passToHCs: [WARN] HC2 disconnected"; - - HC2 = objNull; - _HC2_ID = -1; - }; - } catch { diag_log format ["passToHCs: [ERROR] [HC2] %1", _exception]; HC2 = objNull; _HC2_ID = -1; }; - } else { - HC2 = objNull; - }; - - // Get HC3 Client ID else set variables to null - if (!isNil "HC3") then { - try { - _HC3_ID = owner HC3; - - if (_HC3_ID > 2) then { - diag_log format ["passToHCs: Found HC2 with Client ID %1", _HC3_ID]; - } else { - diag_log "passToHCs: [WARN] HC3 disconnected"; - - HC3 = objNull; - _HC3_ID = -1; - }; - } catch { diag_log format ["passToHCs: [ERROR] [HC3] %1", _exception]; HC3 = objNull; _HC3_ID = -1; }; - } else { - HC3 = objNull; - }; - - // If no HCs present, wait for HC to rejoin - if ( (isNull HC) && (isNull HC2) && (isNull HC3) ) then { waitUntil {!isNull HC}; }; - - // Check to auto enable Round-Robin load balancing strategy - if ( (!isNull HC && !isNull HC2) || (!isNull HC && !isNull HC3) || (!isNull HC2 && !isNull HC3) ) then { _loadBalance = true; }; - - if ( _loadBalance ) then { - diag_log "passToHCs: Starting load-balanced transfer of AI groups to HCs"; - } else { - // No load balancing - diag_log "passToHCs: Starting transfer of AI groups to HC"; - }; - - // Determine first HC to start with - _currentHC = 0; - - if (!isNull HC) then { _currentHC = 1; } else { - if (!isNull HC2) then { _currentHC = 2; } else { _currentHC = 3; }; - }; - - // Pass the AI - _numTransfered = 0; - { - _syncGroup = _x; - _swap = true; - - _ownerID = _HC_ID; - - if ( _loadBalance ) then { - - _ownerID = switch (_currentHC) do { - case 1: { if (!isNull HC2) then { _currentHC = 2; } else { _currentHC = 3; }; _HC_ID }; - case 2: { if (!isNull HC3) then { _currentHC = 3; } else { _currentHC = 1; }; _HC2_ID }; - case 3: { if (!isNull HC) then { _currentHC = 1; } else { _currentHC = 2; }; _HC3_ID }; - default {-1}; - }; - - } else { - - _ownerID = switch (_currentHC) do { - case 1: {_HC_ID}; - case 2: {_HC2_ID}; - case 3: {_HC3_ID}; - default {-1}; - }; - - }; - - // Check if group has already been transfered - if (_syncGroup getVariable ["hc_transfered", false]) then { - _swap = false; - } else { - - if (groupOwner _syncGroup == _ownerID) then { - _x setVariable ["hc_transfered", true]; - _swap = false; - }; - - }; - - // Check if group is blacklisted - if (_syncGroup getVariable ["hc_blacklist", false]) then { - _swap = false; - }; - - if ( _swap ) then { - { - // If a player is in this group, don't swap to an HC - if (isPlayer _x) exitWith { _swap = false; }; - - // If a unit has 'hc_blacklist' set to true and is in this group, don't swap to an HC. - if (_x getVariable ["hc_blacklist", false]) exitWith { _swap = false; }; - - // If unit is in a vehicle check if vehicle or crew is blacklisted - if (vehicle _x != _x) then { - if ((vehicle _x) getVariable ["hc_blacklist", false]) exitWith { _swap = false; }; - }; - - } forEach (units _syncGroup); - }; - - // Check if group has any waypoints synced to triggers and auto blacklist - if ( _swap ) then { - { - if (count (synchronizedTriggers _x) > 0) exitWith { - _syncGroup setVariable ["hc_blacklist", true]; - _swap = false; - }; - } forEach (waypoints _syncGroup); - }; - - // If load balance enabled, round robin between the HCs - else pass all to HC - if ( _swap ) then { - _rc = false; - - _syncTrigArray = []; - _syncWayArray = []; - { - _wayNum = _forEachIndex; - _syncedTrigs = synchronizedTriggers _x; - _syncTrigArray set [_wayNum,_syncedTrigs]; - - _syncedWays = synchronizedWaypoints _x; - _syncWayArray set [_wayNum,_syncedWays]; - } forEach waypoints _x; - - if (_ownerID >= 0) then { - _rc = _x setGroupOwner _ownerID; - } else { - diag_log format["passToHCs: [ERROR] No Valid HC to pass to. _currentHC = %1", _currentHC]; - }; - - - // If the transfer was successful, count it for accounting and diagnostic information - if ( _rc ) then { - _x setVariable ["hc_transfered", true]; - PassToHC_NumTransfered = PassToHC_NumTransfered + 1; - }; - }; - } forEach (allGroups); - - if (PassToHC_NumTransfered > 0) then { - // More accounting and diagnostic information - - diag_log format ["passToHCs: Transfered %1 AI groups to HC(s)", PassToHC_NumTransfered]; - - _numHC = 0; - _numHC2 = 0; - _numHC3 = 0; - - { - switch (owner ((units _x) select 0)) do { - case _HC_ID: { _numHC = _numHC + 1; }; - case _HC2_ID: { _numHC2 = _numHC2 + 1; }; - case _HC3_ID: { _numHC3 = _numHC3+ 1; }; - }; - } forEach (allGroups); - - diag_log if (_numHC > 0) then { format ["passToHCs: %1 AI groups currently on HC", _numHC]; }; - diag_log if (_numHC2 > 0) then { format ["passToHCs: %1 AI groups currently on HC2", _numHC2]; }; - diag_log if (_numHC3 > 0) then { format ["passToHCs: %1 AI groups currently on HC3", _numHC3]; }; - - diag_log format ["passToHCs: %1 AI groups total across all HC(s)", (_numHC + _numHC2 + _numHC3)]; - } else { - diag_log "passToHCs: No rebalance or transfers required this round"; - }; - - // Force clean up dead bodies and destroyed vehicles - if (count allDead > _cleanUpThreshold) then { - _numDeleted = 0; - { - deleteVehicle _x; - - _numDeleted = _numDeleted + 1; - } forEach allDead; - - diag_log format ["passToHCs: Cleaned up %1 dead bodies/destroyed vehicles", _numDeleted]; - }; - - // Rebalance every rebalanceTimer seconds to avoid hammering the server - sleep _rebalanceTimer; -}; \ No newline at end of file diff --git a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_setWaypoints.sqf b/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_setWaypoints.sqf deleted file mode 100644 index 316f435..0000000 --- a/@GMS/addons/custom_server/Compiles/Groups/GMS_fnc_setWaypoints.sqf +++ /dev/null @@ -1,92 +0,0 @@ -// Sets up waypoints for a specified group. -/* - for ghostridergaming - By Ghostrider [GRG] - Copyright 2016 - Last modified 3/17/17 - - -------------------------- - 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["_dir","_arc","_noWp","_newpos","_wpradius","_wp"]; -params["_pos","_minDis","_maxDis","_group",["_mode","random"],["_patrolMode","SAD"]]; - -/* -_pos = _this select 0; // center of the patrol area -_minDis = _this select 1; // minimum distance from the center of a patrol area for waypoints -_maxDis = _this select 2; // maximum distance from the center of a patrol area for waypoints -_group = _this select 3; -*/ - - -_group setVariable["patrolCenter",_pos]; -_group setVariable["minDis",_minDis]; -_group setVariable["maxDis",_maxDis]; -_group setVariable["timeStamp",diag_tickTime]; -_group setVariable["arc",0]; -_group setVariable["wpRadius",30]; -_group setVariable["wpMode",_mode]; - -_dir = 0; -_arc = 30; -_noWp = 1; -_wpradius = 30; -_newPos = _pos getPos [(_minDis+(random (_maxDis - _minDis))), _dir]; -_wp = [_group, 0]; - -#ifdef wpModeMove -_wp setWaypointType "MOVE"; -_wp setWaypointName "move"; -_wp setWaypointTimeout [1,1.1,1.2]; -_wp setWaypointStatements ["true","this call blck_fnc_changeToSADWaypoint;diag_log format['====Updating waypoint to SAD for group %1',group this];"]; -#else -_wp setWaypointType "SAD"; -_wp setWaypointName "sad"; -_wp setWaypointTimeout [20,25,30]; -_wp setWaypointStatements ["true","this call blck_fnc_changeToMoveWaypoint;diag_log format['====Updating waypoint to Move for group %1',group this];"]; -#endif - -_wp setWaypointBehaviour blck_groupBehavior; -_wp setWaypointCombatMode blck_combatMode; -_group setCurrentWaypoint _wp; - -/* -Code for Build 44 as a referemce/ -private["_dist","_dir","_arc","_xpos","_ypos","_newpos","_wpradius","_wpnum","_oldpos"]; -params["_pos","_minDis","_maxDis","_group"]; - -_wpradius = 30; -_wpnum = 6; -_dir = random 360; -_arc = 360/_wpnum; - -for "_i" from 0 to (_wpnum - 1) do -{ - _dir = _dir + _arc; - _dist = (_minDis+(random (_maxDis - _minDis))); - _newpos = _pos getPos [_dist, _arc]; - - _wp = _group addWaypoint [_newpos, 0]; - _wp setWaypointTimeout [1, 1.1, 1.2]; - _wp setWaypointType "MOVE"; - _wp setWaypointBehaviour "COMBAT"; - _wp setWaypointCombatMode "RED"; - _wp setWaypointName "move"; - _wp = _group addWaypoint [_newpos, 0]; - _wp setWaypointTimeout [15,20,25]; - _wp setWaypointType "SAD"; - _wp setWaypointBehaviour "COMBAT"; - _wp setWaypointCombatMode "RED"; - _wp setWaypointName "sad"; -}; -deleteWaypoint [_group, 0]; -_group setVariable["wpIndex",0]; -_wp = _group addWaypoint [_newpos, _wpradius]; -_wp setWaypointType "CYCLE"; diff --git a/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf new file mode 100644 index 0000000..eca6d38 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Missions/GMS_fnc_missionSpawner - Copy.sqf @@ -0,0 +1,519 @@ +/* + Generic Mission Spawner + By Ghostrider GRG + Copyright 2016 + Last modified 10/9/17 + + -------------------------- + 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"; +#define delayTime 1 +private ["_abort","_crates","_aiGroup","_objects","_groupPatrolRadius","_missionLandscape","_mines","_blck_AllMissionAI","_blck_localMissionMarker","_AI_Vehicles","_timeOut","_aiDifficultyLevel","_missionPatrolVehicles","_missionGroups"]; +params["_coords","_mission",["_allowReinforcements",true]]; +//diag_log format["_missionSpawner (18):: _allowReinforcements = %1",_allowReinforcements]; + +//////// +// set all variables needed for the missions +// data is pulled either from the mission description or from the _mission variable passsed as a parameter +// Deal with situations where some of these variables might not be defined as well. +//////// + +// _mission params[_missionListOrange,_pathOrange,"OrangeMarker","orange",blck_TMin_Orange,blck_TMax_Orange]; +_markerClass = _mission select 2; +_aiDifficultyLevel = _mission select 3; + +[_mission,"active",_coords] call blck_fnc_updateMissionQue; +blck_ActiveMissionCoords pushback _coords; +diag_log format["[blckeagls] missionSpawner (17):: Initializing mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + +private["_chanceHeliPatrol","_noPara","_reinforcementLootCounts","_chanceLoot","_heliCrew","_loadCratesTiming"]; + +if (isNil "_markerColor") then {_markerColor = "ColorBlack"}; +if (isNil "_markerType") then {_markerType = ["mil_box",[]]}; +//if (isNil "_timeOut") then {_timeOut = -1;}; +if (isNil "_loadCratesTiming") then {_loadCratesTiming = blck_loadCratesTiming}; // valid choices are "atMissionCompletion" and "atMissionSpawn"; +if (isNil "_missionPatrolVehicles") then { + //diag_log format["_missionSpawner (44):: _missionPatrolVehicles isNil, Definining it as an empty array"]; + _missionPatrolVehicles = []; + //diag_log format["_missionSpawner (46):: _missionPatrolVehicles is %1",_missionPatrolVehicles]; +}; +if (isNil "_missionGroups") then {_missionGroups = []}; +private["_useMines","_blck_AllMissionAI","_delayTime","_groupPatrolRadius"]; +if (isNil "_useMines") then {_useMines = blck_useMines;}; + +_objects = []; +_mines = []; +_crates = []; +_aiGroup = []; +_missionAIVehicles = []; +_blck_AllMissionAI = []; +_AI_Vehicles = []; +_blck_localMissionMarker = [_markerClass,_coords,"","",_markerColor,_markerType]; +_delayTime = 1; +_groupPatrolRadius = 50; + +if (blck_labelMapMarkers select 0) then +{ + //diag_log "labeling map markers *****"; + _blck_localMissionMarker set [2, _markerMissionName]; +}; +if !(blck_preciseMapMarkers) then +{ + //diag_log "Map marker will be OFFSET from the mission position"; + _blck_localMissionMarker set [1,[_coords,75] call blck_fnc_randomPosition]; +}; +_blck_localMissionMarker set [3,blck_labelMapMarkers select 1]; // Use an arrow labeled with the mission name? +[["start",_startMsg,_markerMissionName]] call blck_fnc_messageplayers; +[_blck_localMissionMarker] call blck_fnc_spawnMarker; + blck_aiCountMarkers pushBack ["ai_count" + _markerClass, _blck_AllMissionAI]; +#ifdef blck_debugMode +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (91) message players and spawn a mission marker";}; +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (77) waiting for player to trigger the mission";}; +#endif +//////// +// All parameters are defined, lets wait until a player is nearby or the mission has timed out +//////// + +private["_wait","_missionStartTime","_playerInRange","_missionTimedOut"]; +_missionStartTime = diag_tickTime; +_playerInRange = false; +_missionTimedOut = false; +_wait = true; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then {diag_log "missionSpawner:: (90) starting mission trigger loop"}; +#endif + +while {_wait} do +{ + #ifdef blck_debugMode + //diag_log "missionSpawner:: top of mission trigger loop"; + if (blck_debugLevel > 2) exitWith {_playerInRange = true;}; + #endif + + if ([_coords, blck_TriggerDistance, false] call blck_fnc_playerInRange) exitWith {_playerInRange = true;}; + if ([_missionStartTime] call blck_fnc_timedOut) exitWith {_missionTimedOut = true;}; + uiSleep 5; + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format["missionSpawner:: Trigger Loop - blck_debugLevel = %1 and _coords = %2",blck_debugLevel, _coords]; + diag_log format["missionSpawner:: Trigger Loop - players in range = %1",{isPlayer _x && _x distance2D _coords < blck_TriggerDistance} count allPlayers]; + diag_log format["missionSpawner:: Trigger Loop - timeout = %1", [_missionStartTime] call blck_fnc_timedOut]; + }; + #endif +}; + +if (_missionTimedOut) exitWith +{ +/* + +*/ + // Deal with the case in which the mission timed out. + //["timeOut",_endMsg,_blck_localMissionMarker select 2] call blck_fnc_messageplayers; + blck_recentMissionCoords pushback [_coords,diag_tickTime]; + blck_ActiveMissionCoords = blck_ActiveMissionCoords - [ _coords]; + [_mission,"inactive",[0,0,0]] call blck_fnc_updateMissionQue; + blck_missionsRunning = blck_missionsRunning - 1; + [_blck_localMissionMarker select 0] call blck_fnc_deleteMarker; + //_blck_localMissionMarker set [1,[0,0,0]]; + //_blck_localMissionMarker set [2,""]; + [_objects, 0.1] spawn blck_fnc_cleanupObjects; + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] missionSpawner:: (133) Mission Timed Out: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif +}; + +//////// +// Spawn the mission objects, loot chest, and AI +//////// +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (142) -- >> Mission tripped: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +private ["_temp"]; +if (blck_SmokeAtMissions select 0) then // spawn a fire and smoke near the crate +{ + _temp = [_coords,blck_SmokeAtMissions select 1] call blck_fnc_smokeAtCrates; + if (typeName _temp isEqualTo "ARRAY") then + { + _objects append _temp; + }; +}; + +uiSleep _delayTime; +if (_useMines) then +{ + _mines = [_coords] call blck_fnc_spawnMines; + //uiSleep _delayTime;; +}; +uiSleep _delayTime; +_temp = []; +diag_log format["_missionSpawner"" _missionLandscape = %1",_missionLandscape]; +if (_missionLandscapeMode isEqualTo "random") then +{ + _temp = [_coords,_missionLandscape, 3, 15, 2] call blck_fnc_spawnRandomLandscape; +} else { + params["_center","_objects"]; + _temp = [_coords, _missionLandscape] call blck_fnc_spawnCompositionObjects; + //uiSleep 1; +}; +if (typeName _temp isEqualTo "ARRAY") then +{ + _objects append _temp; +}; +//diag_log format["_fnc_missionSpawner:: (181)->> _objects = %1",_objects]; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (190) Landscape spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +uiSleep _delayTime;; + +_temp = [_coords,_missionLootVehicles] call blck_fnc_spawnMissionLootVehicles; +//uisleep 1; +_crates append _temp; + +uiSleep _delayTime; + +_abort = false; +_temp = [[],[],false]; +_temp = [_coords, _minNoAI,_maxNoAI,_aiDifficultyLevel,_uniforms,_headGear,_missionGroups] call blck_fnc_spawnMissionAI; + +#ifdef blck_debugMode +if (blck_debugLevel > 2) then { + diag_log format["missionSpawner :: (209) 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 :: (214) blck_fnc_spawnMissionAI returned a value of _abort = %1",_abort]; uiSleep 1; +}; +#endif + +if (_abort) exitWith +{ + if (blck_debugLevel > 1) then { + diag_log "missionSpawner:: (220) grpNull returned, mission termination criteria met, calling blck_fnc_endMission" + }; + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1] call blck_fnc_endMission; +}; +if !(_abort) then +{ + _blck_AllMissionAI append (_temp select 0); +}; + +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (235) AI Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; +}; +#endif + +uiSleep _delayTime; +_temp = [[],[],false]; +_abort = false; +private["_patrolVehicles","_vehToSpawn"]; +_vehToSpawn = [_noVehiclePatrols] call blck_fnc_getNumberFromRange; +//diag_log format["_missionSpawner:: _vehToSpawn = %1",_vehToSpawn]; +//diag_log format["_missionSpawner (245):: _missionPatrolVehicles = %1",_missionPatrolVehicles]; +if (blck_useVehiclePatrols && ((_vehToSpawn > 0) || count _missionPatrolVehicles > 0)) then +{ + _temp = [_coords,_vehToSpawn,_aiDifficultyLevel,_uniforms,_headGear,_missionPatrolVehicles] call blck_fnc_spawnMissionVehiclePatrols; + //[_coords,_noVehiclePatrols,_aiDifficultyLevel,_uniforms,_headGear,_markerClass] call blck_fnc_spawnMissionVehiclePatrols; + #ifdef blck_debugMode + if (blck_debugLevel > 1) then { + diag_log format["missionSpawner :: (251) blck_fnc_spawnMissionVehiclePatrols returned _temp = %1",_temp]; + }; + #endif + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + }; + if !(_abort) then + { + _patrolVehicles = _temp select 0; + _blck_AllMissionAI append (_temp select 1); + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] missionSpawner:: (267) Vehicle Patrols Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif + + }; +}; + +if (_abort) exitWith +{ + #ifdef blck_debugMode + if (blck_debugLevel > 0) then { + diag_log "missionSpawner:: (279) grpNull returned, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1] call blck_fnc_endMission; +}; + +uiSleep _delayTime; +_temp = [[],[],false]; +_abort = false; + +if (_allowReinforcements) then +{ + _weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout; + _temp = []; + + #ifdef blck_debugMode + if (blck_debugLevel > 1) then + { + diag_log format["[blckeagls] missionSpawner:: (298) calling in reinforcements: Current mission: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif + private _noChoppers = 0; + private _chancePara = 0.5; + switch (toLower _aiDifficultyLevel) do + { + case "blue":{ + _noChoppers = [blck_noPatrolHelisBlue] call blck_fnc_getNumberFromRange; + _chancePara = [blck_chanceParaBlue] call blck_fnc_getNumberFromRange; + }; + case "red":{ + _noChoppers = [blck_noPatrolHelisRed] call blck_fnc_getNumberFromRange; + _chancePara = [blck_chanceParaRed] call blck_fnc_getNumberFromRange; + }; + case "green":{ + _noChoppers = [blck_noPatrolHelisGreen] call blck_fnc_getNumberFromRange; + _chancePara = [blck_chanceParaGreen] call blck_fnc_getNumberFromRange; + }; + case "orange":{ + _noChoppers = [blck_noPatrolHelisOrange] call blck_fnc_getNumberFromRange; + _chancePara = [blck_chanceParaOrange] call blck_fnc_getNumberFromRange; + }; + }; + #ifdef blck_debugMode + diag_log format["_missionSpawner(322):: _noChoppers = %1 && _chancePara = %2",_noChoppers,_chancePara]; + #endif + for "_i" from 1 to (_noChoppers) do + { + //params["_coords","_aiSkillsLevel","_weapons","_uniforms","_headgear"]; + + _temp = [_coords,_aiDifficultyLevel,_weaponList,_uniforms,_headGear,_chancePara] call blck_fnc_spawnMissionReinforcements; + + #ifdef blck_debugMode + if (blck_debugLevel >= 2) then + { + diag_log format["missionSpawner(334):: blck_fnc_spawnMissionReinforcements call for chopper # %1 out of a total of %2 choppers",_i, _noChoppers]; + diag_log format["missionSpawner(335):: _temp = %1",_temp]; + }; + #endif + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + _objects pushback (_temp select 0); + _blck_AllMissionAI append (_temp select 1); + }; + if (_abort) then + { + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log "missionSpawner:: (349) grpNul or ERROR in blck_fnc_spawnMissionReinforcements, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1] call blck_fnc_endMission; + }; + }; +}; +////////////////////////// +// 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:: (361) 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["_missionSpawner:: _noEmplacedToSpawn = %1",_vehToSpawn]; +if (blck_useStatic && (_noEmplacedToSpawn > 0)) then +{ + // params["_missionEmplacedWeapons","_noEmplacedWeapons","_aiDifficultyLevel","_coords","_uniforms","_headGear"]; + _temp = [_missionEmplacedWeapons,_noEmplacedToSpawn,_aiDifficultyLevel,_coords,_uniforms,_headGear] call blck_fnc_spawnEmplacedWeaponArray; + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format ["missionSpawner:: (375) blck_fnc_spawnEmplacedWeaponArray returned _temp = %1",_temp]; + }; + #endif + + if (typeName _temp isEqualTo "ARRAY") then + { + _abort = _temp select 2; + }; + + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log format ["missionSpawner:: (387) _abort = %1",_abort]; + + }; + #endif + + if !(_abort) then + { + _objects append (_temp select 0); + _blck_AllMissionAI append (_temp select 1); + + #ifdef blck_debugMode + if (blck_debugLevel > 0) then + { + diag_log format["[blckeagls] missionSpawner:: (400) Static Weapons Spawned: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + }; + #endif + }; +}; +if (_abort) exitWith +{ + #ifdef blck_debugMode + if (blck_debugLevel > 2) then + { + diag_log "missionSpawner:: (410) grpNull ERROR in blck_fnc_spawnEmplacedWeaponArray, mission termination criteria met, calling blck_endMission"; + }; + #endif + + [_mines,_objects,_crates, _blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,1] call blck_fnc_endMission; +}; + +uiSleep _delayTime; +if (count _missionLootBoxes > 0) then +{ + _crates = [_coords,_missionLootBoxes,_loadCratesTiming] call blck_fnc_spawnMissionCrates; +} +else +{ + _crates = [_coords,[[selectRandom blck_crateTypes,[0,0,0],_crateLoot,_lootCounts]], _loadCratesTiming] call blck_fnc_spawnMissionCrates; + +}; + +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 +/* + _name = "label" + _name; + _textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) - (_size select 0), 0]; + _MainMarker = createMarker [_name, _textPos]; +*/ +private _aliveAImarker; +if (blck_showCountOfAliveAI) then +{ + private _text = format["% Alive",{alive _x} count _blck_AllMissionAI]; + _aliveAImarker = createMarker["aiCount" + _markerClass, [(_coords select 0) + (count toArray (_text) * 12), (_coords select 1) + (100), 0]]; + _aliveAImarker setMarkerText _text;; + blck_aiCountMarkers pushBack [_aliveAImarker, _blck_AllMissionAI]; + diag_log format["Alive AI Marker Spawned with Marker of %1 and blck_aiCountMarkers = %2",_aliveAImarker,blck_aiCountMarkers]; +}; +// Trigger for mission end +#ifdef blck_debugMode +diag_log format["[blckeagls] mission Spawner(436) _endCondition = %1",_endCondition]; +#endif +private["_missionComplete","_endIfPlayerNear","_endIfAIKilled"]; +_missionComplete = -1; +_startTime = diag_tickTime; + +switch (_endCondition) do +{ + case "playerNear": {_endIfPlayerNear = true;_endIfAIKilled = false;}; + case "allUnitsKilled": {_endIfPlayerNear = false;_endIfAIKilled = true;}; + case "allKilledOrPlayerNear": {_endIfPlayerNear = true;_endIfAIKilled = true;}; +}; +#ifdef blck_debugMode +diag_log format["missionSpawner :: (449) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; +#endif +private["_locations"]; +_locations = [_coords]; +{ + _locations pushback (getPos _x); + _x setVariable["crateSpawnPos", (getPos _x)]; +} forEach _crates; +#ifdef blck_debugMode +diag_log format["missionSpawner (458):: _coords = %1 | _crates = %2 | _locations = %3",_coords,_crates,_locations]; +#endif +private _crateStolen = false; +#ifdef blck_debugMode +diag_log format["missionSpawner(462):: Waiting for player to satisfy mission end criteria of _endIfPlayerNear %1 with _endIfAIKilled %2",_endIfPlayerNear,_endIfAIKilled]; +#endif +_fn_crateMoved = { + params["_crate"]; + private _result = (_x distance (_x getVariable["crateSpawnPos",[0,0,0]])) > 10; + //diag_log format["_fn_crateMoved:: _result = %1",_result]; + _result; +}; +while {_missionComplete isEqualTo -1} do +{ + //if (blck_debugLevel isEqualTo 3) exitWith {uiSleep 180}; + if ((_endIfPlayerNear) && [_locations,10,true] call blck_fnc_playerInRangeArray) exitWith {}; + if ((_endIfAIKilled) && ({alive _x} count _blck_AllMissionAI) < 1) exitWith {}; + + { + if ({[_x] call _fn_crateMoved} count _crates > 0) exitWith + { + _missionComplete = 1; + _crateStolen = true; + }; + }forEach _crates; + //diag_log format["missionSpawner:: (483) missionCompleteLoop - > players near = %1 and ai alive = %2 and crates stolen = %3",[_coords,20] call blck_fnc_playerInRange, {alive _x} count _blck_AllMissionAI, _crateStolen]; + uiSleep 4; +}; +if (_crateStolen) exitWith +{ + diag_log format["missionSpawner:: (491) 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,_mission,2] call blck_fnc_endMission; +}; +#ifdef blck_debugMode +if (blck_debugLevel > 0) then +{ + diag_log format["[blckeagls] missionSpawner:: (496) Mission completion criteria fulfilled: _cords %1 : _markerClass %2 : _aiDifficultyLevel %3 _markerMissionName %4",_coords,_markerClass,_aiDifficultyLevel,_markerMissionName]; + diag_log format["missionSpawner :: (497) _endIfPlayerNear = %1 _endIfAIKilled= %2",_endIfPlayerNear,_endIfAIKilled]; + diag_log format["[blckeagls] missionSpawner:: (498) 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]; +_result = [_mines,_objects,_crates,_blck_AllMissionAI,_endMsg,_blck_localMissionMarker,_coords,_mission,0] call blck_fnc_endMission; +if (blck_showCountOfAliveAI) then +{ + deleteMarker _aliveAImarker; + blck_aiCountMarkers = blck_aiCountMarkers - [_aliveAImarker, _blck_AllMissionAI]; +}; + +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/Compiles/Vehicles/GMS_fnc_vehicleMonitor - Copy.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor - Copy.sqf new file mode 100644 index 0000000..c966951 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor - Copy.sqf @@ -0,0 +1,203 @@ +/* + Handle the case that all AI assigned to a vehicle are dead. + Allows players to enter and use the vehicle when appropriate + or otherwise destroys the vehicle. + + Logic: + 1) Mission ended; players can keep vehicles BUT not all vehicle AI were killed - > delete vehicle when live AI are killed; + 2) Vehicle has a blck_deleteAT timer set - > delete vehicle; + 3) All AI killed an players may NOT keep vehicles - > detroy vehicle + 4) All AI Killed and players MAY keep vehicles -> release vehicle + 5) vehicle ammo low AND vehicle gunner is alive - > reloaded + + By Ghostrider [GRG] + Copyright 2016 + Last updated 12-22-17 + + -------------------------- + 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_vehicleMonitor: starting function at diag_tickTime = %1",diag_tickTime]; +#ifdef blck_debugMode + //diag_log format["_fnc_vehicleMonitor:: blck_debugMode defined"]; +#endif + +_fn_releaseVehicle = { + params["_veh"]; + //blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + _veh setVehicleLock "UNLOCKED" ; + //_v setVariable["releasedToPlayers",true]; + //[_v] call blck_fnc_emptyObject; + { + _veh removealleventhandlers _x; + } forEach ["GetIn","GetOut","fired","hit","hitpart","reloaded","dammaged","HandleDamage"]; + { + _veh removeAllMPEventHandlers _x; + } forEach ["MPHit","MPKilled"]; + _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]]; + #ifdef blck_debugMode + if (blck_debugLevel > 3) then + { + diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; + }; + #endif +}; + +_fn_destroyVehicleAndCrew = { + 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_fn_deleteAIvehicle; +}; + +_fn_reloadAmmo = { + params["_veh"]; + private ["_crew","_mag","_allMags","_cnt"]; + // https://community.bistudio.com/wiki/fullCrew + // 0 1 2 3 4 + // returns Array - format [[unit,role,cargoIndex,turretPath,personTurret], ...] + //diag_log format["_fnc_vehicleMonitor:: (65) _veh = %1",_veh]; + if ({alive _x and !(isPlayer _x)} count (crew _veh) > 0) then + { + _crew = fullCrew _veh; + //diag_log format["_fnc_vehicleMonitor:: (67) _crew = %1",_crew]; + { + //diag_log format ["_fnc_vehicleMonitor:: (69) _x = %1",_x]; + _mag = _veh currentMagazineTurret (_x select 3); + if (count _mag > 0) then + { + //diag_log format["_fnc_vehicleMonitor:: (71) _mag is typeName %1", typeName _mag]; + //diag_log format ["_fnc_vehicleMonitor:: (71) length _mag = %2 and _mag = %1",_mag,count _mag]; + _allMags = magazinesAmmo _veh; + //diag_log format["_fnc_vehicleMonitor:: (71) _allMags = %1",_allMags]; + _cnt = ( {_mag isEqualTo (_x select 0)}count _allMags); + //diag_log format["_fnc_vehicleMonitor:: (75) _cnt = %1",_cnt]; + if (_cnt < 2) then {_veh addMagazineCargo [_mag,2]}; + }; + } forEach _crew; + }; +}; + +blck_fn_deleteAIvehicle = { + params["_veh"]; + //diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; + { + _veh removeAllEventHandlers _x; + }forEach ["Hit","HitPart","GetIn","GetOut","Fired","FiredNear","HandleDamage","Reloaded"]; + blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + deleteVehicle _veh; +}; + +private _vehList = +blck_monitoredVehicles; + +#ifdef blck_debugMode +if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; +#endif + //blck_fnc_releaseVehicleToPlayers +{ + private _veh = _x; // (purely for clarity at this point, _x could be used just as well) + + #ifdef blck_debugMode + if (blck_debugLevel > 3) then + { + diag_log format["_fnc_vehicleMonitor: vehicle %1 with missionCompleted = %2 being evaluated",_x, _x getVariable"missionCompleted",0]; + }; + #endif + private _evaluate = true; + //diag_log format["_fnc_vehicleMonitor: owner of _veh %1 isEqualTo %2",_veh, owner _veh]; + if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then + { + // Vehicle is NOT local to server or an HC so a player so must have been entered. + _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]; + }; + //diag_log format["_fnc_vehicleMonitor: _veh = %1 getVariable[blck_DeleteAt] = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; + if (_evaluate) then + { + //diag_log format["_fnc_vehicleMonitor: deleting _veh %1 with diag_tickTime %2 and blck_deleteAT %3",_veh,diag_tickTime,_veh getVariable["blck_DeleteAt",0]]; + // Case where vehicle has been marked for deletion after a certain time. + if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; + }; + }; + + // Case where is an emplaced / static wweapon and has no alive crew and such vehicles should be 'killed' or released to players + if (_evaluate) then + { + if ( (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") && {alive _x} count crew _veh isEqualTo 0) then + { + if (blck_killEmptyStaticWeapons) then + { + //diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh]; + + #ifdef blck_debugMode + if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; + #endif + + _veh setDamage 1; + _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; + }else { + [_veh] call _fn_releaseVehicle; + }; + _evaluate = false; + }; + }; + if ( (_veh getVariable["blck_DeleteAt",0]) > 0) then + { + _evaluate = false; + }; + // Case where a vehicle is NOT an emplaced / static weapon and has no alive crew and such vehicles should be 'killed' or released to players + if (_evaluate) then + { + if (_veh getVariable["DBD_vehType","none"] isEqualTo "none" && ({alive _x} count crew _veh isEqualTo 0) ) then + { + 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 _fn_releaseVehicle; + }; + _evaluate = false; + }; + }; + + // Case where a vehicle is part of a mission that has been completed and containes live AI. + if (_evaluate) then + { + if ( _veh getVariable["missionCompleted",0] > 0 && ({alive _x} count crew _veh > 0)) 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]; + private _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]}; + if (diag_tickTime > _veh getVariable["blck_DeleteAt",0]) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; + }; + }; + }; + + if (_evaluate) then + { + [_veh] call _fn_reloadAmmo; + }; +}forEach _vehList; + + + 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 c966951..0d16d20 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor.sqf @@ -1,19 +1,6 @@ /* - Handle the case that all AI assigned to a vehicle are dead. - Allows players to enter and use the vehicle when appropriate - or otherwise destroys the vehicle. - - Logic: - 1) Mission ended; players can keep vehicles BUT not all vehicle AI were killed - > delete vehicle when live AI are killed; - 2) Vehicle has a blck_deleteAT timer set - > delete vehicle; - 3) All AI killed an players may NOT keep vehicles - > detroy vehicle - 4) All AI Killed and players MAY keep vehicles -> release vehicle - 5) vehicle ammo low AND vehicle gunner is alive - > reloaded - By Ghostrider [GRG] Copyright 2016 - Last updated 12-22-17 - -------------------------- License -------------------------- @@ -24,6 +11,7 @@ #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 @@ -44,7 +32,7 @@ _fn_releaseVehicle = { 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]]; #ifdef blck_debugMode - if (blck_debugLevel > 3) then + if (blck_debugLevel > 0) then { diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; }; @@ -55,7 +43,7 @@ _fn_destroyVehicleAndCrew = { params["_veh"]; //private["_crew"]; //_crew = crew _veh; - //diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; + diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; {[_x] call blck_fnc_deleteAI;} forEach (crew _veh); [_veh] call blck_fn_deleteAIvehicle; }; @@ -90,7 +78,7 @@ _fn_reloadAmmo = { blck_fn_deleteAIvehicle = { params["_veh"]; - //diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; + diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; { _veh removeAllEventHandlers _x; }forEach ["Hit","HitPart","GetIn","GetOut","Fired","FiredNear","HandleDamage","Reloaded"]; @@ -101,102 +89,83 @@ blck_fn_deleteAIvehicle = { private _vehList = +blck_monitoredVehicles; #ifdef blck_debugMode -if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; +if (blck_debugLevel > 0) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; #endif //blck_fnc_releaseVehicleToPlayers { + /* + Determine state of vehicle + _isEmplaced + _ownerIsPlayer + _allCrewDead + _deleteNow + */ + //diag_log format["_fnc_vehicleMonitor: evaluating vehicle %1",_x]; private _veh = _x; // (purely for clarity at this point, _x could be used just as well) - - #ifdef blck_debugMode - if (blck_debugLevel > 3) then - { - diag_log format["_fnc_vehicleMonitor: vehicle %1 with missionCompleted = %2 being evaluated",_x, _x getVariable"missionCompleted",0]; - }; - #endif + private _isEmplaced = _veh getVariable["DBD_vehType","none"] isEqualTo "emplaced"; + private _ownerIsPlayer = if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then {true} else {false}; + private _allCrewDead = if (({alive _x} count (crew _veh)) == 0) then {true} else {false}; + private _deletenow = false; + if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then {_deleteNow = true}; + private _missionCompleted = if (_veh getVariable["missionCompleted",0] != 0) then {true} else {false}; private _evaluate = true; - //diag_log format["_fnc_vehicleMonitor: owner of _veh %1 isEqualTo %2",_veh, owner _veh]; - if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then + + if (_ownerIsPlayer) then { - // Vehicle is NOT local to server or an HC so a player so must have been entered. + // 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]; - }; - //diag_log format["_fnc_vehicleMonitor: _veh = %1 getVariable[blck_DeleteAt] = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; - if (_evaluate) then - { - //diag_log format["_fnc_vehicleMonitor: deleting _veh %1 with diag_tickTime %2 and blck_deleteAT %3",_veh,diag_tickTime,_veh getVariable["blck_DeleteAt",0]]; - // Case where vehicle has been marked for deletion after a certain time. - if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then - { - [_veh] call _fn_destroyVehicleAndCrew; - _evaluate = false; - }; + diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh]; }; - // Case where is an emplaced / static wweapon and has no alive crew and such vehicles should be 'killed' or released to players - if (_evaluate) then + if (_allCrewDead && _evaluate) then { - if ( (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") && {alive _x} count crew _veh isEqualTo 0) then + if (_isEmplaced) then { if (blck_killEmptyStaticWeapons) then { - //diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh]; - #ifdef blck_debugMode - if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; + if (blck_debugLevel > 0) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; #endif - _veh setDamage 1; _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; }else { [_veh] call _fn_releaseVehicle; }; - _evaluate = false; - }; - }; - if ( (_veh getVariable["blck_DeleteAt",0]) > 0) then - { - _evaluate = false; - }; - // Case where a vehicle is NOT an emplaced / static weapon and has no alive crew and such vehicles should be 'killed' or released to players - if (_evaluate) then - { - if (_veh getVariable["DBD_vehType","none"] isEqualTo "none" && ({alive _x} count crew _veh isEqualTo 0) ) then - { + _evaluate = false; + } else { 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]; + diag_log format["_fnc_vehicleMonitor:: case of RELEASE where vehicle = %1 and Vehicle is typeOf %2",_veh, typeOf _veh]; [_veh] call _fn_releaseVehicle; }; - _evaluate = false; + _evaluate = false; }; }; - - // Case where a vehicle is part of a mission that has been completed and containes live AI. - if (_evaluate) then + + if (_missionCompleted && !(_allCrewDead)) then { - if ( _veh getVariable["missionCompleted",0] > 0 && ({alive _x} count crew _veh > 0)) 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]; - private _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]}; - if (diag_tickTime > _veh getVariable["blck_DeleteAt",0]) then - { - [_veh] call _fn_destroyVehicleAndCrew; - _evaluate = false; - }; - }; + 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]; + private _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 _fn_reloadAmmo; + }; + + if (_deleteNow) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; }; + }forEach _vehList; diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated new file mode 100644 index 0000000..c966951 --- /dev/null +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated @@ -0,0 +1,203 @@ +/* + Handle the case that all AI assigned to a vehicle are dead. + Allows players to enter and use the vehicle when appropriate + or otherwise destroys the vehicle. + + Logic: + 1) Mission ended; players can keep vehicles BUT not all vehicle AI were killed - > delete vehicle when live AI are killed; + 2) Vehicle has a blck_deleteAT timer set - > delete vehicle; + 3) All AI killed an players may NOT keep vehicles - > detroy vehicle + 4) All AI Killed and players MAY keep vehicles -> release vehicle + 5) vehicle ammo low AND vehicle gunner is alive - > reloaded + + By Ghostrider [GRG] + Copyright 2016 + Last updated 12-22-17 + + -------------------------- + 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_vehicleMonitor: starting function at diag_tickTime = %1",diag_tickTime]; +#ifdef blck_debugMode + //diag_log format["_fnc_vehicleMonitor:: blck_debugMode defined"]; +#endif + +_fn_releaseVehicle = { + params["_veh"]; + //blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + _veh setVehicleLock "UNLOCKED" ; + //_v setVariable["releasedToPlayers",true]; + //[_v] call blck_fnc_emptyObject; + { + _veh removealleventhandlers _x; + } forEach ["GetIn","GetOut","fired","hit","hitpart","reloaded","dammaged","HandleDamage"]; + { + _veh removeAllMPEventHandlers _x; + } forEach ["MPHit","MPKilled"]; + _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]]; + #ifdef blck_debugMode + if (blck_debugLevel > 3) then + { + diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; + }; + #endif +}; + +_fn_destroyVehicleAndCrew = { + 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_fn_deleteAIvehicle; +}; + +_fn_reloadAmmo = { + params["_veh"]; + private ["_crew","_mag","_allMags","_cnt"]; + // https://community.bistudio.com/wiki/fullCrew + // 0 1 2 3 4 + // returns Array - format [[unit,role,cargoIndex,turretPath,personTurret], ...] + //diag_log format["_fnc_vehicleMonitor:: (65) _veh = %1",_veh]; + if ({alive _x and !(isPlayer _x)} count (crew _veh) > 0) then + { + _crew = fullCrew _veh; + //diag_log format["_fnc_vehicleMonitor:: (67) _crew = %1",_crew]; + { + //diag_log format ["_fnc_vehicleMonitor:: (69) _x = %1",_x]; + _mag = _veh currentMagazineTurret (_x select 3); + if (count _mag > 0) then + { + //diag_log format["_fnc_vehicleMonitor:: (71) _mag is typeName %1", typeName _mag]; + //diag_log format ["_fnc_vehicleMonitor:: (71) length _mag = %2 and _mag = %1",_mag,count _mag]; + _allMags = magazinesAmmo _veh; + //diag_log format["_fnc_vehicleMonitor:: (71) _allMags = %1",_allMags]; + _cnt = ( {_mag isEqualTo (_x select 0)}count _allMags); + //diag_log format["_fnc_vehicleMonitor:: (75) _cnt = %1",_cnt]; + if (_cnt < 2) then {_veh addMagazineCargo [_mag,2]}; + }; + } forEach _crew; + }; +}; + +blck_fn_deleteAIvehicle = { + params["_veh"]; + //diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; + { + _veh removeAllEventHandlers _x; + }forEach ["Hit","HitPart","GetIn","GetOut","Fired","FiredNear","HandleDamage","Reloaded"]; + blck_monitoredVehicles = blck_monitoredVehicles - [_veh]; + deleteVehicle _veh; +}; + +private _vehList = +blck_monitoredVehicles; + +#ifdef blck_debugMode +if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; +#endif + //blck_fnc_releaseVehicleToPlayers +{ + private _veh = _x; // (purely for clarity at this point, _x could be used just as well) + + #ifdef blck_debugMode + if (blck_debugLevel > 3) then + { + diag_log format["_fnc_vehicleMonitor: vehicle %1 with missionCompleted = %2 being evaluated",_x, _x getVariable"missionCompleted",0]; + }; + #endif + private _evaluate = true; + //diag_log format["_fnc_vehicleMonitor: owner of _veh %1 isEqualTo %2",_veh, owner _veh]; + if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then + { + // Vehicle is NOT local to server or an HC so a player so must have been entered. + _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]; + }; + //diag_log format["_fnc_vehicleMonitor: _veh = %1 getVariable[blck_DeleteAt] = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; + if (_evaluate) then + { + //diag_log format["_fnc_vehicleMonitor: deleting _veh %1 with diag_tickTime %2 and blck_deleteAT %3",_veh,diag_tickTime,_veh getVariable["blck_DeleteAt",0]]; + // Case where vehicle has been marked for deletion after a certain time. + if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; + }; + }; + + // Case where is an emplaced / static wweapon and has no alive crew and such vehicles should be 'killed' or released to players + if (_evaluate) then + { + if ( (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") && {alive _x} count crew _veh isEqualTo 0) then + { + if (blck_killEmptyStaticWeapons) then + { + //diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh]; + + #ifdef blck_debugMode + if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; + #endif + + _veh setDamage 1; + _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; + }else { + [_veh] call _fn_releaseVehicle; + }; + _evaluate = false; + }; + }; + if ( (_veh getVariable["blck_DeleteAt",0]) > 0) then + { + _evaluate = false; + }; + // Case where a vehicle is NOT an emplaced / static weapon and has no alive crew and such vehicles should be 'killed' or released to players + if (_evaluate) then + { + if (_veh getVariable["DBD_vehType","none"] isEqualTo "none" && ({alive _x} count crew _veh isEqualTo 0) ) then + { + 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 _fn_releaseVehicle; + }; + _evaluate = false; + }; + }; + + // Case where a vehicle is part of a mission that has been completed and containes live AI. + if (_evaluate) then + { + if ( _veh getVariable["missionCompleted",0] > 0 && ({alive _x} count crew _veh > 0)) 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]; + private _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]}; + if (diag_tickTime > _veh getVariable["blck_DeleteAt",0]) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; + }; + }; + }; + + if (_evaluate) then + { + [_veh] call _fn_reloadAmmo; + }; +}forEach _vehList; + + + diff --git a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf index 168fcdd..d9035b6 100644 --- a/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf +++ b/@GMS/addons/custom_server/Compiles/Vehicles/GMS_fnc_vehicleMonitor_updated.sqf @@ -1,19 +1,6 @@ /* - Handle the case that all AI assigned to a vehicle are dead. - Allows players to enter and use the vehicle when appropriate - or otherwise destroys the vehicle. - - Logic: - 1) Mission ended; players can keep vehicles BUT not all vehicle AI were killed - > delete vehicle when live AI are killed; - 2) Vehicle has a blck_deleteAT timer set - > delete vehicle; - 3) All AI killed an players may NOT keep vehicles - > detroy vehicle - 4) All AI Killed and players MAY keep vehicles -> release vehicle - 5) vehicle ammo low AND vehicle gunner is alive - > reloaded - By Ghostrider [GRG] Copyright 2016 - Last updated 12-22-17 - -------------------------- License -------------------------- @@ -23,7 +10,10 @@ */ #include "\q\addons\custom_server\Configs\blck_defines.hpp"; -//diag_log format["_fnc_vehicleMonitor: starting function at diag_tickTime = %1",diag_tickTime]; +diag_log format["_fnc_vehicleMonitor: starting function at diag_tickTime = %1",diag_tickTime]; + +if (true) exitWith {}; + #ifdef blck_debugMode //diag_log format["_fnc_vehicleMonitor:: blck_debugMode defined"]; #endif @@ -44,7 +34,7 @@ _fn_releaseVehicle = { 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]]; #ifdef blck_debugMode - if (blck_debugLevel > 3) then + if (blck_debugLevel > 0) then { diag_log format["_fnc_vehicleMonitor:: case of patrol vehicle released to players where vehicle = %1",_veh]; }; @@ -55,7 +45,7 @@ _fn_destroyVehicleAndCrew = { params["_veh"]; //private["_crew"]; //_crew = crew _veh; - //diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; + diag_log format["_fn_destroyVehicleAndCrew: called for _veh = %1",_veh]; {[_x] call blck_fnc_deleteAI;} forEach (crew _veh); [_veh] call blck_fn_deleteAIvehicle; }; @@ -90,7 +80,7 @@ _fn_reloadAmmo = { blck_fn_deleteAIvehicle = { params["_veh"]; - //diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; + diag_log format["blck_fn_deleteAIvehicle: _veh %1 deleted",_veh]; { _veh removeAllEventHandlers _x; }forEach ["Hit","HitPart","GetIn","GetOut","Fired","FiredNear","HandleDamage","Reloaded"]; @@ -101,7 +91,7 @@ blck_fn_deleteAIvehicle = { private _vehList = +blck_monitoredVehicles; #ifdef blck_debugMode -if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; +if (blck_debugLevel > 0) then {diag_log format["_fnc_vehicleMonitor:: function called at %1 with _vehList %2 and blck_monitoredVehicles %3",diag_tickTime,_vehList,blck_monitoredVehicles];}; #endif //blck_fnc_releaseVehicleToPlayers { @@ -118,95 +108,63 @@ if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: function c private _ownerIsPlayer = if (owner _veh > 2 && !(owner _veh in blck_connectedHCs)) then {true} else {false}; private _allCrewDead = {alive _x} count (crew _veh); private _deletenow = if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then {true} else {false}; - #ifdef blck_debugMode - if (blck_debugLevel > 3) then - { - diag_log format["_fnc_vehicleMonitor: vehicle %1 with missionCompleted = %2 being evaluated",_x, _x getVariable"missionCompleted",0]; - }; - #endif + private _missionCompleted = _veh getVariable["missionCompleted",0]; private _evaluate = true; - //diag_log format["_fnc_vehicleMonitor: owner of _veh %1 isEqualTo %2",_veh, owner _veh]; + if (_ownerIsPlayer) then { - // Vehicle is NOT local to server or an HC so a player so must have been entered. + // 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]; - }; - //diag_log format["_fnc_vehicleMonitor: _veh = %1 getVariable[blck_DeleteAt] = %2",_veh, _veh getVariable["blck_DeleteAt",0]]; - if (_evaluate) then - { - //diag_log format["_fnc_vehicleMonitor: deleting _veh %1 with diag_tickTime %2 and blck_deleteAT %3",_veh,diag_tickTime,_veh getVariable["blck_DeleteAt",0]]; - // Case where vehicle has been marked for deletion after a certain time. - if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then - { - [_veh] call _fn_destroyVehicleAndCrew; - _evaluate = false; - }; + diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh]; }; - // Case where is an emplaced / static wweapon and has no alive crew and such vehicles should be 'killed' or released to players - if (_evaluate) then + if (_allCrewDead && _evaluate) then { - if ( (_veh getVariable["DBD_vehType","none"] isEqualTo "emplaced") && {alive _x} count crew _veh isEqualTo 0) then + if (_isEmplaced) then { if (blck_killEmptyStaticWeapons) then { - //diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh]; - #ifdef blck_debugMode - if (blck_debugLevel > 3) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; + if (blck_debugLevel > 0) then {diag_log format["_fnc_vehicleMonitor:: case of destroyed where vehicle = %1",_veh];}; #endif - _veh setDamage 1; _veh setVariable["blck_DeleteAt",diag_tickTime + 60]; }else { [_veh] call _fn_releaseVehicle; }; - _evaluate = false; - }; - }; - if ( (_veh getVariable["blck_DeleteAt",0]) > 0) then - { - _evaluate = false; - }; - // Case where a vehicle is NOT an emplaced / static weapon and has no alive crew and such vehicles should be 'killed' or released to players - if (_evaluate) then - { - if (_veh getVariable["DBD_vehType","none"] isEqualTo "none" && ({alive _x} count crew _veh isEqualTo 0) ) then - { + _evaluate = false; + } else { 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]; + diag_log format["_fnc_vehicleMonitor:: case of RELEASE where vehicle = %1 and Vehicle is typeOf %2",_veh, typeOf _veh]; [_veh] call _fn_releaseVehicle; }; - _evaluate = false; + _evaluate = false; }; }; - - // Case where a vehicle is part of a mission that has been completed and containes live AI. - if (_evaluate) then + + if (_missionCompleted && !(_allCrewDead)) then { - if ( _veh getVariable["missionCompleted",0] > 0 && ({alive _x} count crew _veh > 0)) 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]; - private _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]}; - if (diag_tickTime > _veh getVariable["blck_DeleteAt",0]) then - { - [_veh] call _fn_destroyVehicleAndCrew; - _evaluate = false; - }; - }; + 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]; + private _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 _fn_reloadAmmo; + }; + + if (_deleteNow) then + { + [_veh] call _fn_destroyVehicleAndCrew; + _evaluate = false; }; }forEach _vehList; diff --git a/@GMS/addons/custom_server/Compiles/blck_variables.sqf b/@GMS/addons/custom_server/Compiles/blck_variables.sqf index bc43e9a..58cbf3b 100644 --- a/@GMS/addons/custom_server/Compiles/blck_variables.sqf +++ b/@GMS/addons/custom_server/Compiles/blck_variables.sqf @@ -12,8 +12,8 @@ */ #include"\q\addons\custom_server\Configs\blck_defines.hpp"; -blck_debugON = true; -blck_debugLevel = 1; // Sets level of detail for debugging info - WIP. +blck_debugON = false; +blck_debugLevel = 0; // Sets level of detail for debugging info - WIP. blck_minFPS = 8; //////////////////////////////////////////////// diff --git a/MPMissions/Exile.Altis/debug/blckconfigs.sqf b/MPMissions/Exile.Altis/debug/blckconfigs.sqf deleted file mode 100644 index 1b1ce57..0000000 --- a/MPMissions/Exile.Altis/debug/blckconfigs.sqf +++ /dev/null @@ -1,20 +0,0 @@ -//////////////////////////////////////////// -// Define configurations for the client-side of the mission system -// Last Updated 11/20/16 -// by Ghostrider-DbD- -////////////////////////////////////////// - -//diag_log "[blckeagls] initializing client variables"; -blck_MarkerPeristTime = 300; -blck_useHint = true; -blck_useSystemChat = false; -blck_useTitleText = false; -blck_useDynamic = false; -blck_useToast = false; // Exile only -blck_aiKilluseSystemChat = true; -blck_aiKilluseDynamic = false; -blck_aiKilluseTitleText = false; -blck_processingMsg = -1; -blck_processingKill = -1; - - diff --git a/MPMissions/Exile.Altis/debug/build.sqf b/MPMissions/Exile.Altis/debug/build.sqf deleted file mode 100644 index b3b85e8..0000000 --- a/MPMissions/Exile.Altis/debug/build.sqf +++ /dev/null @@ -1,3 +0,0 @@ -private ["_version","_versionDate"]; -_blck_version = "6.72 Build 78"; -_blck_versionDate = "10-01-17 4:00 PM"; diff --git a/MPMissions/Exile.Altis/debug/deleteMarker.sqf b/MPMissions/Exile.Altis/debug/deleteMarker.sqf deleted file mode 100644 index 5ad507c..0000000 --- a/MPMissions/Exile.Altis/debug/deleteMarker.sqf +++ /dev/null @@ -1,14 +0,0 @@ -//////////////////////////////////////////// -// Delete and change Mission Markers -// 7/10/15 -// by Ghostrider-DbD- -////////////////////////////////////////// -// delete a marker - -//diag_log format["blck_fnc_deleteMarker:: _this = %1",_this]; -private["_markerName"]; -_markerName = _this select 0; -deleteMarker _markerName; -_markerName = "label" + _markerName; -deleteMarker _markerName; -//diag_log format["deleteMarker complete script for _this = %1",_this]; diff --git a/MPMissions/Exile.Altis/debug/missionCompleteMarker.sqf b/MPMissions/Exile.Altis/debug/missionCompleteMarker.sqf deleted file mode 100644 index ea8eee7..0000000 --- a/MPMissions/Exile.Altis/debug/missionCompleteMarker.sqf +++ /dev/null @@ -1,19 +0,0 @@ -//////////////////////////////////////////// -// Create, delete and change Mission Markers -// 7/10/15 -// by Ghostrider-DbD- -////////////////////////////////////////// -// spawn a temporary marker to indicate the position of a 'completed' mission -// this will not show to JIP players - -private["_location","_MainMarker","_name"]; -//diag_log format["blck_fnc_missionCompleteMarker:: _this = %1",_this]; -_location = _this select 0; -_name = str(random(1000000)) + "MarkerCleared"; -_MainMarker = createMarker [_name, _location]; -_MainMarker setMarkerColor "ColorBlack"; -_MainMarker setMarkerType "n_hq"; -_MainMarker setMarkerText "Mission Cleared"; -uiSleep 300; -deleteMarker _MainMarker; -//diag_log format["missionCompleteMarker complete script for _this = %1",_this]; diff --git a/MPMissions/Exile.Altis/debug/spawnMarker.sqf b/MPMissions/Exile.Altis/debug/spawnMarker.sqf deleted file mode 100644 index 32ad44a..0000000 --- a/MPMissions/Exile.Altis/debug/spawnMarker.sqf +++ /dev/null @@ -1,99 +0,0 @@ -//////////////////////////////////////////// -// Create Mission Markers that are visible to JIP players -// 10/14/16 -// by Ghostrider-DbD- -////////////////////////////////////////// -// spawn a round marker of a size and color specified in passed parameters - -private["_blck_fn_configureRoundMarker"]; - -private["_blck_fn_configureRoundMarker"]; -_blck_fn_configureRoundMarker = { - private["_name","_pos","_color","_size","_MainMarker","_labelType"]; - //diag_log format["_blck_fn_configureRoundMarker: -: _this = %1", _this]; - params["_name","_pos","_color","_text","_size","_labelType"]; - /* - _name = _this select 0; - _pos = _this select 1; - _color = _this select 2; - _text = _this select 3; - _size = _this select 4; - _labelType = _this select 5; - //_shape = _this select 6; - //_brush = _this select 7; - */ - //diag_log format["_blck_fn_configureRoundMarker: _pos = %1, _color = %2, _size = %3, _name = %4, label %5",_pos, _color, _size, _name, _text]; - // Do not show the marker if it is in the left upper corner - if ((_pos distance [0,0,0]) < 10) exitWith {}; - - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerColor _color; - _MainMarker setMarkerShape "ELLIPSE"; - _MainMarker setMarkerBrush "Grid"; - _MainMarker setMarkerSize _size; // - //diag_log format["_blck_fn_configureRoundMarker: -: _labelType = %1", _labelType]; - if (count toArray(_text) > 0) then - { - switch (_labelType) do { - case "arrow": - { - //diag_log "++++++++++++++--- marker label arrow detected"; - _name = "label" + _name; - _textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) - (_size select 0), 0]; - _MainMarker = createMarker [_name, _textPos]; - _MainMarker setMarkerShape "Icon"; - _MainMarker setMarkerType "HD_Arrow"; - _MainMarker setMarkerColor "ColorBlack"; - _MainMarker setMarkerText _text; - //_MainMarker setMarkerDir 37; - }; - case "center": - { - //diag_log "++++++++++++++--- marker label dot detected"; - _name = "label" + _name; - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerShape "Icon"; - _MainMarker setMarkerType "mil_dot"; - _MainMarker setMarkerColor "ColorBlack"; - _MainMarker setMarkerText _text; - }; - }; - }; -}; - -_blck_fn_configureIconMarker = { - private["_MainMarker"]; - params["_name","_pos",["_color","ColorBlack"],["_text",""],["_icon","mil_triangle"]]; - //diag_log format["_blck_fn_configureIconMarker: _name=%1; _pos=%2; _color=%3; _text=%4",_name,_pos,_color,_text]; - - _name = "label" + _name; - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerShape "Icon"; - _MainMarker setMarkerType _icon; - _MainMarker setMarkerColor _color; - _MainMarker setMarkerText _text; -}; - -//diag_log format["spawnMarker:: -- >> _this = %1",_this]; -// _this = [[""BlueMarker"",[12524.1,18204.7,0],""Bandit Patrol"",""center"",""ColorBlue"",[""ELIPSE"",[175,175]]],""ColorBlue"",""BlueMarker""]" -params["_mArray"]; - -_mArray params["_missionType","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerType"]; -_markerType params["_mShape","_mSize","_mBrush"]; -//diag_log format["spawnMarker.sqf:: -- >> _missionType %1 | _markerPos %2 | _markerLabel %3 | _markerLabelType %4 | _markerColor %5 | _markerType %6",_missionType,_markerPos,_markerLabel,_markerLabelType,_markerColor,_markerType]; - -if ((_markerType select 0) in ["ELIPSE","RECTANGLE"]) then // not an Icon .... -{ - switch (_missionType) do { - // params["_missionType","_pos","_text","_labelType","_color","_type","_size","_brush"]; - // Type Size Brush - default {[_missionType,_markerPos,_markerColor,_markerLabel, _mSize,_markerLabelType,_mShape,_mBrush] call _blck_fn_configureRoundMarker;}; - }; -}; -if !((_markerType select 0) in ["ELIPSE","RECTANGLE"]) then -{ // Deal with case of an icon - // params["_name","_pos",["_color","ColorBlack"],["_text",""],["_icon","mil_triangle"]]; - [_missionType,_markerPos, _markerColor,_markerLabel,_markerType select 0] call _blck_fn_configureIconMarker; -}; -//diag_log format["spawnMarker complete script for _this = %1",_this]; - diff --git a/MPMissions/Exile.Altis/debug/versionCheck.sqf b/MPMissions/Exile.Altis/debug/versionCheck.sqf deleted file mode 100644 index 9ef231a..0000000 --- a/MPMissions/Exile.Altis/debug/versionCheck.sqf +++ /dev/null @@ -1,187 +0,0 @@ -//////////////////////////////////////////// -// Start Server-side functions and Create, Display Mission Messages for blckeagls mission system for Arma 3 Epoch -// Last Updated 1/11/17 -// by Ghostrider-DbD- -////////////////////////////////////////// -blck_fnc_spawnMarker = compileFinal preprocessfilelinenumbers "debug\spawnMarker.sqf"; -blck_fnc_deleteMarker = compileFinal preprocessfilelinenumbers "debug\deleteMarker.sqf"; -blck_fnc_missionCompleteMarker = compileFinal preprocessfilelinenumbers "debug\missionCompleteMarker.sqf"; -if !(isServer) then -{ - //diag_log "[blckeagls] initializing client variables"; - blck_MarkerPeristTime = 300; - blck_useHint = false; - blck_useSystemChat = true; - blck_useTitleText = false; - blck_useDynamic = true; - blck_useToast = false; // Exile only - blck_aiKilluseSystemChat = true; - blck_aiKilluseDynamic = false; - blck_aiKilluseTitleText = false; - blck_processingMsg = -1; - blck_processingKill = -1; - blck_message = ""; - - fn_killScoreNotification = { - params["_bonus","_distanceBonus","_killStreak"]; - //diag_log format["fn_killScoreNotification:: -- >> _bonus = %1 | _distanceBonus = %2 | _killStreak = %3",_bonus,_distanceBonus,_killStreak]; - _msg2 = format["AI Killed
"]; - if (typeName _bonus isEqualTo "SCALAR") then // add message for the bonus - { - if (_bonus > 0) then - { - _msg2 = _msg2 + format["Bonus +%1
",_bonus]; - }; - }; - if (typeName _distanceBonus isEqualTo "SCALAR") then // Add message for distance bonus - { - if (_distanceBonus > 0) then - { - _msg2 = _msg2 + format["Dist Bonus +%1
",_distanceBonus]; - }; - }; - if (typeName _killStreak isEqualTo "SCALAR") then - { - if (_killStreak > 0) then - { - _msg2 = _msg2 + format["Killstreak %1X
",_killStreak]; - }; - }; - [parseText _msg2,[0.0823437 * safezoneW + safezoneX,0.379 * safezoneH + safezoneY,0.0812109 * safezoneW,0.253 * safezoneH], nil, 7, 0.3, 0] spawn BIS_fnc_textTiles; - }; - - fn_dynamicNotification = { - private["_text","_screentime","_xcoord","_ycoord"]; - params["_mission","_message"]; - - waitUntil {blck_processingMsg < 0}; - blck_processingMsg = 1; - _screentime = 7; - _text = format[ - "%1

- %2
", - _mission,_message - ]; - _ycoord = [safezoneY + safezoneH - 0.8,0.7]; - _xcoord = [safezoneX + safezoneW - 0.5,0.35]; - [_text,_xcoord,_ycoord,_screentime,0.5] spawn BIS_fnc_dynamicText; - uiSleep 3; // 3 second delay before the next message - blck_processingMsg = -1; - }; - - //diag_log "[blckeagls] initializing client functions"; - fn_missionNotification = { - params["_event","_message","_mission"]; - - if (blck_useSystemChat) then {systemChat format["%1",_message];}; - if (blck_useHint) then { - hint parseText format[ - "%1
- ______________

- %2
- ______________

- Any loot you find is yours as payment for eliminating the threat!",_mission,_message - ]; - }; - if (blck_useDynamic) then { - [_mission,_message] call fn_dynamicNotification; - }; - if (blck_useTitleText) then { - [_message] spawn { - params["_msg"]; - titleText [_msg, "PLAIN DOWN",5];uiSleep 5; titleText ["", "PLAIN DOWN",5] - }; - }; - if (blck_useToast) then - { - ["InfoTitleAndText", [_mission, _message]] call ExileClient_gui_toaster_addTemplateToast; - }; - //diag_log format["_fn_missionNotification ====] Paremeters _event %1 _message %2 _mission %3",_event,_message,_mission]; - }; - - fn_AI_KilledNotification = { - private["_message","_text","_screentime","_xcoord","_ycoord"]; - _message = _this select 0; - //diag_log format["_fn_AI_KilledNotification ====] Paremeters _event %1 _message %2 _mission %3",_message]; - if (blck_aiKilluseSystemChat) then {systemChat format["%1",_message];}; - if (blck_aiKilluseTitleText) then {titleText [_message, "PLAIN DOWN",5];uiSleep 5; titleText ["", "PLAIN DOWN",5]}; - if (blck_aiKilluseDynamic) then { - //diag_log format["blckClient.sqf:: dynamic messaging called for mission %2 with message of %1",_message]; - waitUntil{blck_processingKill < 0}; - blck_processingKill = 1; - _text = format["%1",_message]; - _xcoord = [safezoneX,0.8]; - _ycoord = [safezoneY + safezoneH - 0.5,0.2]; - _screentime = 5; - [" "+ _text,_xcoord,_ycoord,_screentime] spawn BIS_fnc_dynamicText; - uiSleep 3; - blck_processingKill = -1; - }; - }; - - fn_handleMessage = { - //private["_event","_msg","_mission"]; - //diag_log format["blck_Message ====] Paremeters = _this = %1",_this]; - params["_event","_message",["_mission",""]]; - - //diag_log format["blck_Message ====] Paremeters _event %1 _message %2 paramter #3 %3",_event,_message,_mission]; - //diag_log format["blck_Message ====] _message isEqualTo %1",_message]; - - switch (_event) do - { - case "start": - { - playSound "UAV_05"; - //diag_log "switch start"; - //_mission = _this select 1 select 2; - [_event,_message,_mission] spawn fn_missionNotification; - }; - case "end": - { - playSound "UAV_03"; - //diag_log "switch end"; - //_mission = _this select 1 select 2; - [_event,_message,_mission] spawn fn_missionNotification; - }; - case "aikilled": - { - //diag_log "switch aikilled"; - [_message] spawn fn_AI_KilledNotification; - }; - case "DLS": - { - if ( (player distance _mission) < 1000) then {playsound "AddItemOK"; hint _message;systemChat _message}; - }; - case "reinforcements": - { - if ( (player distance _mission) < 1000) then {playsound "AddItemOK"; ["Alert",_message] call fn_dynamicNotification;}; - //diag_log "---->>>> Reinforcements Spotted"; - }; - case "IED": - { - [1] call BIS_fnc_Earthquake; - //["IED","Bandits targeted your vehicle with an IED"] call fn_dynamicNotification; - ["Bandits targeted your vehicle with an IED.", 5] call Epoch_message; - for "_i" from 1 to 3 do {playSound "BattlefieldExplosions3_3D";uiSleep 0.3;}; - }; - case "showScore": - { - [_message select 0, _message select 1, _message select 2] call fn_killScoreNotification; - }; - }; - - }; - - diag_log "blck client loaded ver 1/11/17 2.0 8 PM"; - diag_log "[blckeagls] starting client loop"; - - while {true} do - { - waitUntil {!(blck_message isEqualTo "")}; - //diag_log format["[blckClient] blck_Message = %1", blck_message]; - private["_message"]; - _message = blck_message; - _message spawn fn_handleMessage; - blck_Message = ""; - }; -}; \ No newline at end of file diff --git a/MPMissions/epoch.Altis/debug/blckconfigs.sqf b/MPMissions/epoch.Altis/debug/blckconfigs.sqf deleted file mode 100644 index 1b1ce57..0000000 --- a/MPMissions/epoch.Altis/debug/blckconfigs.sqf +++ /dev/null @@ -1,20 +0,0 @@ -//////////////////////////////////////////// -// Define configurations for the client-side of the mission system -// Last Updated 11/20/16 -// by Ghostrider-DbD- -////////////////////////////////////////// - -//diag_log "[blckeagls] initializing client variables"; -blck_MarkerPeristTime = 300; -blck_useHint = true; -blck_useSystemChat = false; -blck_useTitleText = false; -blck_useDynamic = false; -blck_useToast = false; // Exile only -blck_aiKilluseSystemChat = true; -blck_aiKilluseDynamic = false; -blck_aiKilluseTitleText = false; -blck_processingMsg = -1; -blck_processingKill = -1; - - diff --git a/MPMissions/epoch.Altis/debug/build.sqf b/MPMissions/epoch.Altis/debug/build.sqf deleted file mode 100644 index b3b85e8..0000000 --- a/MPMissions/epoch.Altis/debug/build.sqf +++ /dev/null @@ -1,3 +0,0 @@ -private ["_version","_versionDate"]; -_blck_version = "6.72 Build 78"; -_blck_versionDate = "10-01-17 4:00 PM"; diff --git a/MPMissions/epoch.Altis/debug/deleteMarker.sqf b/MPMissions/epoch.Altis/debug/deleteMarker.sqf deleted file mode 100644 index 5ad507c..0000000 --- a/MPMissions/epoch.Altis/debug/deleteMarker.sqf +++ /dev/null @@ -1,14 +0,0 @@ -//////////////////////////////////////////// -// Delete and change Mission Markers -// 7/10/15 -// by Ghostrider-DbD- -////////////////////////////////////////// -// delete a marker - -//diag_log format["blck_fnc_deleteMarker:: _this = %1",_this]; -private["_markerName"]; -_markerName = _this select 0; -deleteMarker _markerName; -_markerName = "label" + _markerName; -deleteMarker _markerName; -//diag_log format["deleteMarker complete script for _this = %1",_this]; diff --git a/MPMissions/epoch.Altis/debug/missionCompleteMarker.sqf b/MPMissions/epoch.Altis/debug/missionCompleteMarker.sqf deleted file mode 100644 index ea8eee7..0000000 --- a/MPMissions/epoch.Altis/debug/missionCompleteMarker.sqf +++ /dev/null @@ -1,19 +0,0 @@ -//////////////////////////////////////////// -// Create, delete and change Mission Markers -// 7/10/15 -// by Ghostrider-DbD- -////////////////////////////////////////// -// spawn a temporary marker to indicate the position of a 'completed' mission -// this will not show to JIP players - -private["_location","_MainMarker","_name"]; -//diag_log format["blck_fnc_missionCompleteMarker:: _this = %1",_this]; -_location = _this select 0; -_name = str(random(1000000)) + "MarkerCleared"; -_MainMarker = createMarker [_name, _location]; -_MainMarker setMarkerColor "ColorBlack"; -_MainMarker setMarkerType "n_hq"; -_MainMarker setMarkerText "Mission Cleared"; -uiSleep 300; -deleteMarker _MainMarker; -//diag_log format["missionCompleteMarker complete script for _this = %1",_this]; diff --git a/MPMissions/epoch.Altis/debug/spawnMarker.sqf b/MPMissions/epoch.Altis/debug/spawnMarker.sqf deleted file mode 100644 index 32ad44a..0000000 --- a/MPMissions/epoch.Altis/debug/spawnMarker.sqf +++ /dev/null @@ -1,99 +0,0 @@ -//////////////////////////////////////////// -// Create Mission Markers that are visible to JIP players -// 10/14/16 -// by Ghostrider-DbD- -////////////////////////////////////////// -// spawn a round marker of a size and color specified in passed parameters - -private["_blck_fn_configureRoundMarker"]; - -private["_blck_fn_configureRoundMarker"]; -_blck_fn_configureRoundMarker = { - private["_name","_pos","_color","_size","_MainMarker","_labelType"]; - //diag_log format["_blck_fn_configureRoundMarker: -: _this = %1", _this]; - params["_name","_pos","_color","_text","_size","_labelType"]; - /* - _name = _this select 0; - _pos = _this select 1; - _color = _this select 2; - _text = _this select 3; - _size = _this select 4; - _labelType = _this select 5; - //_shape = _this select 6; - //_brush = _this select 7; - */ - //diag_log format["_blck_fn_configureRoundMarker: _pos = %1, _color = %2, _size = %3, _name = %4, label %5",_pos, _color, _size, _name, _text]; - // Do not show the marker if it is in the left upper corner - if ((_pos distance [0,0,0]) < 10) exitWith {}; - - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerColor _color; - _MainMarker setMarkerShape "ELLIPSE"; - _MainMarker setMarkerBrush "Grid"; - _MainMarker setMarkerSize _size; // - //diag_log format["_blck_fn_configureRoundMarker: -: _labelType = %1", _labelType]; - if (count toArray(_text) > 0) then - { - switch (_labelType) do { - case "arrow": - { - //diag_log "++++++++++++++--- marker label arrow detected"; - _name = "label" + _name; - _textPos = [(_pos select 0) + (count toArray (_text) * 12), (_pos select 1) - (_size select 0), 0]; - _MainMarker = createMarker [_name, _textPos]; - _MainMarker setMarkerShape "Icon"; - _MainMarker setMarkerType "HD_Arrow"; - _MainMarker setMarkerColor "ColorBlack"; - _MainMarker setMarkerText _text; - //_MainMarker setMarkerDir 37; - }; - case "center": - { - //diag_log "++++++++++++++--- marker label dot detected"; - _name = "label" + _name; - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerShape "Icon"; - _MainMarker setMarkerType "mil_dot"; - _MainMarker setMarkerColor "ColorBlack"; - _MainMarker setMarkerText _text; - }; - }; - }; -}; - -_blck_fn_configureIconMarker = { - private["_MainMarker"]; - params["_name","_pos",["_color","ColorBlack"],["_text",""],["_icon","mil_triangle"]]; - //diag_log format["_blck_fn_configureIconMarker: _name=%1; _pos=%2; _color=%3; _text=%4",_name,_pos,_color,_text]; - - _name = "label" + _name; - _MainMarker = createMarker [_name, _pos]; - _MainMarker setMarkerShape "Icon"; - _MainMarker setMarkerType _icon; - _MainMarker setMarkerColor _color; - _MainMarker setMarkerText _text; -}; - -//diag_log format["spawnMarker:: -- >> _this = %1",_this]; -// _this = [[""BlueMarker"",[12524.1,18204.7,0],""Bandit Patrol"",""center"",""ColorBlue"",[""ELIPSE"",[175,175]]],""ColorBlue"",""BlueMarker""]" -params["_mArray"]; - -_mArray params["_missionType","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerType"]; -_markerType params["_mShape","_mSize","_mBrush"]; -//diag_log format["spawnMarker.sqf:: -- >> _missionType %1 | _markerPos %2 | _markerLabel %3 | _markerLabelType %4 | _markerColor %5 | _markerType %6",_missionType,_markerPos,_markerLabel,_markerLabelType,_markerColor,_markerType]; - -if ((_markerType select 0) in ["ELIPSE","RECTANGLE"]) then // not an Icon .... -{ - switch (_missionType) do { - // params["_missionType","_pos","_text","_labelType","_color","_type","_size","_brush"]; - // Type Size Brush - default {[_missionType,_markerPos,_markerColor,_markerLabel, _mSize,_markerLabelType,_mShape,_mBrush] call _blck_fn_configureRoundMarker;}; - }; -}; -if !((_markerType select 0) in ["ELIPSE","RECTANGLE"]) then -{ // Deal with case of an icon - // params["_name","_pos",["_color","ColorBlack"],["_text",""],["_icon","mil_triangle"]]; - [_missionType,_markerPos, _markerColor,_markerLabel,_markerType select 0] call _blck_fn_configureIconMarker; -}; -//diag_log format["spawnMarker complete script for _this = %1",_this]; - diff --git a/MPMissions/epoch.Altis/debug/versionCheck.sqf b/MPMissions/epoch.Altis/debug/versionCheck.sqf deleted file mode 100644 index 9ef231a..0000000 --- a/MPMissions/epoch.Altis/debug/versionCheck.sqf +++ /dev/null @@ -1,187 +0,0 @@ -//////////////////////////////////////////// -// Start Server-side functions and Create, Display Mission Messages for blckeagls mission system for Arma 3 Epoch -// Last Updated 1/11/17 -// by Ghostrider-DbD- -////////////////////////////////////////// -blck_fnc_spawnMarker = compileFinal preprocessfilelinenumbers "debug\spawnMarker.sqf"; -blck_fnc_deleteMarker = compileFinal preprocessfilelinenumbers "debug\deleteMarker.sqf"; -blck_fnc_missionCompleteMarker = compileFinal preprocessfilelinenumbers "debug\missionCompleteMarker.sqf"; -if !(isServer) then -{ - //diag_log "[blckeagls] initializing client variables"; - blck_MarkerPeristTime = 300; - blck_useHint = false; - blck_useSystemChat = true; - blck_useTitleText = false; - blck_useDynamic = true; - blck_useToast = false; // Exile only - blck_aiKilluseSystemChat = true; - blck_aiKilluseDynamic = false; - blck_aiKilluseTitleText = false; - blck_processingMsg = -1; - blck_processingKill = -1; - blck_message = ""; - - fn_killScoreNotification = { - params["_bonus","_distanceBonus","_killStreak"]; - //diag_log format["fn_killScoreNotification:: -- >> _bonus = %1 | _distanceBonus = %2 | _killStreak = %3",_bonus,_distanceBonus,_killStreak]; - _msg2 = format["AI Killed
"]; - if (typeName _bonus isEqualTo "SCALAR") then // add message for the bonus - { - if (_bonus > 0) then - { - _msg2 = _msg2 + format["Bonus +%1
",_bonus]; - }; - }; - if (typeName _distanceBonus isEqualTo "SCALAR") then // Add message for distance bonus - { - if (_distanceBonus > 0) then - { - _msg2 = _msg2 + format["Dist Bonus +%1
",_distanceBonus]; - }; - }; - if (typeName _killStreak isEqualTo "SCALAR") then - { - if (_killStreak > 0) then - { - _msg2 = _msg2 + format["Killstreak %1X
",_killStreak]; - }; - }; - [parseText _msg2,[0.0823437 * safezoneW + safezoneX,0.379 * safezoneH + safezoneY,0.0812109 * safezoneW,0.253 * safezoneH], nil, 7, 0.3, 0] spawn BIS_fnc_textTiles; - }; - - fn_dynamicNotification = { - private["_text","_screentime","_xcoord","_ycoord"]; - params["_mission","_message"]; - - waitUntil {blck_processingMsg < 0}; - blck_processingMsg = 1; - _screentime = 7; - _text = format[ - "%1

- %2
", - _mission,_message - ]; - _ycoord = [safezoneY + safezoneH - 0.8,0.7]; - _xcoord = [safezoneX + safezoneW - 0.5,0.35]; - [_text,_xcoord,_ycoord,_screentime,0.5] spawn BIS_fnc_dynamicText; - uiSleep 3; // 3 second delay before the next message - blck_processingMsg = -1; - }; - - //diag_log "[blckeagls] initializing client functions"; - fn_missionNotification = { - params["_event","_message","_mission"]; - - if (blck_useSystemChat) then {systemChat format["%1",_message];}; - if (blck_useHint) then { - hint parseText format[ - "%1
- ______________

- %2
- ______________

- Any loot you find is yours as payment for eliminating the threat!",_mission,_message - ]; - }; - if (blck_useDynamic) then { - [_mission,_message] call fn_dynamicNotification; - }; - if (blck_useTitleText) then { - [_message] spawn { - params["_msg"]; - titleText [_msg, "PLAIN DOWN",5];uiSleep 5; titleText ["", "PLAIN DOWN",5] - }; - }; - if (blck_useToast) then - { - ["InfoTitleAndText", [_mission, _message]] call ExileClient_gui_toaster_addTemplateToast; - }; - //diag_log format["_fn_missionNotification ====] Paremeters _event %1 _message %2 _mission %3",_event,_message,_mission]; - }; - - fn_AI_KilledNotification = { - private["_message","_text","_screentime","_xcoord","_ycoord"]; - _message = _this select 0; - //diag_log format["_fn_AI_KilledNotification ====] Paremeters _event %1 _message %2 _mission %3",_message]; - if (blck_aiKilluseSystemChat) then {systemChat format["%1",_message];}; - if (blck_aiKilluseTitleText) then {titleText [_message, "PLAIN DOWN",5];uiSleep 5; titleText ["", "PLAIN DOWN",5]}; - if (blck_aiKilluseDynamic) then { - //diag_log format["blckClient.sqf:: dynamic messaging called for mission %2 with message of %1",_message]; - waitUntil{blck_processingKill < 0}; - blck_processingKill = 1; - _text = format["%1",_message]; - _xcoord = [safezoneX,0.8]; - _ycoord = [safezoneY + safezoneH - 0.5,0.2]; - _screentime = 5; - [" "+ _text,_xcoord,_ycoord,_screentime] spawn BIS_fnc_dynamicText; - uiSleep 3; - blck_processingKill = -1; - }; - }; - - fn_handleMessage = { - //private["_event","_msg","_mission"]; - //diag_log format["blck_Message ====] Paremeters = _this = %1",_this]; - params["_event","_message",["_mission",""]]; - - //diag_log format["blck_Message ====] Paremeters _event %1 _message %2 paramter #3 %3",_event,_message,_mission]; - //diag_log format["blck_Message ====] _message isEqualTo %1",_message]; - - switch (_event) do - { - case "start": - { - playSound "UAV_05"; - //diag_log "switch start"; - //_mission = _this select 1 select 2; - [_event,_message,_mission] spawn fn_missionNotification; - }; - case "end": - { - playSound "UAV_03"; - //diag_log "switch end"; - //_mission = _this select 1 select 2; - [_event,_message,_mission] spawn fn_missionNotification; - }; - case "aikilled": - { - //diag_log "switch aikilled"; - [_message] spawn fn_AI_KilledNotification; - }; - case "DLS": - { - if ( (player distance _mission) < 1000) then {playsound "AddItemOK"; hint _message;systemChat _message}; - }; - case "reinforcements": - { - if ( (player distance _mission) < 1000) then {playsound "AddItemOK"; ["Alert",_message] call fn_dynamicNotification;}; - //diag_log "---->>>> Reinforcements Spotted"; - }; - case "IED": - { - [1] call BIS_fnc_Earthquake; - //["IED","Bandits targeted your vehicle with an IED"] call fn_dynamicNotification; - ["Bandits targeted your vehicle with an IED.", 5] call Epoch_message; - for "_i" from 1 to 3 do {playSound "BattlefieldExplosions3_3D";uiSleep 0.3;}; - }; - case "showScore": - { - [_message select 0, _message select 1, _message select 2] call fn_killScoreNotification; - }; - }; - - }; - - diag_log "blck client loaded ver 1/11/17 2.0 8 PM"; - diag_log "[blckeagls] starting client loop"; - - while {true} do - { - waitUntil {!(blck_message isEqualTo "")}; - //diag_log format["[blckClient] blck_Message = %1", blck_message]; - private["_message"]; - _message = blck_message; - _message spawn fn_handleMessage; - blck_Message = ""; - }; -}; \ No newline at end of file