-
Notifications
You must be signed in to change notification settings - Fork 327
IPVGO: Add support for highlighting nodes and adding small text #1996
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
Conversation
I almost want to say skip the text arg, and just have it support colors tbh. But maybe that's just me being mean. |
# Conflicts: # src/Go/effects/netscriptGoImplementation.ts # src/Go/ui/GoGameboardWrapper.tsx
The text arg is for adding a point value or relative score or whatever other label, as seen in many of the move highlighters/visualizers players have homebrewed |
@d0sboots Is there anything more you need for this one? a couple people have asked about the feature's status |
the status is "i should feel bad" |
src/Go/boardState/boardState.ts
Outdated
@@ -125,7 +125,7 @@ export function makeMove(boardState: BoardState, x: number, y: number, player: G | |||
|
|||
// Add move to board history | |||
boardState.previousBoards.unshift(boardStringFromBoard(boardState.board)); | |||
clearAllPointHighlights(); | |||
Go.clearAllPointHighlights(); |
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.
No, now you went back to the other issue :(
The fundamental problem here is a muddying of the waters between boardState and the top-level state. The top-level state is a singleton which contains a single boardState, but this doesn't mean that boardState itself is a singleton. It is entirely possible for multiple boardStates to exist simultaneously, and indeed I believe this occurs when the analysis functions get involved with user-provided boards.
You can view the highlight info as either being a UI thing (thus belonging to the top-level state) or as belonging to boardState; both are valid perspectives. But if it's the former, then you can't change the UI just because a move was made on any board, it has to be only for moves made on the board of the top-level state. Conversely, if it belongs to boardState then clearAllPointHighlights also needs to belong to boardState. (It's OK for it to trigger GoEvents.emit
even for boardStates that aren't being shown, since that's idempotent.)
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.
I have refactored this so that the highlighting methods are standalone utilities under the analysis file, and they take a boardstate to add or remove highlights from. When a move is made or passed on a board, the highlights for that specific boar is cleared.
The netscript api access for these utilities applies them to the current ui by passing the current board state to these utilities.
Adds new API methods to go.analytics to allow for adding colored indicators and/or text to nodes by player scripts.
Can be tested at https://ficocelliguy.github.io/bitburner-src/
My testing script that makes it rave mode: