Merge branch 'master' into 20-06-24-movement-prediction
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.AI.Utils;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Server.GameObjects.Components.Power.Chargers;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
|
||||
namespace Content.Server.AI.WorldState.States.Combat.Nearby
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class NearbyLaserChargersState : StateData<List<IEntity>>
|
||||
{
|
||||
public override string Name => "NearbyLaserChargers";
|
||||
|
||||
public override List<IEntity> GetValue()
|
||||
{
|
||||
var nearby = new List<IEntity>();
|
||||
|
||||
if (!Owner.TryGetComponent(out AiControllerComponent controller))
|
||||
{
|
||||
return nearby;
|
||||
}
|
||||
|
||||
foreach (var result in Visibility
|
||||
.GetNearestEntities(Owner.Transform.GridPosition, typeof(WeaponCapacitorChargerComponent), controller.VisionRadius))
|
||||
{
|
||||
nearby.Add(result);
|
||||
}
|
||||
|
||||
return nearby;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.AI.Utils;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
|
||||
namespace Content.Server.AI.WorldState.States.Combat.Nearby
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class NearbyLaserWeapons : StateData<List<IEntity>>
|
||||
{
|
||||
public override string Name => "NearbyLaserWeapons";
|
||||
|
||||
public override List<IEntity> GetValue()
|
||||
{
|
||||
var result = new List<IEntity>();
|
||||
|
||||
if (!Owner.TryGetComponent(out AiControllerComponent controller))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
foreach (var entity in Visibility
|
||||
.GetNearestEntities(Owner.Transform.GridPosition, typeof(HitscanWeaponComponent), controller.VisionRadius))
|
||||
{
|
||||
result.Add(entity);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.AI.Utils;
|
||||
using Content.Server.GameObjects.Components.Movement;
|
||||
using Content.Server.GameObjects.Components.Weapon.Ranged;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
|
||||
namespace Content.Server.AI.WorldState.States.Combat.Nearby
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class NearbyRangedWeapons : CachedStateData<List<IEntity>>
|
||||
{
|
||||
public override string Name => "NearbyRangedWeapons";
|
||||
|
||||
protected override List<IEntity> GetTrueValue()
|
||||
{
|
||||
var result = new List<IEntity>();
|
||||
|
||||
if (!Owner.TryGetComponent(out AiControllerComponent controller))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
foreach (var entity in Visibility
|
||||
.GetNearestEntities(Owner.Transform.GridPosition, typeof(RangedWeaponComponent), controller.VisionRadius))
|
||||
{
|
||||
result.Add(entity);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.AI.WorldState.States.Combat.Ranged
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class Accuracy : StateData<float>
|
||||
{
|
||||
public override string Name => "Accuracy";
|
||||
|
||||
public override float GetValue()
|
||||
{
|
||||
// TODO: Maybe just make it a SetValue (maybe make a third type besides sensor / daemon called settablestate)
|
||||
return 1.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.AI.WorldState.States.Combat.Ranged
|
||||
{
|
||||
/// <summary>
|
||||
/// How long to wait between bursts
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
public sealed class BurstCooldown : PlanningStateData<float>
|
||||
{
|
||||
public override string Name => "BurstCooldown";
|
||||
public override void Reset()
|
||||
{
|
||||
Value = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using Content.Server.GameObjects;
|
||||
using Content.Server.GameObjects.Components.Weapon.Ranged.Hitscan;
|
||||
using Content.Server.GameObjects.Components.Weapon.Ranged.Projectile;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.AI.WorldState.States.Combat.Ranged
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the discrete ammo count
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
public sealed class EquippedRangedWeaponAmmo : StateData<int?>
|
||||
{
|
||||
public override string Name => "EquippedRangedWeaponAmmo";
|
||||
|
||||
public override int? GetValue()
|
||||
{
|
||||
if (!Owner.TryGetComponent(out HandsComponent handsComponent))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var equippedItem = handsComponent.GetActiveHand?.Owner;
|
||||
if (equippedItem == null) return null;
|
||||
|
||||
if (equippedItem.TryGetComponent(out HitscanWeaponComponent hitscanWeaponComponent))
|
||||
{
|
||||
return (int) hitscanWeaponComponent.CapacitorComponent.Charge / hitscanWeaponComponent.BaseFireCost;
|
||||
}
|
||||
|
||||
if (equippedItem.TryGetComponent(out BallisticMagazineWeaponComponent ballisticComponent))
|
||||
{
|
||||
return ballisticComponent.MagazineSlot.ContainedEntities.Count;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using JetBrains.Annotations;
|
||||
|
||||
namespace Content.Server.AI.WorldState.States.Combat.Ranged
|
||||
{
|
||||
/// <summary>
|
||||
/// How many shots to take before cooling down
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
public sealed class MaxBurstCount : PlanningStateData<int>
|
||||
{
|
||||
public override string Name => "BurstCount";
|
||||
public override void Reset()
|
||||
{
|
||||
Value = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user