dragonfly icon indicating copy to clipboard operation
dragonfly copied to clipboard

Implement entity riding

Open NeutronicMC opened this issue 3 years ago • 4 comments

Entities with the ability to ride other entities implement the Rider interface

Entities with the ability to be ridden implement the Rideable interface

  • Entities have a configurable number of seats, and the seats have individually configurable positions
  • When a Rider dismounts, all other current riders are reseated and a new driver is selected based on the order that they mounted the entity

Player implements the Rider interface

I've tested all of these changes

NeutronicMC avatar Nov 10 '21 08:11 NeutronicMC

So most of this PR looks good now, I just have one concern, which is Rideable.RemoveRider vs Player.DismountEntity. We expose two functions that (should) do the same, but one of them (Rideable.RemoveRider) is incomplete in the sense that it doesn't actually properly dismount the entity that is riding it. The same problem exists with Rideable.AddRider and Rider.MountEntity. I'm not personally sure how to fix this, do you have any ideas?

Sandertv avatar Nov 27 '21 10:11 Sandertv

I'm not sure how I would change that other than making the method names and descriptions more specific. The player needs to contain some sort of function to send packets to link entities as well as store the entity that it is mounted to. The entity needs to store all of the currently mounted players. I can't move most of the functionality into either method because it's specific to the scope of each interface. If you have any better ideas I'd be willing to try them out, but as far as I can tell this implementation works the best.

NeutronicMC avatar Nov 27 '21 23:11 NeutronicMC

Any update on this?

JustTalDevelops avatar Jul 10 '22 19:07 JustTalDevelops

As Sander suggested on Discord, a good alternative is probably some sort of entity.Mount(some Entity, on Entity) function.

JustTalDevelops avatar Jul 14 '22 20:07 JustTalDevelops