-
Couldn't load subscription status.
- Fork 0
feat: add isometric fleet template and world simulation #42
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| public boardShip(playerId: EntityId, shipId: EntityId, deckPosition?: Vector2): void { | ||
| const player = this.players.get(playerId); | ||
| const ship = this.ships.get(shipId); | ||
| if (!player || !ship) { | ||
| return; | ||
| } | ||
|
|
||
| const relativePosition = deckPosition ?? subtractVectors(player.position, ship.position); | ||
| ship.boardedPlayers[playerId] = relativePosition; | ||
| player.boardedShipId = shipId; | ||
| player.relativePosition = relativePosition; | ||
| player.position = addVectors(ship.position, relativePosition); | ||
| this.emit('player-moved', { type: 'player-moved', player }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove player from previous ship when boarding new one
When boardShip is called for a player who is already aboard another vessel, the code assigns the new boardedShipId and updates the new ship’s boardedPlayers map but never removes the player from the old ship’s boardedPlayers. The previous ship will continue to treat the player as boarded and, in tick, will keep updating their position and velocity even after they have moved to another ship. With two ships moving simultaneously the player’s state will be overwritten every frame, producing jitter and inconsistent world snapshots. Clear the player from the previous ship before assigning the new ship.
Useful? React with 👍 / 👎.
| }); | ||
|
|
||
| this.emit('ship-moved', { type: 'ship-moved', ship }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68ebba6b8f7c8325a0a5ba978029e685