Class PetSystem
- Namespace
- FishMMO.Server.Implementation.World.SceneServer
- Assembly
- FishMMO.Server.dll
Manages pet-related server logic, including pet summoning, following, staying, releasing, and persistence. Handles pet broadcasts, character events, and pet AI initialization for player characters. Game logic and Broadcasts run synchronously on the main thread. Database operations are async to avoid blocking the main thread. Results from async DB queries that require main-thread state changes or Broadcasts are marshalled via IPetSystemMainThreadQueueData.
[CreateAssetMenu(fileName = "PetSystem", menuName = "FishMMO/Server/SceneServer/Pet System", order = 1)]
[RequiresDataContainer(typeof(PetSystemMainThreadQueueData))]
[RequiresDataContainer(typeof(PetSystemRuntimeData))]
[RequiresDataContainer(typeof(AsyncWorkerData))]
public class PetSystem : ServerBehaviour, IServerBehaviour<INetworkManagerWrapper, ServerManager, NetworkConnection, IServerBehaviour>, IServerComponent<INetworkManagerWrapper, ServerManager, NetworkConnection, IServerBehaviour>, IPetSystem, IServerBehaviour, IServerComponent
- Inheritance
-
ObjectScriptableObjectPetSystem
- Implements
- 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.nameObject.hideFlags
Fields
PetSummonAchievementTemplate
[Header("Achievements")]
public AchievementTemplate PetSummonAchievementTemplate
Field Value
Methods
InitializeOnce()
Called once to initialize the pet system. Registers broadcast handlers and subscribes to character and ability events.
public override ServerComponentInitializationStatus InitializeOnce()
Returns
OnDeinitialize()
Called when the system is being destroyed. Unregisters broadcast handlers and unsubscribes from character and ability events.
public override void OnDeinitialize()
OnUpdate(float)
Drains the main-thread queue each frame.
protected override void OnUpdate(float deltaTime)
Parameters
deltaTimefloat
PersistedAttributesFor(IReadOnlyList<CharacterPetAttributeData>, int, long)
The attribute values to stage onto the pet restored from slot: only rows of that slot written
alongside its pet row (same version); null when there are none. Pure.
public static List<PetPersistedAttribute> PersistedAttributesFor(IReadOnlyList<CharacterPetAttributeData> rows, int slot, long petVersion)
Parameters
rowsIReadOnlyList<CharacterPetAttributeData>slotintpetVersionlong
Returns
Remarks
A row carrying another version belongs to a pet that has since been dismissed from the slot, and a previous pet may well have known an attribute this one does not. Matching the version is what keeps a hunter's new wolf from inheriting the mana pool of the elemental it replaced; matching the slot keeps two pets out at once apart.
PersistedBuffsFor(IReadOnlyList<CharacterPetBuffData>, int, long)
The buffs to stage onto the pet restored from slot; see PersistedAttributesFor(IReadOnlyList<CharacterPetAttributeData>, int, long). Pure.
public static List<PetPersistedBuff> PersistedBuffsFor(IReadOnlyList<CharacterPetBuffData> rows, int slot, long petVersion)
Parameters
rowsIReadOnlyList<CharacterPetBuffData>slotintpetVersionlong