* ECS

* A

* parity

* Remove dummy update

* abs

* thanks rider
This commit is contained in:
metalgearsloth
2022-07-25 14:57:33 +10:00
committed by GitHub
parent 3fb9b4a480
commit aad6a22a6a
40 changed files with 482 additions and 531 deletions

View File

@@ -0,0 +1,7 @@
namespace Content.Server.AI.Components;
/// <summary>
/// Added to NPCs that are actively being updated.
/// </summary>
[RegisterComponent]
public sealed class ActiveNPCComponent : Component {}

View File

@@ -1,60 +0,0 @@
using Content.Server.AI.EntitySystems;
using Content.Server.Station.Systems;
using Content.Shared.Movement.Components;
using Content.Shared.Roles;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
namespace Content.Server.AI.Components
{
[RegisterComponent]
[Virtual]
public class AiControllerComponent : Component
{
[DataField("logic")] private float _visionRadius = 8.0f;
// TODO: Need to ECS a lot more of the AI first before we can ECS this
/// <summary>
/// Whether the AI is actively iterated.
/// </summary>
public bool Awake
{
get => _awake;
set
{
if (_awake == value) return;
_awake = value;
if (_awake)
EntitySystem.Get<NPCSystem>().WakeNPC(this);
else
EntitySystem.Get<NPCSystem>().SleepNPC(this);
}
}
[DataField("awake")]
private bool _awake = true;
[ViewVariables(VVAccess.ReadWrite)]
public float VisionRadius
{
get => _visionRadius;
set => _visionRadius = value;
}
/// <summary>
/// Is the entity Sprinting (running)?
/// </summary>
[ViewVariables]
public bool Sprinting { get; } = true;
/// <summary>
/// Calculated linear velocity direction of the entity.
/// </summary>
[ViewVariables]
public Vector2 VelocityDir { get; set; }
public virtual void Update(float frameTime) {}
}
}

View File

@@ -0,0 +1,17 @@
using Content.Server.AI.EntitySystems;
namespace Content.Server.AI.Components
{
[Access(typeof(NPCSystem))]
public abstract class NPCComponent : Component
{
// TODO: Soon. I didn't realise how much effort it was to deprecate the old one.
/// <summary>
/// Contains all of the world data for a particular NPC in terms of how it sees the world.
/// </summary>
//[ViewVariables, DataField("blackboardA")]
//public Dictionary<string, object> BlackboardA = new();
public float VisionRadius => 7f;
}
}