feat(scoreboard): add objectives, display slots and teams - #158
feat(scoreboard): add objectives, display slots and teams#158xRookieFight wants to merge 1 commit into
Conversation
nepinhum
left a comment
There was a problem hiding this comment.
plus:
- scoreboard refresh itself is hilariously heavy (rebuilds every display slot by removing & recreating the objective and resending all scores to the entire server)
| @@ -0,0 +1,50 @@ | |||
| module scoreboard | |||
|
|
|||
There was a problem hiding this comment.
I'm not convinced Team belongs in the core scoreboard implementation. And this PR turns scoreboard state into a server wide gameplay framework: membership now affects combat, name tags, formatting and potentially per viewer visibility.
There was a problem hiding this comment.
@bedrock-v/devs what do you think?
| mut entries := proto.ScorePacketEntries{} | ||
| mut id := i64(1) | ||
| for entry, value in scores { | ||
| entries << proto.ScoreEntryChangeFakePlayer{ |
There was a problem hiding this comment.
All entries are emitted as ScoreEntryChangeFakePlayer including list and belowname. Those slots need scores associated with actual player/entity identities and the protocol already has ScoreEntryChangePlayer / ScoreEntryChangeEntity for that. Won't belowname in particular fail to attach the score to the player model?
|
|
||
| // refresh_name_tags resends the name of every listed player, so a team's | ||
| // colour and prefix appear without them having to reconnect. | ||
| fn (mut h Hub) refresh_name_tags(names []string) { |
There was a problem hiding this comment.
refresh_name_tags() broadcasts SetActorDataPacket through the whole Hub. Shouldn't actor metadata updates follow the same visibility/world scoped path as other entity updates? Sessions in unrelated worlds may not even have this actor spawned.
Description
The scoreboard was a per-player sidebar of fake-player lines and nothing else: no objective anyone else could see, no other display slot, and no concept of a team.
/scoreboard objectives|players|teamscovers add, remove, list, setdisplay, set, add, reset, join, leave and option. Its messages are the vanilla ones.Related issue
Part of #143
Name tag visibility is stored and settable but not yet enforced per viewer: hiding a name from other teams means sending different metadata to different players, which the broadcast path does not do today.
Checklist
v -check .is cleanv test server/player,server/cmd/default, and the session combat/scoreboard/broadcast/entity-view/login tests are greenpub/capitalized exports, no import cycles, minimal comments)world_call/wr.submit/WorldTx), never through a global Hub actor