Skip to content

Conversation

@IIIaKa
Copy link
Contributor

@IIIaKa IIIaKa commented Feb 25, 2025

With the release of the February update, the RidableHorse and BaseRidableAnimal classes have been deprecated and replaced by RidableHorse2. However, all hooks and class fields remained in the old classes, even though the old horses are no longer present on the server.
This pull request migrates previous modifications and introduces three new hooks.

1. The OnRidableAnimalTow hook is called before attempting to tow a horse to siege weapons. Returning a non-null value overrides the default behavior.

object OnRidableAnimalTow(RidableHorse2 horse, BasePlayer player)
{
    Puts($"Player '{player.displayName}' is attempting to tow a horse(horse.net.ID.Value) to the siege weapon '{horse.towableEntity.TowEntity.net.ID.Value}'.");
    return null;
}

2. The OnRidableAnimalDetach hook is called before attempting to detach (untow) a horse from a siege weapon. Returning a non-null value overrides the default behavior.

object OnRidableAnimalDetach(RidableHorse2 horse, BasePlayer player)
{
    Puts($"Player '{player.displayName}' is attempting to detach a horse({horse.net.ID.Value}) from the siege weapon '{horse.towableEntity.TowEntity.net.ID.Value}'.");
    return null;
}

3. The OnSaddleSwap hook is called before attempting to switch the saddle between single and double. Returning a non-null value overrides the default behavior.

object OnSaddleSwap(RidableHorse2 horse, BasePlayer player, Item item)
{
    Puts($"Player '{player.displayName}' is attempting to swap the saddle on the horse({horse.net.ID.Value}) to '{item.info.displayName.english}'.");
    return null;
}

4. Fields of the classes that were not modified, as they were not found in RidableHorse2:

  • BaseRidableAnimal::currentVelocity
  • BaseRidableAnimal::lastInputTime
  • RidableHorse::totalDistance

4. Other changes:

  • Renamed the old hook OnHorseLead to OnRidableAnimalLead

@MrBlue
Copy link
Member

MrBlue commented Mar 5, 2025

As long as the classes still exist in the game I don't see a reason to remove the hooks/patches from it.
I'll be closing this pr in favor of #553, feel free to reopen this pr or create a new pr with the newly added hooks!

@MrBlue MrBlue closed this Mar 5, 2025
@IIIaKa IIIaKa mentioned this pull request Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants