Exile Update + Other Fixes

This commit is contained in:
eraser1 2016-09-01 14:48:58 -05:00
parent e5ba52b01b
commit beafa6d80e
10 changed files with 112 additions and 92 deletions

View File

@ -4,7 +4,7 @@ class CfgPatches
{
units[] = {};
weapons[] = {};
a3_DMS_version = "July 26, 2016";
a3_DMS_version = "September 1, 2016";
requiredVersion = 1.36;
requiredAddons[] = {"exile_client","exile_server_config"};
};

View File

@ -62,14 +62,14 @@ _crate = ["Box_NATO_Wps_F",_pos] call DMS_fnc_SpawnCrate;
_building = createVehicle ["Land_Medevac_HQ_V1_F",[(_pos select 0) - 10, (_pos select 1),-0.1],[], 0, "CAN_COLLIDE"];
_vehicle = ["I_Truck_02_medical_F",_pos] call DMS_fnc_SpawnNonPersistentVehicle;
_vehicle = ["Exile_Car_Ural_Covered_Worker",_pos] call DMS_fnc_SpawnNonPersistentVehicle;
// Set crate loot values
_crate_loot_values =
[
5, // Weapons
[9,["Exile_Item_InstaDoc","Exile_Item_PlasticBottleFreshWater"]], // Items
[10,DMS_BoxMeds], // Items
3 // Backpacks
];

View File

@ -55,7 +55,7 @@ DMS_CrateCase_DiverGear =
];
// I only made some of the variables in this file "private" because I couldn't bother making all of them private :p
private _crate = ["I_CargoNet_01_ammo_F",[5630,3100,0]] call DMS_fnc_SpawnCrate;
private _crate = ["Box_IND_AmmoVeh_F",[5630,3100,0]] call DMS_fnc_SpawnCrate;
_crate setVariable ["DMS_AllowSmoke", false];
@ -127,15 +127,10 @@ private _diverGroup =
DMS_ai_use_launchers = _temp;
// Remove all previous waypoints for the diver group
for "_i" from count (waypoints _diverGroup) to 1 step -1 do
{
deleteWaypoint ((waypoints _diverGroup) select _i);
};
_x disableAI "PATH";
} forEach (units _diverGroup);
private _wp = _diverGroup addWaypoint [_sub1,0];
_wp setWaypointType "GUARD";

View File

@ -9,71 +9,90 @@
eg: _group setVariable ["DMS_AllowFreezing",false]
*/
private _recentlyUnfrozen = [];
{
if (isNull _x) then
private _leader = leader _x;
private _units = units _x;
if (_x getVariable ["DMS_isGroupFrozen",false]) then
{
diag_log format["DMS ERROR :: Null Group found in DMS_FrozenAIGroups! Index: %1 | You might want to consider reducing the value of 'DMS_ai_freezeCheckingDelay'! Current value: %2",_forEachIndex,DMS_ai_freezeCheckingDelay];
DMS_FrozenAIGroups deleteAt _forEachIndex;
}
else
{
private _leader = leader _x;
if ([_leader,DMS_ai_unfreezingDistance] call DMS_fnc_IsPlayerNearby) then
{
[_x,false] call DMS_fnc_FreezeToggle;
_recentlyUnfrozen pushBack _x;
{
_x enableSimulationGlobal true;
(vehicle _x) enableSimulationGlobal true;
} forEach _units;
_x setVariable ["DMS_isGroupFrozen",false];
if (DMS_ai_offloadOnUnfreeze) then
{
[_x, _leader] call DMS_fnc_SetAILocality;
};
if (DMS_DEBUG) then
{
format["FreezeManager :: Un-froze AI Group: %1",_x] call DMS_fnc_DebugLog;
};
DMS_FrozenAIGroups deleteAt _forEachIndex;
};
};
} forEach DMS_FrozenAIGroups;
if (DMS_ai_allowFreezing) then
{
}
else
{
if (((count (units _x))>1) && {_x getVariable ["DMS_AllowFreezing",true]} && {!(DMS_ai_freeze_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])})}) then
{
private _leader = leader _x;
private _group = _x;
if (DMS_ai_allowFreezing) then
{
private _canFreeze = false;
if !(isPlayer _leader) then
try
{
// Ignore Exile flyovers.
if (((side _group) isEqualTo independent) && {(count (units _group)) isEqualTo 1}) exitWith {};
if !(_x getVariable ["DMS_AllowFreezing",true]) throw "not allowed to be frozen";
if ((side _x) isEqualTo independent) then
{
{
if (isPlayer _x) throw "player group";
} forEach _units;
if ((count _units) isEqualTo 1) throw "Exile flyover (probably)";
};
if (DMS_ai_freeze_Only_DMS_AI && {!(_x getVariable ["DMS_SpawnedGroup",false])}) throw "not a DMS-spawned group";
_canFreeze = true;
}
catch
{
// Mark the group to speed up future checks
_x setVariable ["DMS_AllowFreezing",false];
if (DMS_DEBUG) then
{
format["FreezeManager :: Cannot freeze group ""%1"": %2", _x, _exception] call DMS_fnc_DebugLog;
};
};
if (_canFreeze) then
{
if !([_leader,DMS_ai_freezingDistance] call DMS_fnc_IsPlayerNearby) then
{
[_group,true] call DMS_fnc_FreezeToggle;
{
_x enableSimulationGlobal false;
(vehicle _x) enableSimulationGlobal false;
} forEach _units;
_x setVariable ["DMS_isGroupFrozen",true];
if (DMS_DEBUG) then
{
format["FreezeManager :: Froze AI Group: %1",_group] call DMS_fnc_DebugLog;
format["FreezeManager :: Froze AI Group: %1",_x] call DMS_fnc_DebugLog;
};
// So that we don't check this group for freezing later on.
_group setVariable ["DMS_AllowFreezing",false];
};
};
};
} forEach allGroups;
};
// NOW we allow them to be frozen again, so we avoid checking for nearby players TWICE on a group(s) that has just been un-frozen.
{
_x setVariable ["DMS_AllowFreezing", true];
} forEach _recentlyUnfrozen;
};
};
} forEach allGroups;

View File

@ -26,8 +26,8 @@ if (_freeze) then
_x enableSimulationGlobal false;
(vehicle _x) enableSimulationGlobal false;
} forEach (units _group);
_group setVariable ["DMS_isGroupFrozen",true];
DMS_FrozenAIGroups pushBack _group;
}
else
{
@ -35,5 +35,6 @@ else
_x enableSimulationGlobal true;
(vehicle _x) enableSimulationGlobal true;
} forEach (units _group);
_group setVariable ["DMS_isGroupFrozen",false];
};

View File

@ -48,6 +48,7 @@ private _removeAll =
moveOut _unit;
_unit removeAllEventHandlers "HandleDamage";
_unit enableSimulationGlobal true;
// Remove gear according to configs
if ((_unit getVariable ["DMS_clear_AI_body",DMS_clear_AI_body]) && {(random 100) <= (_unit getVariable ["DMS_clear_AI_body_chance",DMS_clear_AI_body_chance])}) then
@ -107,6 +108,8 @@ if (!(_grpUnits isEqualTo []) && {(leader _grp) isEqualTo _unit}) then
private _av = _unit getVariable ["DMS_AssignedVeh",objNull];
if (!isNull _av) then
{
_av enableSimulationGlobal true;
// Determine whether or not the vehicle has any active crew remaining.
private _memCount = {[(alive _x),false] select (_unit isEqualTo _x);} count (crew _av);
@ -129,7 +132,8 @@ if (!isNull _av) then
{
_av setDamage 1;
_av setVariable ["ExileDiedAt",time];
_av spawn {sleep 1;_this enableSimulationGlobal false;};
[if (_av isKindOf "Air") then {30} else {5}, {_this enableSimulationGlobal false}, _av, false, false] call ExileServer_system_thread_addTask;
if (DMS_DEBUG) then
@ -148,6 +152,18 @@ if (!isNull _av) then
[_av, 1] remoteExecCall ["lock", _av];
};
_av call ExileServer_system_simulationMonitor_addVehicle;
_av setVariable ["ExileMoney",0,true];
_av setVariable ["ExileIsPersistent", false];
_av addMPEventHandler ["MPKilled", { if (isServer) then {_this call ExileServer_object_vehicle_event_onMPKilled;};}];
_av addEventHandler ["GetIn", {_this call ExileServer_object_vehicle_event_onGetIn}];
if (!isNil "AVS_Version") then
{
_av call AVS_fnc_sanitizeVehicle;
};
if (DMS_DEBUG) then
{
(format["OnKilled :: Unlocking used AI vehicle (%1).",typeOf _av]) call DMS_fnc_DebugLog;
@ -294,7 +310,7 @@ if (isPlayer _killer) then
};
if (!(_veh isEqualTo _killer) && {(driver _veh) isEqualTo _killer}) then
if (!(_veh isEqualTo _killer) && {(driver _veh) isEqualTo _killer} && {(_killer distance _unit)<10}) then
{
_playerObj = driver _veh;
@ -355,3 +371,5 @@ if (isPlayer _killer) then
// Let Exile handle the AI Body cleanup.
_unit setVariable ["ExileDiedAt",time];
_unit setVariable ["DMS_KillerObj",[_playerObj,_killer] select (isNull _playerObj)];
[5, {_this enableSimulationGlobal false}, _unit, false, false] call ExileServer_system_thread_addTask;

View File

@ -131,8 +131,8 @@ if ((!isNull _playerObj) && {(_playerUID != "") && {_playerObj isKindOf "Exile_U
{
private _group = group _playerObj;
private _members = units _group;
if (!(_group isEqualTo ExileServerLoneWolfGroup) && {(count _members)>1}) then
if ((count _members)>1) then
{
private _msg = format
[

View File

@ -381,11 +381,7 @@ if (DMS_ai_disable_ramming_damage) then
};
{
_unit enableAI _x;
} forEach ["TARGET", "AUTOTARGET", "MOVE", "ANIM", "FSM"];
if (_difficulty=="hardcore") then
if (_difficulty == "hardcore") then
{
// Make him a little bit harder ;)
{
@ -393,6 +389,12 @@ if (_difficulty=="hardcore") then
} forEach ["SUPPRESSION", "AIMINGERROR"];
};
if (_difficulty == "easy") then
{
// Disable visibility raycasts for "easy" AI.
_unit disableAI "CHECKVISIBLE";
};
_unit setCustomAimCoef (missionNamespace getVariable [format["DMS_AI_AimCoef_%1",_difficulty], 0.7]);
_unit enableStamina (missionNamespace getVariable [format["DMS_AI_EnableStamina_%1",_difficulty], true]);

View File

@ -52,11 +52,20 @@ if (_vehClass == "random") then
private _veh = createVehicle [_vehClass, _spawnPos, [], 0, "NONE"];
clearBackpackCargoGlobal _veh;
clearItemCargoGlobal _veh;
clearWeaponCargoGlobal _veh;
clearItemCargoGlobal _veh;
clearBackpackCargoGlobal _veh;
if (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "nightVision") isEqualTo 0) then
{
_veh disableNVGEquipment true;
};
if (getNumber (configFile >> "CfgSettings" >> "VehicleSpawn" >> "thermalVision") isEqualTo 0) then
{
_veh disableTIEquipment true;
};
_veh setFuel 1;
_veh engineOn true;
_veh lock 2;

View File

@ -43,24 +43,11 @@ if !(isClass (configFile >> "CfgVehicles" >> _vehicleClass)) exitWith
objNull
};
private _vehpos = [];
private _maxDistance = 5;
private _vehObj = createVehicle [_vehicleClass, _position, [], 0, "NONE"];
for "_i" from 0 to 1000 do
{
_vehpos = _position findEmptyPosition [0,_maxDistance,_vehicleClass];
if !(_vehpos isEqualTo []) exitWith {};
_maxDistance = (_maxDistance + 5);
};
_vehpos set [2, 0.1];
private _vehObj = createVehicle [_vehicleClass, _vehpos, [], 0, "CAN_COLLIDE"];
clearBackpackCargoGlobal _vehObj;
clearItemCargoGlobal _vehObj;
clearMagazineCargoGlobal _vehObj;
clearWeaponCargoGlobal _vehObj;
clearItemCargoGlobal _vehObj;
clearBackpackCargoGlobal _vehObj;
if (_vehicleClass isKindOf "I_UGV_01_F") then
{
@ -85,20 +72,10 @@ if ((getTerrainHeightASL _vehpos)>0) then
_vehObj setVariable ["ExileMoney",0,true];
_vehObj setVariable ["ExileIsPersistent", false];
_vehObj setVariable ["ExileIsSimulationMonitored", false];
_vehObj addMPEventHandler ["MPKilled", { if (isServer) then {_this call ExileServer_object_vehicle_event_onMPKilled;};}];
_vehObj addEventHandler ["GetIn", {_this call ExileServer_object_vehicle_event_onGetIn}];
if (_vehObj isKindOf "Helicopter") then
{
_vehObj addEventHandler ["RopeAttach",
{
private _vehicle = _this select 2;
if !(simulationEnabled _vehicle) then
{
_vehicle enableSimulationGlobal true;
};
}];
};
if (!isNil "AVS_Version") then
{
@ -110,7 +87,6 @@ _vehObj allowDamage false;
_vehObj enableRopeAttach false;
_vehObj enableSimulationGlobal false;
_vehObj setVariable ["ExileIsSimulationMonitored", false];
if (DMS_DEBUG) then
{