Class PetAbilityTemplate
ScriptableObject template for defining a pet ability, including prefab and spawn parameters.
[CreateAssetMenu(fileName = "New Pet Ability", menuName = "FishMMO/Character/Ability/Pet Ability", order = 1)]
public class PetAbilityTemplate : AbilityTemplate, ICachedObject, ITooltip
- Inheritance
-
ObjectScriptableObjectPetAbilityTemplate
- 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
- Extension Methods
Fields
MaxPets
How many pets this spell may keep out at once.
[Tooltip("How many pets this spell can keep out at once. The character's pet slots (one unless an archetype grants more) cap it; a summon past the limit replaces the oldest pet.")]
[Min(1)]
public int MaxPets
Field Value
Remarks
The character's pet slots cap it: one, unless an archetype grants more. A summon past either limit replaces the oldest pet in its way (IndexToReplace(IReadOnlyList<int>, int, int, int)).
OnSummonEvents
Summon effects this spell ships with, as a crafter would attach them.
[Header("Summon Events")]
[Tooltip("Summon effects built into this spell. They run on the server when the pet arrives, and the abilities they teach are learned by the pet.")]
public List<AbilityOnSummonEvent> OnSummonEvents
Field Value
Remarks
The summon counterpart of the base template's On Hit / On Spawn lists, which a summon never runs (IsCompatibleWith(AbilityTemplate)). Bundled effects run on every summon by this spell, and their PetAbilities join PetAbilities.
PetAbilities
Abilities the summoned pet starts knowing.
[Tooltip("Abilities the summoned pet starts with. Learned on summon and persisted.")]
public List<AbilityTemplate> PetAbilities
Field Value
Remarks
These are taught to the pet's IAbilityController on summon and persisted with it, so the pet keeps them across a log out. The pet prefab's own Abilities list is learned as well; use that for abilities every pet of this species has, and this list for abilities granted by the summoning spell.
PetPrefab
The prefab for the pet to be spawned.
public NetworkObject PetPrefab
Field Value
- NetworkObject
SpawnBoundingBox
The bounding box for spawning the pet.
public Vector3 SpawnBoundingBox
Field Value
- Vector3
SpawnDistance
The distance from the spawner to spawn the pet.
public float SpawnDistance
Field Value
Methods
AppendPetAbilityDescriptions(List<AbilityTemplate>, List<string>)
Appends one "your pet learns" line per teachable ability, skipping lines already present.
public static void AppendPetAbilityDescriptions(List<AbilityTemplate> templates, List<string> into)
Parameters
templatesList<AbilityTemplate>The abilities taught.
intoList<string>The list to append to.
BuildPetAbilityIDs(Ability, List<int>)
The ability template IDs a pet summoned by this spell is taught.
public List<int> BuildPetAbilityIDs(Ability summoningAbility, List<int> persisted)
Parameters
summoningAbilityAbilityThe cast that summoned the pet, or null on a restore.
persistedList<int>Ability template IDs restored from the database, or null on a fresh summon.
Returns
Remarks
The persisted list first (a pet restored at login keeps everything it was saved with, including abilities a crafted effect granted), then this spell's own PetAbilities, then what each summon effect teaches. Duplicates and abilities a pet cannot be taught are skipped.
The summon effects come from summoningAbility when there is one,
because that is the ability as the player crafted it: it holds this template's bundled
effects and the crafted ones. A restore has no cast, so it reads the bundled effects
from the template; the crafted grants it needs are already in the persisted list.
CanBeTaughtToPet(AbilityTemplate)
Whether a pet can be taught template.
public static bool CanBeTaughtToPet(AbilityTemplate template)
Parameters
templateAbilityTemplateThe ability to teach.
Returns
- bool
True when the ability can be taught to a pet.
Remarks
A summon spell cannot: only a player's cast reaches the pet system, so a pet casting one would spend its resources for nothing.
OnLoad(string, string, int)
Called when the pet ability is loaded. Calculates spawn parameters based on the prefab's collider.
public override void OnLoad(string typeName, string resourceName, int resourceID)
Parameters
OnValidate()
Flags authoring the server would ignore: effects a summon never runs, and grants a pet cannot be taught.
protected override void OnValidate()