Merge remote-tracking branch 'refs/remotes/origin/development'

This commit is contained in:
second_coming 2016-05-03 11:51:41 +01:00
commit f5bf34af1b
18 changed files with 166 additions and 194 deletions

View File

@ -1,3 +1,18 @@
=================================================================================
V35 (03-05-2016)
=================================================================================
Fixed typo in an eventhandler
=================================================================================
V34 (03-05-2016)
=================================================================================
Altered a lot of the eventhandler in an attempt to stop the out of memory errors
=================================================================================
V33 (30-04-2016)
=================================================================================
Added server thread monitoring option for diagnosing server issues
=================================================================================
V32 (29-04-2016)
=================================================================================

View File

@ -13,8 +13,9 @@
// Shared Config for each occupation monitor
SC_debug = false; // set to true to turn on debug features (not for live servers)
SC_extendedLogging = false; // set to true for additional logging
SC_debug = false; // set to true to turn on debug features (not for live servers)
SC_extendedLogging = false; // set to true for additional logging
SC_processReporter = true; // true if you want to log server threads every 60 seconds (useful to spot problems on the server)
SC_infiSTAR_log = true; // true Use infiSTAR logging, false logs to server rpt
SC_maxAIcount = 100; // the maximum amount of AI, if the AI count is above this then additional AI won't spawn
SC_mapMarkers = false; // Place map markers at the occupied areas (occupyPlaces and occupyMilitary only) true/false

View File

@ -2,7 +2,7 @@
//
// Server Occupation script by second_coming
//
SC_occupationVersion = "v32 (29-04-2016)";
SC_occupationVersion = "v35 (03-05-2016)";
//
// http://www.exilemod.com/profile/60-second_coming/
//

View File

@ -3,25 +3,7 @@ private["_newUniform","_newVest","_newHeadgear","_arrowClass"];
_side = _this select 0;
_unit = _this select 1;
_unit removeAllMPEventHandlers "mphit";
switch (_side) do
if(_side == "survivor") then
{
case "survivor":
{
_arrowClass = "Sign_Arrow_Green_F";
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
};
case "bandit":
{
_arrowClass = "Sign_Arrow_F";
};
_unit addMPEventHandler ["mphit", "_this call SC_fnc_unitMPHit;"];
};
if(SC_debug) then
{
_tag = createVehicle [_arrowClass, position _unit, [], 0, "CAN_COLLIDE"];
_tag attachTo [_unit,[0,0,0.6],"Head"];
};
_unit addMPEventHandler ["mpkilled", "_this call SC_fnc_unitMPKilled;"];

View File

@ -24,7 +24,7 @@ switch (_side) do
for "_i" from 1 to _amountOfMagazines do
{
_newMagazine = SC_SurvivorMagazines call BIS_fnc_selectRandom;
_quantity = 1 + round random (2);
_quantity = 1;
_magazines pushBack [_newMagazine,_quantity];
};
};
@ -63,7 +63,7 @@ _pistolAttachmentsChance = round (random 100);
if(_pistolAttachmentsChance < 50) then { _pistolAttachments = [""]; };
_backpackChance = round (random 100);
if(_backpackChance < 40) then { _backpack = ""; };
if(_backpackChance < 20) then { _backpack = ""; };
_launcherChance = round (random 100);
if(_launcherChance < 40 OR isNil "_launcher") then { _launcher = ""; };

View File

@ -2,35 +2,52 @@ _logDetail = format ["[OCCUPATION:Unstick]:: Initialised at %1",time];
[_logDetail] call SC_fnc_log;
{
_logDetail = format ["[OCCUPATION:Unstick]:: Air: %1 is active",_x];
[_logDetail] call SC_fnc_log;
_x setFuel 1;
sleep 5;
_originalSpawnLocation = _x getVariable "SC_vehicleSpawnLocation";
_pos = position _x;
_nearestMarker = [allMapMarkers, _pos] call BIS_fnc_nearestPosition; // Nearest Marker to the Location
_posNearestMarker = getMarkerPos _nearestMarker;
if(_pos distance _posNearestMarker < 750) then
if(!isNull _x) then
{
_GroupLeader = leader (group _x);
_GroupLeader doMove _originalSpawnLocation;
};
_logDetail = format ["[OCCUPATION:Unstick]:: Air: %1 is active",_x];
[_logDetail] call SC_fnc_log;
_x setFuel 1;
[_x] call SC_fnc_comeUnstuck;
sleep 5;
}
else
{
SC_liveHelis = SC_liveHelis - 1;
SC_liveHelisArray = SC_liveHelisArray - [_x];
};
}forEach SC_liveHelisArray;
{
_logDetail = format ["[OCCUPATION:Unstick]:: Land: %1 is active",_x];
[_logDetail] call SC_fnc_log;
_x setFuel 1;
[_x] call SC_fnc_comeUnstuck;
sleep 5;
if(!isNull _x) then
{
_logDetail = format ["[OCCUPATION:Unstick]:: Land: %1 is active",_x];
[_logDetail] call SC_fnc_log;
_x setFuel 1;
[_x] call SC_fnc_comeUnstuck;
sleep 5;
}
else
{
SC_liveVehicles = SC_liveVehicles - 1;
SC_liveVehiclesArray = SC_liveVehiclesArray - [_x];
};
}forEach SC_liveVehiclesArray;
{
_logDetail = format ["[OCCUPATION:Unstick]:: Sea: %1 is active",_x];
[_logDetail] call SC_fnc_log;
_x setFuel 1;
[_x] call SC_fnc_comeUnstuck;
sleep 5;
if(!isNull _x) then
{
_logDetail = format ["[OCCUPATION:Unstick]:: Sea: %1 is active",_x];
[_logDetail] call SC_fnc_log;
_x setFuel 1;
[_x] call SC_fnc_comeUnstuck;
sleep 5;
}
else
{
SC_liveBoats = SC_liveBoats - 1;
SC_liveBoatsArray = SC_liveBoatsArray - [_x];
};
}forEach SC_liveBoatsArray;

View File

@ -0,0 +1,31 @@
if(!isNil "INFISTARVERSION") then
{
_logDetail = "=======================================================================================================";
['A3_EXILE_PROCESSREPORTER',_logDetail] call FNC_A3_CUSTOMLOG;
_logDetail = format['[processReporter] Started @ %4 : [FPS: %1|PLAYERS: %2|THREADS: %3]',diag_fps,count allplayers,count diag_activeSQFScripts,time];
['A3_EXILE_PROCESSREPORTER',_logDetail] call FNC_A3_CUSTOMLOG;
_logDetail = "=======================================================================================================";
['A3_EXILE_PROCESSREPORTER',_logDetail] call FNC_A3_CUSTOMLOG;
{
_logDetail = format ["[processReporter] %1 @ %2",_x,time];
['A3_EXILE_PROCESSREPORTER',_logDetail] call FNC_A3_CUSTOMLOG;
} forEach diag_activeSQFScripts;
_logDetail = format ["[processReporter] Ended @ %1",time];
['A3_EXILE_PROCESSREPORTER',_logDetail] call FNC_A3_CUSTOMLOG;
}
else
{
diag_log "=======================================================================================================";
diag_log format['[processReporter] Started @ %4 : [FPS: %1|PLAYERS: %2|THREADS: %3]',diag_fps,count allplayers,count diag_activeSQFScripts,time];
diag_log "=======================================================================================================";
{
diag_log format ["[processReporter] %1 @ %2",_x,time];
} forEach diag_activeSQFScripts;
diag_log format ["[processReporter] Ended @ %1",time];
};

View File

@ -16,31 +16,7 @@ if(SC_extendedLogging) then
};
_ejectChance = round (random 100) + (_heliDamage * 100);
_essentials = [ "HitAvionics","HitEngine1","HitEngine2","HitEngine","HitHRotor","HitVRotor","HitTransmission",
"HitHydraulics","HitGear","HitHStabilizerL1","HitHStabilizerR1","HitVStabilizer1","HitFuel"];
_damagedEssentials = 0;
{
if ((_heli getHitPointDamage _x) > 0) then
{
if(_x == "HitFuel" && _heliDamage < 1) then
{
_heli setHitPointDamage ["HitFuel", 0];
_heli setFuel 1;
};
_damage = _heli getHitPointDamage _x;
if(SC_extendedLogging) then
{
_logDetail = format ["[OCCUPATION:Sky]:: Heli %1 checking part %2 (damage: %4) @ %3",_heli, _x, time,_damage];
[_logDetail] call SC_fnc_log;
};
if(_damage > 0) then { _damagedEssentials = _damagedEssentials + 1; };
};
} forEach _essentials;
if(_heliDamage > 0.2 && _damagedEssentials > 0 && !_crewEjected && _ejectChance > 100) then
if(_heliDamage > 0.2 && !_crewEjected && _ejectChance > 100) then
{
_target = _this select 1;
[_heli, _target] spawn
@ -81,9 +57,10 @@ if(_heliDamage > 0.2 && _damagedEssentials > 0 && !_crewEjected && _ejectChance
};
if(_heliDamage > 0.7 && _damagedEssentials > 0) then
if(_heliDamage > 0.7) then
{
if(SC_extendedLogging) then
_heli = _this select 0;
if(SC_extendedLogging) then
{
_logDetail = format ["[OCCUPATION:Sky]:: Air unit %2 damaged and force landing at %3 (time: %1)",time,_this select 0,_this select 1,_heliPosition];
[_logDetail] call SC_fnc_log;
@ -109,11 +86,14 @@ if(_heliDamage > 0.7 && _damagedEssentials > 0) then
_wp setWaypointBehaviour "COMBAT";
_wp setWaypointCombatMode "RED";
_wp setWaypointCompletionRadius 10;
_wp setWaypointType "GETOUT";
_wp setWaypointType "TR UNLOAD";
[_group2, _destination, 250] call bis_fnc_taskPatrol;
_group2 setBehaviour "COMBAT";
_group2 setCombatMode "RED";
};
_heli addMPEventHandler ["mphit", "_this call SC_fnc_airHit;"];
if(_heliDamage <= 0.7) then
{
_heli addMPEventHandler ["mphit", "_this call SC_fnc_airHit;"];
};

View File

@ -33,6 +33,11 @@ if(count(crew _vehicle) > 0)then
_vehicle setVectorUp [0,0,1];
_originalSpawnLocation = _vehicle getVariable "SC_vehicleSpawnLocation";
if(isNil "_originalSpawnLocation") then
{
_originalSpawnLocation = [_curPos, 50, 1000, 3, 2, 20, 0] call BIS_fnc_findSafePos;
};
_group = group _vehicle;
_vehClass = typeOf _vehicle;
@ -68,17 +73,14 @@ if(count(crew _vehicle) > 0)then
_vehicle setVariable["vehPos",_newPos];
};
_group = group _vehicle;
// Remove dead units from the group
_group = group _vehicle;
{
if(!alive _x) then { [_x] join grpNull; };
}forEach units _group;
if(count units _group > 0) then
if(count units _group < 1) then
{
_vehicle lock 0;
_vehicle setVehicleLock "UNLOCKED";
_vehicle setVariable ["ExileIsLocked", 0, true];
_vehicle call SC_fnc_vehicleDestroyed;
};

View File

@ -50,12 +50,6 @@ if(count units _group > 0) then
_driver removeAllMPEventHandlers "mphit";
_driver addMPEventHandler ["mpkilled", "_this call SC_fnc_driverKilled;"];
if(SC_debug) then
{
_tag = createVehicle ["Sign_Arrow_Yellow_F", position _driver, [], 0, "CAN_COLLIDE"];
_tag attachTo [_driver,[0,0,0.6],"Head"];
};
_driver doMove (position _vehicle);
_driver action ["movetodriver", _vehicle];

View File

@ -1,11 +1,11 @@
// Triggered if a player gets in a captured AI vehicle
// Marks the vehicle as claimed by a player and frees up a slot to spawn another AI controlled vehicle
_unit = _this select 0;
_vehicle = _this select 0;
_unit = _this select 2;
if(isPlayer _unit) then
{
_vehicle = vehicle _unit;
[_vehicle] call SC_fnc_vehicleDestroyed;
if(SC_extendedLogging) then
@ -16,12 +16,6 @@ if(isPlayer _unit) then
}
else
{
if(SC_debug) then
{
{ deleteVehicle _x; } forEach attachedObjects _unit;
};
if(damage _vehicle > 0) then
{
[_vehicle] call SC_fnc_repairVehicle;

View File

@ -1,32 +0,0 @@
// Triggered if an AI unit leaves an AI vehicle
_unit = _this select 0;
_vehicle = _this select 2;
_driver = _vehicle getVariable "SC_assignedDriver";
_arrowClass = "Sign_Arrow_F";
if(!alive _unit) exitWith {};
if(side _unit == SC_SurvivorSide) then
{
_arrowClass = "Sign_Arrow_Green_F";
}
else
{
_arrowClass = "Sign_Arrow_F";
};
if(_unit == _driver) then
{
_arrowClass = "Sign_Arrow_Yellow_F";
};
if(SC_debug && alive _unit && vehicle _unit != _unit) then
{
_tag = createVehicle [_arrowClass, position _unit, [], 0, "CAN_COLLIDE"];
_tag attachTo [_unit,[0,0,0.6],"Head"];
}
else
{
{ deleteVehicle _x; } forEach attachedObjects _unit;
};

View File

@ -1,18 +0,0 @@
// Triggered when a vehicle runs out of fuel but only if not damaged
_vehicle = _this select 0;
_fuel = _this select 1;
diag_log format["[OCCUPATION:refuelcheck] _vehicle: %1 ---- _fuel: %2 ",_vehicle,_fuel];
/*
if(!isNil "_vehicle" && !isNil "_fuel") then
{
_damage = getdammage _vehicle;
if(_damage <> 0 && !_fuel) then
{
_vehicle setFuel 1;
_vehicle engineOn true;
};
};
*/

View File

@ -64,28 +64,29 @@ if(_damagedWheels > 0 OR _engineDamage OR _fueltankDamage) then
_driver playMoveNow "Acts_carFixingWheel";
sleep 8;
_driver switchMove "";
if(alive _driver) then
{
_vehicle setDamage 0;
_driver playMoveNow "Acts_carFixingWheel";
sleep 2;
_driver switchMove "";
_driver assignAsDriver _vehicle;
_driver moveInDriver _vehicle;
_driver action ["movetodriver", _vehicle];
};
if(!alive _driver) exitWith{};
_driver playMoveNow "Acts_carFixingWheel";
sleep 2;
_vehicle setDamage 0;
_driver switchMove "";
_driver assignAsDriver _vehicle;
_driver moveInDriver _vehicle;
_driver action ["movetodriver", _vehicle];
_wp = _group addWaypoint [position _vehicle, 0] ;
_wp setWaypointFormation "Column";
_wp setWaypointCompletionRadius 1;
_wp setWaypointType "GETIN";
sleep 5;
_spawnLocation = _vehicle getVariable "SC_vehicleSpawnLocation";
_driver action ["movetodriver", _vehicle];
_vehicle forceSpeed -1;
[_group, _spawnLocation, 2000] call bis_fnc_taskPatrol;
_group setBehaviour "SAFE";
_group setCombatMode "RED";
_spawnLocation = _vehicle getVariable "SC_vehicleSpawnLocation";
if(!isNil "_spawnLocation") then
{
_driver action ["movetodriver", _vehicle];
_vehicle forceSpeed -1;
[_group, _spawnLocation, 2000] call bis_fnc_taskPatrol;
_group setBehaviour "SAFE";
_group setCombatMode "RED";
};
};
}
else

View File

@ -13,7 +13,7 @@ if (side _aggressor == RESISTANCE) then
_group = createGroup WEST;
{
_unit = _x;
//[_unit] joinSilent grpNull;
[_unit] joinSilent grpNull;
[_unit] joinSilent _group;
_unit removeAllMPEventHandlers "mphit";
}foreach units _initialGroup;

View File

@ -1,12 +0,0 @@
// Get the variables from the event handler
_unit = _this select 0;
_killer = _this select 1;
// remove all eventhandlers from the dead unit
_unit removeAllMPEventHandlers "mphit";
[_unit] join grpNull;
if(SC_debug) then
{
{ deleteVehicle _x; } forEach attachedObjects _unit;
};

View File

@ -2,25 +2,33 @@
// SC_liveVehiclesArray = array of active vehicles
_vehicle = _this select 0;
_vehicle removeAllMPEventHandlers "mphit";
_vehicle removeAllMPEventHandlers "mpkilled";
_vehicle removeAllEventHandlers "getin";
_vehicle removeAllEventHandlers "getout";
if(_vehicle isKindOf "LandVehicle") then
if(!isNil "_vehicle") then
{
SC_liveVehicles = SC_liveVehicles - 1;
SC_liveVehiclesArray = SC_liveVehiclesArray - [_vehicle];
};
_vehicle = _this select 0;
_vehicle removeAllMPEventHandlers "mphit";
_vehicle removeAllMPEventHandlers "mpkilled";
_vehicle removeAllEventHandlers "getin";
_vehicle removeAllEventHandlers "getout";
_vehicle lock 0;
_vehicle setVehicleLock "UNLOCKED";
_vehicle setVariable ["ExileIsLocked", 0, true];
if(_vehicle isKindOf "LandVehicle") then
{
SC_liveVehicles = SC_liveVehicles - 1;
SC_liveVehiclesArray = SC_liveVehiclesArray - [_vehicle];
};
if(_vehicle isKindOf "Air") then
{
SC_liveHelis = SC_liveHelis - 1;
SC_liveHelisArray = SC_liveHelisArray - [_vehicle];
};
if(_vehicle isKindOf "Air") then
{
SC_liveHelis = SC_liveHelis - 1;
SC_liveHelisArray = SC_liveHelisArray - [_vehicle];
};
if(_vehicle isKindOf "Ship") then
{
SC_liveBoatss = SC_liveBoatss - 1;
SC_liveBoatsArray = SC_liveBoatsArray - [_vehicle];
};
if(_vehicle isKindOf "Ship") then
{
SC_liveBoats = SC_liveBoats - 1;
SC_liveBoatsArray = SC_liveBoatsArray - [_vehicle];
};
};

View File

@ -10,9 +10,18 @@ if(SC_debug) then { SC_refreshTime = 60; }else{ SC_refreshTime = 300; };
// Add selected occupation scripts to Exile Threading System
if(SC_processReporter) then
{
fnc_processReporter = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\processReporter.sqf";
diag_log format ["[processReporter]:: Initialised at %1",time];
[60, fnc_processReporter, [], true] call ExileServer_system_thread_addTask;
};
if (SC_fastNights) then
{
fnc_checkMultiplier = compile preprocessFileLineNumbers "\x\addons\a3_exile_occupation\scripts\occupationFastNights.sqf";
diag_log format ["[OCCUPATION:FastNights]:: Initialised at %1",time];
[60, fnc_checkMultiplier, [], true] call ExileServer_system_thread_addTask;
};