Skip to content

Conversation

@LordMidas
Copy link
Member

@LordMidas LordMidas commented Apr 15, 2025

This a follow up from #276 which had certain valid criticism. Read the criticism on that in order to better make sense of the approach taken here.

Also note that the current onMovementStep in MSU is completely useless and in-fact misleading. So this PR should be considered a fix as well (or perhaps primarily a fix).

This makes the function actually useful. It allows skills to stop an actor's movement at a particular tile based on conditions defined in the skill's onMovementStep function. Note that onMovementStep is called before moving to a tile. As long as all skills' onMovementStep returns true or null, the movement is valid. Otherwise:

  • If even a single skill returns false, the movement is stopped at that tile prematurely.
  • The skill can also choose to return a function which will then be executed and also cause the movement to stop. This function can be useful for example for refunding complete or partial movement costs or to trigger any other effects.

Note: Only the first skill that returns a movement stopping condition is considered. Therefore, skill order is important.

This makes the function actually useful. It allows skills to stop an actor's movement at a particular tile based on conditions defined in the skill's `onMovementStep` function. Note that onMovementStep is called before moving to a tile. As long as all skills' onMovementStep returns true or null, the movement is valid. Otherwise:
- If even a single skill returns false, the movement is stopped at that tile prematurely.
- The skill can also choose to return a function which will then be executed and also cause the movement to stop. This function can be useful for example for refunding complete or partial movement costs or to trigger any other effects.

Note: Only the first skill that returns a movement stopping condition is considered. Therefore, skill order is important.
@LordMidas LordMidas requested a review from TaroEld April 15, 2025 00:49
@LordMidas LordMidas force-pushed the development branch 2 times, most recently from 6677ac8 to ae825b7 Compare June 17, 2025 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants