azalea-rs / azalea

A collection of Rust crates for making Minecraft bots, clients, and tools.
https://azalea.matdoes.dev
MIT License
399 stars 50 forks source link

`SwarmEvent` should have either a periodic or “tick” option. #87

Open Mythbusters123 opened 1 year ago

Mythbusters123 commented 1 year ago

Right now, the events that a bot swarm has consists of Login, Init, Disconnect, and Chat. However, there should also be an Interval or Tick event, for when you want to do something with the swarm (like add a new account) and not have to wait for an event like Chat or Disconnect to be triggered, but rather have a period event that will go off.

mat-1 commented 1 year ago

If you make a plugin you can add .in_schedule(CoreSchedule::FixedUpdate) to a system to make it run every tick (see https://github.com/mat-1/azalea/blob/main/azalea/src/pathfinder/mod.rs#L40)

You're right though, right now there is no way to do this without a plugin and there should be.

Mythbusters123 commented 1 year ago

I think there should just be a period_interval_time(Duration) method in SwarmBuilder. Possibly also with a Tick event. I'd love to try and implement this, but I currently do not have substantial knowledge with the inner workings of this library.