Dallinger / Griduniverse

Welcome to the Griduniverse.
7 stars 3 forks source link

WIP: Transition Implementation #253

Closed alecpm closed 1 year ago

alecpm commented 1 year ago

This PR implements various aspects of stories #236, #241, and #237, and provides the basic functionality that's needed for the transition related aspects of #234.

It provides the following actions triggered by pressing the space bar:

There's also a new action executed with by pressing the d key:

We provide a simple display of the currently held item and a mechanism for determining transition visibility. A transition can set its visible attribute to always, never, or seen. This does not attempt to provide information about available transitions or the item on the current square in the UI.

The client side can look up the currently available transition using transition = player.getTransition() and can determine if the transition has been seen by the current player by checking transitionsSeen.has(transition.id).

If the server side encounters an error when executing an action it will send an action_error notification with player_id, position, player_item, item properties which can be used to reset the state on the client side. Resetting state is not yet implemented (and may not need to be implemented, since it will be reset eventually by the game state sync).

Experiment changes:

Notes:

alecpm commented 1 year ago

@jessesnyder I hope this implementation hasn't violated the expectations you might have had when implementing transition display for #234, and isn't too difficult to integrate into your work.

@silviot It would probably be a good idea to write some tests for these new handlers.

alecpm commented 1 year ago

@jessesnyder would you prefer I merge this now to make your work easier to rebase/merge or should I wait for @silviot to add tests and/or review further?