Looping a Timed Task in Many Objects
Posted: Wed Nov 22, 2017 7:30 am
I am trying to create a plugin where I have several entities in my map, (Instantiated through my Zone class), and I want these Zones to draw and redraw their outline beams periodically. I don't need the timing to be super precise, I just need it to be reliably recalled repeatedly throughout the lifetime of the Zone object. I am wondering what is the best way to achieve this. I would prefer if the behaviour could be contained within the Zone class itself, rather than calling it for each current Zone object through a master loop such as @OnTick. I have so far tried using time.sleep() and asyncio.sleep(), but both of these functions cause the server to time-out.
Another way to reach my end goal would be if I could spawn the beams to last forever, then manually destroy them if the Zone is removed, but I am not sure if this is possible or if it will cause issues for players who join after the Zones are first created.
Thanks, Disco
Another way to reach my end goal would be if I could spawn the beams to last forever, then manually destroy them if the Zone is removed, but I am not sure if this is possible or if it will cause issues for players who join after the Zones are first created.
Thanks, Disco