Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unshift in Scheduler #159

Open
st33d opened this issue Mar 13, 2019 · 1 comment
Open

Unshift in Scheduler #159

st33d opened this issue Mar 13, 2019 · 1 comment
Assignees

Comments

@st33d
Copy link

st33d commented Mar 13, 2019

The Scheduler as is can only push entities to its stack. If I want to change the order of entities acting then I am forced to hack this into the engine. I can’t just modify the speed - if I want a new entity to act first then I have to push a silent turn on all other entities to get there, which is a bigger hack than modifying ROT.js. I needed this hack for player summoned entities that copy the player’s moves - they must act before the monsters, because the player will assume they follow the same rules as themselves.

My hack of ROT.js is used in my game No’hanz:
https://st33d.itch.io/nohanz

I’ve used an old version of ROT.js as I was building on top of an engine of mine from 2015 and didn’t want to deal with any changes that would be easy to miss. I’ve basically duplicated the Event scheduler stack push and rewritten it to an unshift, then I’ve repeated that operation down to the Speed Scheduler which was all I needed.

Being able to request and load arrays of entities would also be useful for games that do some hacking with turn order.

@ondras ondras self-assigned this Mar 13, 2019
@ondras
Copy link
Owner

ondras commented Mar 15, 2019

It looks like the behavior depends on the scheduler type:

  • Simple just rotates the queue, so unshift translates to unshifting the queue;
  • Speed is problematic, because the underlying EventQueue cannot be really cheated by re-ordering;
  • Action basically already has this, because the newly inserted actor can be specified with a duration of 0, effectively jumping the queue.

I assume you would like this functionality for the Speed scheduler, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants