(842e6af33) Human AI needs AITargets too (not much, but they are still useful). Therefor add Type property to AITargets, so that certain targets can be treated human only and others enemy only. Implement target filtering in the Enemy AI Controller.
This commit is contained in:
@@ -66,6 +66,22 @@ namespace Barotrauma
|
||||
public float MinSoundRange, MinSightRange;
|
||||
public float MaxSoundRange = float.MaxValue, MaxSightRange = float.MaxValue;
|
||||
|
||||
public TargetType Type { get; private set; }
|
||||
|
||||
public enum TargetType
|
||||
{
|
||||
Any,
|
||||
HumanOnly,
|
||||
EnemyOnly
|
||||
}
|
||||
|
||||
public string SonarLabel;
|
||||
|
||||
public bool Enabled = true;
|
||||
|
||||
public float MinSoundRange, MinSightRange;
|
||||
public float MaxSoundRange = float.MaxValue, MaxSightRange = float.MaxValue;
|
||||
|
||||
public Vector2 WorldPosition
|
||||
{
|
||||
get
|
||||
@@ -113,6 +129,11 @@ namespace Barotrauma
|
||||
MaxSightRange = element.GetAttributeFloat("maxsightrange", SightRange);
|
||||
MaxSoundRange = element.GetAttributeFloat("maxsoundrange", SoundRange);
|
||||
SonarLabel = element.GetAttributeString("sonarlabel", "");
|
||||
string typeString = element.GetAttributeString("type", "Any");
|
||||
if (Enum.TryParse(typeString, out TargetType t))
|
||||
{
|
||||
Type = t;
|
||||
}
|
||||
}
|
||||
|
||||
public AITarget(Entity e, float sightRange = -1, float soundRange = 0)
|
||||
|
||||
Reference in New Issue
Block a user