HorseModData

This module handles the mod data of horses, by initializing and managing mod data associated with horses.

Require: require("HorseMod/HorseModData")

HorseMod.HorseModData.modDataKinds: table<string, HorseMod.ModDataKind<any>>
HorseMod.HorseModData.register<T>(
    name: string,
    initialiser?: fun(horse: IsoAnimal, modData: Partial<T>)
): (kind: HorseMod.ModDataKind<T>)

Registers a new kind of mod data.

Parameters:
  • name (string) – Unique name of the mod data kind. This must be globally unique.

  • initialiser? (fun(horse: IsoAnimal, modData: Partial<T>)) – Function to initialise the mod data kind. This will be called every time the mod data is accessed.

HorseMod.HorseModData.makeOrphan(horse: IsoAnimal): nil

Split the horse mod data from the horse and store it in the global mod data as a orphan mod data. This is usually needed when the horse gets removed from the world temporarly (e.g. when picked up by a player).

HorseMod.HorseModData.initialize(horse: IsoAnimal): nil

Initialises all mod data kinds for the given horse.

HorseMod.HorseModData.get<T>(horse: IsoAnimal, kind: HorseMod.ModDataKind<T>): (modData: T)

Returns mod data of a specific kind.

Mod data kinds

Below is a list of available mod data kinds associated with horses: