* 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,42 @@
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";
}