Table of Contents

Class AIBrainCatalogue

Namespace
FishMMO.Server.Implementation.World.SceneServer.AI
Assembly
FishMMO.Server.dll

Which brain each NPC prefab runs.

[CreateAssetMenu(fileName = "AIBrainCatalogue", menuName = "FishMMO/Server/AI/Brain Catalogue", order = 0)]
public class AIBrainCatalogue : ScriptableObject
Inheritance
Object
ScriptableObject
AIBrainCatalogue
Inherited Members
ScriptableObject.SetDirty()
ScriptableObject.CreateInstance<T>()
Object.GetEntityId()
Object.MemberwiseClone()
Object.GetInstanceID()
Object.GetHashCode()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion)
Object.Instantiate(Object, Vector3, Quaternion, Transform)
Object.Instantiate(Object)
Object.Instantiate(Object, Scene)
Object.Instantiate<T>(T, InstantiateParameters)
Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)
Object.Instantiate(Object, Transform)
Object.Instantiate<T>(T)
Object.Instantiate<T>(T, Vector3, Quaternion)
Object.Instantiate<T>(T, Vector3, Quaternion, Transform)
Object.Instantiate<T>(T, Transform)
Object.Destroy(Object)
Object.DestroyImmediate(Object)
Object.DontDestroyOnLoad(Object)
Object.DestroyObject(Object)
Object.FindObjectsOfType<T>()
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindObjectOfType<T>()
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Object.FindObjectsByType<T>()
Object.FindObjectsByType<T>(FindObjectsInactive)
Object.ToString()
Object.name
Object.hideFlags

Remarks

The server-side half of an NPC. The prefab is shared with clients and carries only the body, so the brain it is spawned with — its archetype, and a boss script when it is an encounter — is looked up here, by prefab, when the server spawns it. A spawner may still override the archetype for one placement.

Lives in a server-only addressable group together with every archetype, state, personality and boss script it references, so none of that reaches a client build.

Fields

Entries

Every NPC prefab's brain. One entry per prefab.

public List<AIBrainCatalogue.Entry> Entries

Field Value

List<AIBrainCatalogue.Entry>

Properties

UnreachableEntryCount

Entries whose prefab has no asset path hash yet, which a lookup can never reach.

public int UnreachableEntryCount { get; }

Property Value

int

Methods

FindByReference(NetworkObject)

Finds the entry authored for a prefab asset by reference, without relying on its hash.

public AIBrainCatalogue.Entry FindByReference(NetworkObject prefab)

Parameters

prefab NetworkObject

The prefab asset.

Returns

AIBrainCatalogue.Entry

The entry, or null.

Remarks

For editor tooling, where a prefab that is not yet in FishNet's spawnable collection has no asset path hash, or still carries the one of the prefab it was copied from.

Invalidate()

Drops the lookup so the next query rebuilds it from Entries.

public void Invalidate()

TryGetEntry(NetworkObject, out Entry)

Finds the entry for a spawned NPC, or for an NPC prefab asset.

public bool TryGetEntry(NetworkObject networkObject, out AIBrainCatalogue.Entry entry)

Parameters

networkObject NetworkObject

A spawned NPC or an NPC prefab.

entry AIBrainCatalogue.Entry

The entry, when there is one.

Returns

bool

True when the prefab has an entry.

Remarks

Keyed by FishNet's FishNet.Object.NetworkObject.AssetPathHash, which a pooled instance carries from the prefab it was instantiated from. FishNet sets it at edit time, never changes it at runtime, and refuses a prefab collection in which two prefabs share one.

Not the prefab id. The id is re-assigned when the spawnable collection initialises, and the value serialized on a prefab asset can be stale — two shipped NPC prefabs carried the same one — so a lookup built from it before the collection initialised would hand one NPC another's brain.