Skip to content

Commit

Permalink
Merge branch 'release/3.2.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
Freddo3000 committed Mar 26, 2019
2 parents 5bd93e3 + 250eb84 commit 85478f8
Show file tree
Hide file tree
Showing 68 changed files with 1,929 additions and 585 deletions.
447 changes: 228 additions & 219 deletions Vcom/FSMS/fn_SQUADBEH.fsm

Large diffs are not rendered by default.

418 changes: 418 additions & 0 deletions Vcom/FSMS/fn_UNITSUPPRESSION.fsm

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ if (count _assignedPairs isEqualTo 0) exitWith {};
private _assignedGunner = assignedGunner _weap;
if (isNull _assignedGunner) then
{
_unit enableAI "PATH"; //Overwrites garrison
_unit doMove (getposATL _weap);
_unit assignAsGunner _weap;
[_unit] orderGetIn true;
Expand Down
56 changes: 56 additions & 0 deletions Vcom/Functions/VCM_Functions/actions/fn_ClearBuilding.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

/*
Author: Genesis
Description:
Orders group to clear building
Parameter(s):
0: GROUP - Clearing group
1: OBJECT - Enemy to clear out
Returns:
STRING
*/

params ["_group","_enemy"];

private _building = (nearestObject [_enemy, "House"]);

private _buildingPositions = [_building] call BIS_fnc_buildingPositions;

// Not enterable
if (count _buildingPositions < 3) exitWith {};

private _bbr = boundingBoxReal _building; // TODO: Replace 'boundingBoxReal' with '0 BoundingBoxReal' on devbranch
private _p1 = _bbr select 0;
private _p2 = _bbr select 1;
// Check if unit is inside of the closest building
if
!(
_enemy inArea
[
getPos _building, // Center of building
(abs ((_p2 select 0) - (_p1 select 0)) / 2), // Maximum Width / 2
(abs ((_p2 select 1) - (_p1 select 1)) / 2), // Maximum Length / 2
getDir _building, // Building facing
true // Is rectangular
]
) exitWith {};

if VCM_Debug then {systemChat format ["VCOM: %1 clearing out %2", _group, _enemy]};

private _finalPositions = [];
_finalPositions = (_buildingPositions inAreaArray [getPosATL _enemy, 3, 3, 0, false, 1.5]);

if (_finalPositions isEqualTo []) then
{
// Settle for the three closest
private _temp = [_buildingPositions, [], {_x distance _enemy}] call BIS_fnc_sortBy;
for "_i" from 0 to 2 do {_finalPositions pushBack (_temp select _i)};
};

{
doStop _x;
_x doMove selectRandom _finalPositions;
} foreach (units _group);
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,13 @@
BOOLEAN - If unit able to treat self: TRUE, else FALSE
*/

private "_rtrn";
private _rtrn = false;

if (alive _this && {"FirstAidKit" in items _this} && {{_x > 0.25} count (getAllHitPointsDamage _this select 2) != 0}) then
{
_this action ["HealSoldierSelf", _this];
if VCM_DEBUG then {systemChat format ["VCOM: %1 healing self", _this]};
_rtrn = true;
} else
{
_rtrn = false;
};

_rtrn
69 changes: 69 additions & 0 deletions Vcom/Functions/VCM_Functions/actions/fn_RqstReinforce.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
Author: Freddo
Description:
Makes unit request support.
Parameter(s):
GROUP - Group that is requesting support.
Returns:
BOOLEAN
*/

private _group = _this;
private _leader = leader _group;
private _rtrn = false;

if (!(_group call VCM_fnc_GroupHasRadio) || _group getVariable ["VCM_TOUGHSQUAD", false]) exitWith {_rtrn};

// Calculate enemy forces value
private _knownEnemyG = ([_leader, 500, false] call VCM_fnc_KnownEnemyGroupArray);
private _enemyValue = 0;
{
_enemyValue = _enemyValue + (_x call VCM_fnc_GroupValue);
}forEach _knownEnemyG;

// Add a bit of +- inaccuracy
_enemyValue = (_enemyValue * (0.75 + random 0.5));

// Calculate friendly forces value in vincinity
private _knownFriendlyG = ([_leader, false, 500] call VCM_fnc_FriendlyGroupArray);
private _friendlyValue = 0;
{
_friendlyValue = _friendlyValue + (_x call VCM_fnc_GroupValue);
}forEach _knownFriendlyG;

// Friendly forces are superior to enemies
if ((_friendlyValue * 1.25) > _enemyValue) exitWith {_rtrn};

if VCM_DEBUG then {systemChat format ["VCOM: %1 calling for support", _group]};

// Find eligible groups
private _targetValue = (_enemyValue - (_friendlyValue * 1.25));
private _eligibleSquads = [];
private _eligibleSquadsValue = 0;
{
if (_eligibleSquadsValue > _targetValue) exitWith {};
if (_x call VCM_fnc_CanReinforce) then
{
_eligibleSquadsValue = (_eligibleSquadsValue + (_x call VCM_fnc_GroupValue));
_eligibleSquads pushBack _x;
};
} forEach ([_leader, true, VCM_WARNDIST] call VCM_fnc_FriendlyGroupArray);

if (count _eligibleSquads isEqualTo 0) exitWith {_rtrn};

//Create waypoints
{
if !(_x call VCM_fnc_CheckSituation isEqualTo "REINFORCE") then {
private _leader = leader _x;
if VCM_DEBUG then {systemChat format ["VCOM: %1 moving to reinforce %2", _x, _group]};
private _wp = (_x addWaypoint [position _leader, 100]);
_wp setWaypointSpeed "FULL";
if (behaviour _leader isEqualTo "SAFE") then {_x setBehaviour "AWARE"};
[_x, "REINFORCE"] call VCM_fnc_SetSituation;
};
}forEach _eligibleSquads;
_rtrn = true;
_rtrn
File renamed without changes.
50 changes: 0 additions & 50 deletions Vcom/Functions/VCM_Functions/fn_ClearBuilding.sqf

This file was deleted.

23 changes: 0 additions & 23 deletions Vcom/Functions/VCM_Functions/fn_EnemyArray.sqf

This file was deleted.

122 changes: 0 additions & 122 deletions Vcom/Functions/VCM_Functions/fn_FrmChnge.sqf

This file was deleted.

Loading

0 comments on commit 85478f8

Please sign in to comment.