Skip to content

Commit

Permalink
Merge pull request #155 from IrLED/VCOM
Browse files Browse the repository at this point in the history
VCOM integration
  • Loading branch information
IrLED committed Dec 16, 2017
2 parents 5941c78 + 46be11d commit 0df0c6e
Show file tree
Hide file tree
Showing 102 changed files with 12,829 additions and 1,025 deletions.
Expand Up @@ -53,7 +53,9 @@ If (alive _npc) then
//{if (alive _x && leader _x != _x) then {_x dofollow (leader _x)};} foreach units _grp;
_grp setvariable ["UPSMON_RSTUCKCONTROL",0];
_stuck = true;

private _leader = leader _grp;
{_x forceSpeed -1; _x doFollow _leader;}count units _grp;

if (UPSMON_Debug>0) then {player sidechat format["%1 stucked, moving",_grp getvariable ["UPSMON_Grpid",0]]};
if (UPSMON_Debug>0) then {diag_log format["%1 stuck for %2 seconds - trying to move again",_grp getvariable ["UPSMON_Grpid",0]]};
};
Expand Down
Expand Up @@ -13,62 +13,66 @@ Returns:
nothing
****************************************************************/

private ["_units","_bldpos","_grp","_movein","_currpos","_attackpos","_unit","_patrolto","_time"];
private ["_units","_bldpos","_grp","_unit","_patrolto","_time"];

_units = _this select 0;
_bldpos = _this select 1;
_grp = _this select 2;
_time = _this select 3;

private _grpid = _grp getVariable "UPSMON_grpid";
_grp setVariable ["UPSMON_inbuilding",true];

private _exitPos = (leader _grp) getPos [30, random 360];
{_x forceSpeed -1; _x doMove getPos _x; false;}count _units;
sleep 0.1;
_units = [_units] call UPSMON_Getunits;
_movein = [];
if (count _units > 0) then
{
_currpos = getposATL (_units select 0);
_attackpos = _currpos;

If ("deletethis" in _bldpos) then {_bldpos = _bldpos - ["deletethis"]};
If (count _bldpos > 0) then
{
_attackpos = _bldpos select 0;
};

{
_unit = _x;
If (alive _unit) then
{
If (vehicle _unit == _unit) then
{
If (Unitready _unit) then
{
If ("deletethis" in _bldpos) then {_bldpos = _bldpos - ["deletethis"]};
If (count _bldpos > 0) then
{
_patrolto = _bldpos select 0;
_bldpos set [0,"deletethis"];
_bldpos = _bldpos - ["deletethis"];
Dostop _unit;
_unit domove _patrolto;
_unit setdestination [_patrolto,"LEADER PLANNED",true];
_movein pushback _unit;
};
};
};
};
} foreach _units;

sleep _time;

_time = (((_attackpos vectordistance _currpos)*1.2) + 5);

If (_grp getvariable ["UPSMON_Grpmission",""] != "PATROLINBLD" || _grp getvariable ["UPSMON_Grpmission",""] != "ASSAULT") exitwith {_grp setVariable ["UPSMON_inbuilding",false];};
if (count _units > 0) then {
_bldpos = _bldpos - ["sawThis"];

If (count _bldpos > 0 && count _units > 0) then
{
[_units,_bldpos,_grp,_time] call UPSMON_patrolBuilding;
};
private _countAlive = 1;
_time = time + (60 * count _bldpos);
while {_time > time AND count _bldpos > 0 AND _countAlive > 0 AND {_grp getvariable "UPSMON_Grpmission" isEqualTo "PATROLINBLD"}} do{
_countAlive = 0;
{
_unit = _x;
If (alive _unit) then
{
_countAlive = _countAlive + 1;
If (vehicle _unit == _unit) then
{
private _unitNum = _forEachIndex;
private _currPos = getPos _unit;
//What i see from current pos
private _eyePos = eyePos _unit;
{
private _aslPos = AGLToASL _x;
if (((lineIntersectsWith [_eyePos, _aslPos]) isEqualTo []) OR (_x vectordistance _currPos < 1)) then {
_bldpos set [_forEachIndex, "sawThis"];
};
}forEach _bldpos;
_bldpos = _bldpos - ["sawThis"];
//Stuck checkWWW
_currPos = getPos _unit;
private _lastPos = _unit getVariable ["UPSMON_PATROLINBLD_lastpos", _currPos];
_unit setVariable ["UPSMON_PATROLINBLD_lastpos", _currPos];
if (_lastPos vectordistance _currPos < 0.1) then {
//unstuck
If (count _bldpos > 0) then {
_patrolto = _bldpos select random count _bldpos;
doStop _unit;
_unit doMove _patrolto;
_unit setdestination [_patrolto,"LEADER PLANNED",true];
};
};
sleep 1;
};
};
} foreach _units;
sleep 2;
};
};

_grp setVariable ["UPSMON_inbuilding",false];
};
{_x forceSpeed -1; _x doMove _exitPos; false;}count _units;
sleep 30;
_grp setvariable ["UPSMON_bldposToCheck",nil];
_grp setVariable ["UPSMON_inbuilding",nil];
Expand Up @@ -37,8 +37,8 @@ _grpid = _grp getvariable ["UPSMON_Grpid",0];
_water = 0;

_grp setvariable ["UPSMON_searchingpos",true];
_closeenough = UPSMON_closeenough;

_closeenough = UPSMON_closeenough;
// get position of spotted unit in player group, and watch that spot

// angle from unit to target
Expand Down
Expand Up @@ -38,7 +38,7 @@ _grp setvariable ["UPSMON_searchingpos",true];

// angle from unit to target
_dir1 =[_currpos,_suspectPos] call BIS_fnc_DirTo;
_dir2 = [_suspectPos,_currpos] call BIS_fnc_DirTo;;
_dir2 = [_suspectPos,_currpos] call BIS_fnc_DirTo;

_suspectPos = [_suspectPos select 0,_suspectPos select 1,0];
If (("ship" in _typeofgrp) || ("air" in _typeofgrp)) then
Expand Down Expand Up @@ -97,6 +97,7 @@ If (count _bldpositions > 0) then
_bldpos = (_bldpositions select 1) select 0;
_grp setvariable ["UPSMON_Grpmission","PATROLINBLD"];
_grp setvariable ["UPSMON_bldposToCheck",_bldpos];
_wptype = "MOVE";
};
[_grp,_targetpos,_wptype,"COLUMN",_speedmode,_Behaviour,"YELLOW",_radius] call UPSMON_DocreateWP;
_grp setvariable ["UPSMON_searchingpos",false];

0 comments on commit 0df0c6e

Please sign in to comment.