Repository navigation
feat: sync the local player's own profile (opt-in profile) - #346
Open
blevouschurverantunt wants to merge 1 commit into
Open
blevouschurverantunt wants to merge 1 commit into
blevouschurverantunt wants to merge 1 commit into
Conversation
New opt-in sync type `profile`: one `profile` event with level, xp, military_might and planetary_base_unlocked, plus the player's own uid. Source is the UserProfiles entity group the client already receives; other players' records are never read or forwarded. Sent at first sight and when level, Power or the Haven flag change. The server record's level is 0, so level is read from the in-memory local profile and can lag one response after a level-up. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Summary
Adds an opt-in sync type
profilethat emits oneprofileevent for the local player: level, XP, Power and the Haven-unlocked flag. Off by default; only sent to targets that enable it. Closes #345.Why: companion apps want the player's Power/level history next to the synced fleet without screenshots. No existing sync type carries either.
What changes
profileunder[sync]and per target (oneSyncOptionsrow,config.ccuntouched). English example only.UserProfilesentity group already reachesHandleEntityGroup. Withprofileon, the local user id andLevelare read on the game thread, then a worker finds the record with that id and queues the event. With it off, nothing changes. No new hook, no new server call.{"type":"profile","uid":"1234567890","level":48,"xp":123456789,"military_might":12345678,"planetary_base_unlocked":true}local_user_profile()is extracted fromplanetary_mapand reused; behaviour there is unchanged.prime/UserProfile.h:Levelproperty, same pattern asBattleResultHeader.Notes
levelis read from the in-memoryUserProfile.Level, because the server record carries 0. The hook runs before the client applies the response, so after a level-up the new level shows up with the next own-record response, one response late.xprides along but is not in the key: an XP-only change waits for the next keyed change.military_mightequals the HUD Power exactly.battleRatingandmaxWarpRangeare not sent: the record's values are not the displayed ones.havensync sends building rows and no explicit unlocked flag, soplanetary_base_unlockedis not a duplicate; it is the profile's own bit.Verified
Windows, client builds 272 and 273, live against a sync target: the record arrives at login and about 5 s after a Power change (server push);
military_mightmatched the HUD Power; 2 sends per 6-9 minute session. macOS not tested.Touched files
mods/src/patches/parts/sync.cc,mods/src/config.h,mods/src/defaultconfig.h,mods/src/prime/UserProfile.h,example_community_patch_settings_en.toml.Checks
Local Windows release build (MSVC, xmake), 0 warnings;
git diff --checkand clang-format on the changed ranges clean. No CHANGELOG, version or other-locale changes. Fork CI is unavailable to me this month, so the upstream workflow run is the gate.🤖 Generated with Claude Code