Bug Fixes
Number of dynamic UMS spawned now works correctly Disablling having AI Counts at Map Markers now works correctly
This commit is contained in:
parent
b7defed0c5
commit
9e8e540650
@ -1,203 +0,0 @@
|
|||||||
/*
|
|
||||||
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 [[<Object>unit,<String>role,<Number>cargoIndex,<Array>turretPath,<Boolean>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;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,203 +0,0 @@
|
|||||||
/*
|
|
||||||
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 [[<Object>unit,<String>role,<Number>cargoIndex,<Array>turretPath,<Boolean>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;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,172 +0,0 @@
|
|||||||
/*
|
|
||||||
By Ghostrider [GRG]
|
|
||||||
Copyright 2016
|
|
||||||
--------------------------
|
|
||||||
License
|
|
||||||
--------------------------
|
|
||||||
All the code and information provided here is provided under an Attribution Non-Commercial ShareAlike 4.0 Commons License.
|
|
||||||
|
|
||||||
http://creativecommons.org/licenses/by-nc-sa/4.0/
|
|
||||||
*/
|
|
||||||
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
_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 > 0) 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 [[<Object>unit,<String>role,<Number>cargoIndex,<Array>turretPath,<Boolean>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 > 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
private _veh = _x; // (purely for clarity at this point, _x could be used just as well)
|
|
||||||
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 = {alive _x} count (crew _veh);
|
|
||||||
private _deletenow = if ( (_veh getVariable["blck_DeleteAt",0] > 0) && (diag_tickTime > (_veh getVariable "blck_DeleteAt"))) then {true} else {false};
|
|
||||||
private _missionCompleted = _veh getVariable["missionCompleted",0];
|
|
||||||
private _evaluate = true;
|
|
||||||
|
|
||||||
if (_ownerIsPlayer) then
|
|
||||||
{
|
|
||||||
// disable further monitoring and mark to never be deleted.
|
|
||||||
_evaluate = false;
|
|
||||||
_veh setVariable["blck_DeleteAt",0];
|
|
||||||
blck_monitoredVehicles = blck_monitoredVehicles - [_veh];
|
|
||||||
diag_log format["_fnc_vehicleMonitor: vehicle %1 now owned by player %2",_veh, owner _veh];
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_allCrewDead && _evaluate) then
|
|
||||||
{
|
|
||||||
if (_isEmplaced) then
|
|
||||||
{
|
|
||||||
if (blck_killEmptyStaticWeapons) then
|
|
||||||
{
|
|
||||||
#ifdef blck_debugMode
|
|
||||||
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;
|
|
||||||
} 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];
|
|
||||||
[_veh] call _fn_releaseVehicle;
|
|
||||||
};
|
|
||||||
_evaluate = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
if (_missionCompleted && !(_allCrewDead)) then
|
|
||||||
{
|
|
||||||
diag_log format["_fnc_vehicleMonitor:: case of mission vehicle with AI alive at mission end: schedule destruction with _veh = %1 and typeOf _veh = %2",_veh, typeOf _veh];
|
|
||||||
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;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
|||||||
blck_spawnStaticLootCrates = true; // When true, static loot crates will be spawned and loaded with loot as specified in custom_server\SLS\SLS_init_Epoch.sqf (or its exile equivalent).
|
blck_spawnStaticLootCrates = true; // When true, static loot crates will be spawned and loaded with loot as specified in custom_server\SLS\SLS_init_Epoch.sqf (or its exile equivalent).
|
||||||
|
|
||||||
// Note that you can define map-specific variants in custom_server\configs\blck_custom_config.sqf
|
// Note that you can define map-specific variants in custom_server\configs\blck_custom_config.sqf
|
||||||
blck_useTimeAcceleration = true; // When true, time acceleration will be periodically updated based on amount of daylight at that time according to the values below.
|
blck_useTimeAcceleration = false; // When true, time acceleration will be periodically updated based on amount of daylight at that time according to the values below.
|
||||||
blck_timeAccelerationDay = 0.25; // Daytime time accelearation
|
blck_timeAccelerationDay = 0.25; // Daytime time accelearation
|
||||||
blck_timeAccelerationDusk = 4; // Dawn/dusk time accelearation
|
blck_timeAccelerationDusk = 4; // Dawn/dusk time accelearation
|
||||||
blck_timeAccelerationNight = 12; // Nighttim time acceleration
|
blck_timeAccelerationNight = 12; // Nighttim time acceleration
|
||||||
@ -69,7 +69,7 @@
|
|||||||
// When set to true,"dot", ext will be to the right of a black dot at the center the mission marker.
|
// When set to true,"dot", ext will be to the right of a black dot at the center the mission marker.
|
||||||
blck_labelMapMarkers = [true,"center"];
|
blck_labelMapMarkers = [true,"center"];
|
||||||
blck_preciseMapMarkers = true; // Map markers are/are not centered at the loot crate
|
blck_preciseMapMarkers = true; // Map markers are/are not centered at the loot crate
|
||||||
blck_showCountAliveAI = true;
|
blck_showCountAliveAI = false;
|
||||||
|
|
||||||
//Minimum distance between missions
|
//Minimum distance between missions
|
||||||
blck_MinDistanceFromMission = 1500;
|
blck_MinDistanceFromMission = 1500;
|
||||||
@ -93,8 +93,8 @@
|
|||||||
blck_RunGearDamage = 0.2; // Damage applied to player vehicle for each AI run over
|
blck_RunGearDamage = 0.2; // Damage applied to player vehicle for each AI run over
|
||||||
blck_VK_Gear = true; // When set to true, AI that have been killed by a player in a vehicle in the list of forbidden vehicles or using a forbiden gun will be stripped of gear and the vehicle will be given blck_RunGearDamage of damage
|
blck_VK_Gear = true; // When set to true, AI that have been killed by a player in a vehicle in the list of forbidden vehicles or using a forbiden gun will be stripped of gear and the vehicle will be given blck_RunGearDamage of damage
|
||||||
blck_VK_RunoverDamage = true; // when the AI was run over blck_RunGearDamage of damage will be applied to the killer's vehicle.
|
blck_VK_RunoverDamage = true; // when the AI was run over blck_RunGearDamage of damage will be applied to the killer's vehicle.
|
||||||
blck_VK_GunnerDamage = true; // when the AI was killed by a gunner on a vehicle that is is in the list of forbidden vehicles, blck_RunGearDamage of damage will be applied to the killer's vehicle each time an AI is killed with a vehicle's gun.
|
blck_VK_GunnerDamage = false; // when the AI was killed by a gunner on a vehicle that is is in the list of forbidden vehicles, blck_RunGearDamage of damage will be applied to the killer's vehicle each time an AI is killed with a vehicle's gun.
|
||||||
blck_forbidenVehicles = [/*"B_MRAP_01_hmg_F","O_MRAP_02_hmg_F","I_MRAP_03_hmg_F","B_MRAP_01_hmg_F","O_MRAP_02_hmg_F"*/]; // Add any vehicles for which you wish to forbid vehicle kills
|
blck_forbidenVehicles = ["B_MRAP_01_hmg_F","O_MRAP_02_hmg_F","I_MRAP_03_hmg_F","B_MRAP_01_hmg_F","O_MRAP_02_hmg_F"]; // Add any vehicles for which you wish to forbid vehicle kills
|
||||||
// For a listing of the guns mounted on various land vehicles see the following link: https://community.bistudio.com/wiki/Arma_3_CfgWeapons_Vehicle_Weapons
|
// For a listing of the guns mounted on various land vehicles see the following link: https://community.bistudio.com/wiki/Arma_3_CfgWeapons_Vehicle_Weapons
|
||||||
// HMG_M2 is mounted on the armed offroad that is spawned by Epoch
|
// HMG_M2 is mounted on the armed offroad that is spawned by Epoch
|
||||||
blck_forbidenVehicleGuns = [/*"LMG_RCWS","LMG_M200","HMG_127","HMG_127_APC","HMG_M2","HMG_NSVT","GMG_40mm","GMG_UGV_40mm","autocannon_40mm_CTWS","autocannon_30mm_CTWS","autocannon_35mm","LMG_coax","autocannon_30mm","HMG_127_LSV_01"*/]; // Add any vehicles for which you wish to forbid vehicle kills, o
|
blck_forbidenVehicleGuns = [/*"LMG_RCWS","LMG_M200","HMG_127","HMG_127_APC","HMG_M2","HMG_NSVT","GMG_40mm","GMG_UGV_40mm","autocannon_40mm_CTWS","autocannon_30mm_CTWS","autocannon_35mm","LMG_coax","autocannon_30mm","HMG_127_LSV_01"*/]; // Add any vehicles for which you wish to forbid vehicle kills, o
|
||||||
@ -182,9 +182,9 @@
|
|||||||
//Set to -1 to disable. Values of 2 or more force the mission spawner to spawn copies of that mission - this feature is not recommended because you may run out of available groups.
|
//Set to -1 to disable. Values of 2 or more force the mission spawner to spawn copies of that mission - this feature is not recommended because you may run out of available groups.
|
||||||
blck_enableOrangeMissions = 1;
|
blck_enableOrangeMissions = 1;
|
||||||
blck_enableGreenMissions = 1;
|
blck_enableGreenMissions = 1;
|
||||||
blck_enableRedMissions = 1;
|
blck_enableRedMissions = 2;
|
||||||
blck_enableBlueMissions = 1;
|
blck_enableBlueMissions = 2;
|
||||||
blck_numberUnderwaterDynamicMissions = 5; // Values from 0 (no UMS) to N (N Underwater missions will be spawned; static UMS units and subs will be spawned.
|
blck_numberUnderwaterDynamicMissions = 0; // Values from 0 (no UMS) to N (N Underwater missions will be spawned; static UMS units and subs will be spawned.
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
// MISSION TIMERS
|
// MISSION TIMERS
|
||||||
|
@ -49,6 +49,7 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR
|
|||||||
blck_blacklistSpawns = true;
|
blck_blacklistSpawns = true;
|
||||||
blck_listConcreteMixerZones = true;
|
blck_listConcreteMixerZones = true;
|
||||||
blck_AI_Side = EAST;
|
blck_AI_Side = EAST;
|
||||||
|
|
||||||
blck_AIPatrolVehicles = ["Exile_Car_Offroad_Armed_Guerilla01","Exile_Car_Offroad_Armed_Guerilla02","Exile_Car_BTR40_MG_Green","Exile_Car_BTR40_MG_Camo","Exile_Car_HMMWV_M134_Green","Exile_Car_HMMWV_M134_Desert",/*"Exile_Car_HMMWV_M134_Desert","Exile_Car_HMMWV_M2_Desert",*/"B_LSV_01_armed_F"]; // Type of vehicle spawned to defend AI bases
|
blck_AIPatrolVehicles = ["Exile_Car_Offroad_Armed_Guerilla01","Exile_Car_Offroad_Armed_Guerilla02","Exile_Car_BTR40_MG_Green","Exile_Car_BTR40_MG_Camo","Exile_Car_HMMWV_M134_Green","Exile_Car_HMMWV_M134_Desert",/*"Exile_Car_HMMWV_M134_Desert","Exile_Car_HMMWV_M2_Desert",*/"B_LSV_01_armed_F"]; // Type of vehicle spawned to defend AI bases
|
||||||
blck_AIPatrolVehiclesBlue = blck_AIPatrolVehicles;
|
blck_AIPatrolVehiclesBlue = blck_AIPatrolVehicles;
|
||||||
blck_AIPatrolVehiclesRed = blck_AIPatrolVehicles;
|
blck_AIPatrolVehiclesRed = blck_AIPatrolVehicles;
|
||||||
|
@ -519,6 +519,9 @@ AI WEAPONS, UNIFORMS, VESTS AND GEAR
|
|||||||
blck_specialItems = blck_throwableExplosives + blck_medicalItems;
|
blck_specialItems = blck_throwableExplosives + blck_medicalItems;
|
||||||
|
|
||||||
blck_NVG = ["NVGoggles","NVGoggles_INDEP","NVGoggles_OPFOR","Exile_Item_XM8"];
|
blck_NVG = ["NVGoggles","NVGoggles_INDEP","NVGoggles_OPFOR","Exile_Item_XM8"];
|
||||||
|
blck_buildingMaterials = ["Exile_Item_ExtensionCord","Exile_Item_JunkMetal","Exile_Item_LightBulb","Exile_Item_MetalBoard",
|
||||||
|
"Exile_Item_MetalPole","Exile_Item_MetalScrews","Exile_Item_Cement","Exile_Item_Sand","Exile_Item_MetalWire","Exile_Item_ExtensionCord","Exile_Item_JunkMetal"];
|
||||||
|
blck_tools = ["Exile_Item_Matches","Exile_Item_CookingPot","Exile_Melee_Axe","Exile_Melee_SledgeHammmer","Exile_Item_Handsaw","Exile_Item_Pliers","Exile_Item_CanOpener","Exile_Item_Shovel"];
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
DEFAULT CONTENTS OF LOOT CRATES FOR EACH MISSION
|
DEFAULT CONTENTS OF LOOT CRATES FOR EACH MISSION
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
***********************************************************/
|
***********************************************************/
|
||||||
////////
|
////////
|
||||||
// Headless Client Configurations
|
// Headless Client Configurations
|
||||||
blck_useHC = true; //
|
blck_useHC = false; //
|
||||||
|
|
||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
// Kill message configurations
|
// Kill message configurations
|
||||||
|
@ -16,4 +16,4 @@
|
|||||||
#define useAPEX
|
#define useAPEX
|
||||||
//#define useDynamicSimulation
|
//#define useDynamicSimulation
|
||||||
//#define blck_debugMode
|
//#define blck_debugMode
|
||||||
#define blck_milServer
|
//#define blck_milServer
|
||||||
|
@ -96,7 +96,7 @@ _fn_setupCrates = {
|
|||||||
_blck_localMissionMarker = [format["SLS%1%2",_location select 0, _location select 1],(getPos _crate),"","","ColorGreen",["mil_box",[]]];
|
_blck_localMissionMarker = [format["SLS%1%2",_location select 0, _location select 1],(getPos _crate),"","","ColorGreen",["mil_box",[]]];
|
||||||
diag_log format["[blckeagls] SLS:: spawning diagnostic marker at %1",getPos _crate];
|
diag_log format["[blckeagls] SLS:: spawning diagnostic marker at %1",getPos _crate];
|
||||||
// params["_missionType","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerType"];
|
// params["_missionType","_markerPos","_markerLabel","_markerLabelType","_markerColor","_markerType"];
|
||||||
[_blck_localMissionMarker] execVM "debug\spawnMarker.sqf";
|
[_blck_localMissionMarker] call blck_fnc_spawnMarker;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
_crate
|
_crate
|
||||||
|
Loading…
Reference in New Issue
Block a user