Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_AIDecoTargetWithinTurretAimingLimits.c
Go to the documentation of this file.
2{
3 // Inputs
4 protected static const string PORT_TURRET_ENTITY = "TurretEntity";
5 protected static const string PORT_TARGET_POS = "TargetPos";
6
7 //---------------------------------------------------------------------
8 override bool TestFunction(AIAgent owner)
9 {
10 // Read inputs
11 IEntity turretEntity;
12 vector targetPos;
13 GetVariableIn(PORT_TURRET_ENTITY, turretEntity);
15
16 if (!turretEntity || !targetPos)
17 return false;
18
19 TurretComponent turretComp = TurretComponent.Cast(turretEntity.FindComponent(TurretComponent));
20 if (!turretComp)
21 return false;
22
23 vector aimingExcessDeg = turretComp.GetAimingAngleExcess(targetPos);
24 bool withinAimingLimits = aimingExcessDeg[0] == 0 && aimingExcessDeg[1] == 0;
25
26 return withinAimingLimits;
27 }
28
29 //---------------------------------------------------------------------
31 override TStringArray GetVariablesIn() { return s_aVarsIn; };
32
33 override static string GetOnHoverDescription() { return "Returns true if given position is within aiming limits of the TurretComponent attached to provided entity."; }
34}
proto external Managed FindComponent(typename typeName)
proto bool GetVariableIn(string name, out void val)
array< string > TStringArray
Definition Types.c:385