Files
tbd-station-14/Content.Server/AI/EntitySystems/NPCSystem.Blackboard.cs
metalgearsloth aad6a22a6a ECS NPCs (#9941)
* ECS

* A

* parity

* Remove dummy update

* abs

* thanks rider
2022-07-25 14:57:33 +10:00

43 lines
1.0 KiB
C#

using System.Diagnostics.CodeAnalysis;
using Content.Server.AI.Components;
namespace Content.Server.AI.EntitySystems;
public sealed partial class NPCSystem
{
/*
/// <summary>
/// Tries to get the blackboard data for a particular key. Returns default if not found
/// </summary>
public T? GetValueOrDefault<T>(NPCComponent component, string key)
{
if (component.BlackboardA.TryGetValue(key, out var value))
{
return (T) value;
}
return default;
}
/// <summary>
/// Tries to get the blackboard data for a particular key.
/// </summary>
public bool TryGetValue<T>(NPCComponent component, string key, [NotNullWhen(true)] out T? value)
{
if (component.BlackboardA.TryGetValue(key, out var data))
{
value = (T) data;
return true;
}
value = default;
return false;
}
/*
* Constants to make development easier
*/
public const string VisionRadius = "VisionRadius";
}