Claude/fix ai player stuck 9o81v#1155
Merged
Merged
Conversation
Root cause: In worker context, the Zustand store's localPlayerId defaults
to 'player1' and isn't synchronized with the main thread. When player1 is
set to AI, isLocalPlayer('player1') incorrectly returns true.
This caused:
- BuildingPlacementSystem to treat player1 AI as local human player
- Resource checks/deductions used wrong player store
- AI couldn't build structures after initial fabricators
Fix:
- Check if player is AI FIRST before checking isLocalPlayer
- AI players are never treated as local players for resource management
- Also fixed ProductionSystem to properly refund AI resources on cancel
https://claude.ai/code/session_01YXBQcx4CzdxB1d1umVjjyR
Continue fixing isLocalPlayer checks in worker context where the Zustand store's localPlayerId defaults to 'player1' and may incorrectly identify AI players as the local human player. Fixed systems: - SpawnSystem: Unit death supply reduction now checks AI first - WallSystem: Wall upgrade resource handling checks AI first - BuildingPlacementSystem: - Wall line placement checks AI first - Addon building checks AI first - Building completion supply checks AI first - Blueprint cancellation refund checks AI first Pattern: Always check if player is AI before checking isLocalPlayer() to prevent AI player1 from being incorrectly treated as local human. https://claude.ai/code/session_01YXBQcx4CzdxB1d1umVjjyR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.