Fixes + Additions

This commit is contained in:
eraser1 2016-05-22 15:15:38 -05:00
parent b2e2424777
commit c4a9b3f1b2
11 changed files with 85 additions and 7 deletions

View File

@ -4,7 +4,7 @@ class CfgPatches
{
units[] = {};
weapons[] = {};
a3_DMS_version = "May 22, 2016 (TEST)";
a3_DMS_version = "May 22, 2016 (2) (TEST)";
requiredVersion = 1.36;
requiredAddons[] = {"exile_client","exile_server_config"};
};
@ -42,6 +42,7 @@ class CfgFunctions
class FindSafePos_InRange {};
class FindSuppressor {};
class FreezeManager {};
class FreezeToggle {};
class GetAllUnits {};
class GetCenter {};
class GetEmptySeats {};

View File

@ -343,6 +343,7 @@ DMS_SpawnMissions_Scheduled = false; // Whether or not to spawn missions in a sc
DMS_ai_unfreezingDistance = 3500; // If there are players within this distance of the leader of an AI group, then the AI group will be "un-frozen".
DMS_ai_offloadOnUnfreeze = true; // Whether or not to offload AI to clients once they have been "un-frozen". NOTE: This config will be ignored if "DMS_ai_offload_to_client" is set to false.
DMS_ai_freezeCheckingDelay = 30; // How often (in seconds) DMS will check whether to freeze/un-freeze AI.
DMS_ai_freezeOnSpawn = true; // Whether or not to freeze an AI group when initially spawned.
DMS_ai_share_info = true; // Share info about killer
DMS_ai_share_info_distance = 300; // The distance killer's info will be shared to other AI

View File

@ -16,7 +16,7 @@ private _weaponName = getText (configFile >> "cfgWeapons" >> _weapon >> "displa
switch (true) do
{
// Zafir accepts no suppressors :(
case ((_weapon find "Zafir")>-1) : {""};
//case ((_weapon find "Zafir")>-1) : {""};
case ((_weaponName find "6.5") > -1) :
{
@ -41,4 +41,6 @@ switch (true) do
case ((_weaponName find ".338") > -1) : {selectRandom ["muzzle_snds_338_black","muzzle_snds_338_green","muzzle_snds_338_sand"]};
case ((_weaponName find "9.3 mm") > -1) : {selectRandom ["muzzle_snds_93mmg","muzzle_snds_93mmg_tan"]};
default {""};
};

View File

@ -24,12 +24,12 @@ private _recentlyUnfrozen = [];
private _leader = leader _x;
if ([_leader,DMS_ai_unfreezingDistance] call DMS_fnc_IsPlayerNearby) then
{
{_x enableSimulationGlobal true} forEach (units _x);
[_x,false] call DMS_fnc_FreezeToggle;
_recentlyUnfrozen pushBack _x;
if (DMS_ai_offloadOnUnfreeze) then
{
[_group, _leader] call DMS_fnc_SetAILocality;
[_x, _leader] call DMS_fnc_SetAILocality;
};
if (DMS_DEBUG) then
@ -51,8 +51,12 @@ private _recentlyUnfrozen = [];
if ((!isNull _leader) && {alive _leader} && {!(isPlayer _leader)} && {!([_leader,DMS_ai_freezingDistance] call DMS_fnc_IsPlayerNearby)}) then
{
{_x enableSimulationGlobal false} forEach (units _group);
DMS_FrozenAIGroups pushBack _group;
[_group,true] call DMS_fnc_FreezeToggle;
if (DMS_DEBUG) then
{
format["FreezeManager :: Froze AI Group: %1",_group] call DMS_fnc_DebugLog;
};
// So that we don't check this group for freezing later on.
_group setVariable ["DMS_AllowFreezing",false];

View File

@ -0,0 +1,33 @@
/*
DMS_fnc_FreezeToggle
created by eraser1
Usage:
[
_group, // GROUP: The AI Group to be frozen
_freeze // BOOL: "true" if you want to freeze, false if you want to un-freeze
] call DMS_fnc_FreezeToggle;
Freezes/un-freezes a specified group.
*/
if !(params
[
"_group",
"_freeze"
]) exitWith
{
diag_log format["DMS ERROR :: Calling DMS_fnc_FreezeToggle with invalid parameters: %1",_this];
};
if (_freeze) then
{
{_x enableSimulationGlobal false} forEach (units _group);
_group setVariable ["DMS_isGroupFrozen",true];
DMS_FrozenAIGroups pushBack _group;
}
else
{
{_x enableSimulationGlobal true} forEach (units _group);
_group setVariable ["DMS_isGroupFrozen",false];
};

View File

@ -122,6 +122,11 @@ _group setFormation "WEDGE";
[_group,_pos,_difficulty,"COMBAT"] call DMS_fnc_SetGroupBehavior;
if (DMS_ai_freezeOnSpawn) then
{
[_group,true] call DMS_fnc_FreezeToggle;
};
diag_log format ["DMS_SpawnAIGroup :: Spawned %1 AI at %2.",_count,_pos];

View File

@ -138,6 +138,11 @@ _group setFormation "WEDGE";
[_group,_positions select 0,_difficulty,"COMBAT"] call DMS_fnc_SetGroupBehavior;
if (DMS_ai_freezeOnSpawn) then
{
[_group,true] call DMS_fnc_FreezeToggle;
};
diag_log format ["DMS_SpawnAIGroup_MultiPos :: Spawned %1 AI using positions parameter: %2.",_count,_positions];

View File

@ -210,7 +210,7 @@ if (_customGearSet isEqualTo []) then
if((random 100) <= (missionNamespace getVariable [format["DMS_%1_suppressor_chance",_class],0])) then
{
private _suppressor = _weapon call DMS_fnc_FindSuppressor;
if(_suppressor != "") then
if (_suppressor != "") then
{
_unit addPrimaryWeaponItem _suppressor;
};

View File

@ -66,6 +66,11 @@ private _guns = _positions apply
reload _unit;
_unit setVariable ["DMS_AssignedVeh",_gun];
if (_group getVariable ["DMS_isGroupFrozen",false]) then
{
_unit enableSimulationGlobal false;
};
if (DMS_DEBUG) then
{
(format ["SpawnAIStaticMG :: Created unit %1 at %2 as static gunner in %3",_unit,_x,_gun]) call DMS_fnc_DebugLog;

View File

@ -65,15 +65,26 @@ _veh lock 2;
_group addVehicle _veh;
private _toFreeze = _group getVariable ["DMS_isGroupFrozen",false];
private _driver = [_group,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
_driver moveInDriver _veh;
_driver setVariable ["DMS_AssignedVeh",_veh];
if (_toFreeze) then
{
_driver enableSimulationGlobal false;
};
private _crewCount =
{
private _unit = [_group,_spawnPos,_class,_difficulty,_side,"Vehicle"] call DMS_fnc_SpawnAISoldier;
_unit moveInTurret [_veh, _x];
_unit setVariable ["DMS_AssignedVeh",_veh];
if (_toFreeze) then
{
_unit enableSimulationGlobal false;
};
true
} count (allTurrets [_veh, true]);

View File

@ -150,6 +150,17 @@ ___
# Changelog:
### Test Branch:
#### May 22, 2016 (3:15 PM CST-America):
* **NEW CONFIG VALUES:**
DMS_ai_freezeOnSpawn
* Added the ability to freeze AI groups immediately upon spawn.
* Units spawned to a group that has been frozen should now also be frozen.
* Fixed an issue where "FindSuppressor" would return a boolean instead of empty string.
* Fixed an issue with undefined variable when "DMS_ai_offloadOnUnfreeze" was set to true.
* Added debug message when a group is frozen.
* Created a new function "DMS_fnc_FreezeToggle" that actually handles freezing/unfreezing.
* DMS will now apply a variable "DMS_isGroupFrozen" to groups that are frozen.
#### May 22, 2016 (12:00 AM CST-America):
* **NEW CONFIG VALUES:**
DMS_ai_allowFreezing