Skip to content

Pets on Transports#271

Merged
billy1arm merged 1 commit intomangoszero:masterfrom
bozimmerman:pets_on_transports
Mar 9, 2026
Merged

Pets on Transports#271
billy1arm merged 1 commit intomangoszero:masterfrom
bozimmerman:pets_on_transports

Conversation

@bozimmerman
Copy link
Contributor

@bozimmerman bozimmerman commented Mar 9, 2026

Allows Pets to board and ride boats, trams, lifts, and all other transports. It handles on-transport summons and loads from db. While it uses a similar snap-to-position method to get the Pets on-board (as Bots on Boats did), it also supports following logic, so the Pet may follow its master around the boat in a somewhat natural way. As Mangos lacks mesh info for boats, the following is brute-force, but still looks great imho.

IOW, the implementation of Pets on Transports is better than Bots on Transports, and darn near perfect, but probably needs some minor tweeks in the future to reach perfect parity with old WoW.


This change is Reviewable

Copilot AI review requested due to automatic review settings March 9, 2026 18:33
@Meltie2013
Copy link
Contributor

@bozimmerman Thanks for your PR fixes! Here's a cookie for your hard work! 🍪

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enables pets (hunter pets, warlocks' demons, etc.) to board and ride transports (boats, trams, lifts). It handles boarding from a running summon during transport, loading from the database when the owner is already on a transport, and per-tick following logic so the pet moves naturally around the transport in transport-relative space. An early-return guard in UpdateVisibilityOf prevents the pet from being erroneously unsummoned when it goes out of standard grid range while on a transport.

Changes:

  • Added UpdateCreaturePassengerPositions() to Transport, called each GlobalTransport::Update() tick to relocate creature passengers to match the transport's world position.
  • Added Pet::UpdateTransport() (per-tick boarding/disembarking), Pet::HandleTransportFollow() (transport-relative follow movement), and transport state initialization in Pet::LoadPetFromDB().
  • Added visibility guards in Player::UpdateVisibilityOf() and transport cleanup in Player::UnsummonPetTemporaryIfAny().

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/game/WorldHandlers/Transports.h Declares UpdateCreaturePassengerPositions() as protected helper
src/game/WorldHandlers/Transports.cpp Implements UpdateCreaturePassengerPositions(); refactors TeleportTransport to use a snapshot vector to avoid iterator invalidation
src/game/WorldHandlers/MovementHandler.cpp Trivial blank-line addition
src/game/Object/Player.cpp Adds visibility guards for pets on transports; adds transport cleanup in UnsummonPetTemporaryIfAny
src/game/Object/Pet.h Declares transport state fields and new methods
src/game/Object/Pet.cpp Implements UpdateTransport, HandleTransportFollow, and transport-aware loading in LoadPetFromDB; adds cleanup in Unsummon
src/game/Object/Creature.h Declares HandleTransportFollow virtual method (no-op default)
src/game/MotionGenerators/TargetedMovementGenerator.cpp Intercepts follow movement for transport passengers and delegates to HandleTransportFollow

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AppVeyorBot
Copy link

@AppVeyorBot
Copy link

@billy1arm billy1arm merged commit 2ec8982 into mangoszero:master Mar 9, 2026
8 checks passed
@bozimmerman bozimmerman deleted the pets_on_transports branch March 10, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

5 participants