mirror of
https://github.com/burrow-dev/burrow-server.git
synced 2026-11-18 17:27:50 -05:00
fix(avatars): switching animals no longer copies the new one over the old
Since3423df1the server followed an animal switch ("as") with that animal's "ad" and full "il". The client swaps animals partway through the transform animation: at "hideAvatar" it copies the in-world avatar into the switcher slot being left, then loads the new animal onto the in-world one. The extra "ad" arrived before that frame, had no request waiting for it, and so was applied to the in-world avatar, and the "il" then matched it too. The slot got a copy of the new animal, the old one was gone from the switcher, and the other slots drew blank until the next login. This reverts3423df1. A newly bought animal's editor not opening until the next login comes back with it and needs a fix that goes through the client's own "ad" request. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
6b707fbc1d
commit
494f252c5b
3 files changed
+7
-13
No files matched your search
+7
-8
@@ -25,7 +25,7 @@ const validNameBarData = (value, account) => Number.isInteger(value) && value >=
|
||||
&& badges.mayWear(account, defpacks.badgeIds()[value >> 8 & 0xFF]) // the ones the admin gives: lib/badges.js
|
||||
&& (value >> 16) <= 1;
|
||||
|
||||
module.exports = ({others, findOnline, findBySfsId, refreshForOthers, petFields, sendAvatarData, sendItemList}) => {
|
||||
module.exports = ({others, findOnline, findBySfsId, refreshForOthers, petFields}) => {
|
||||
// A player's card: who they are, the animal they are using and what it
|
||||
// wears. AvatarXtCommManager.avatarGetResponse reads [username, uuid,
|
||||
// status, accountType, isGuide, daysSinceLogin, perUserAvId, avInvId,
|
||||
@@ -97,13 +97,12 @@ module.exports = ({others, findOnline, findBySfsId, refreshForOthers, petFields,
|
||||
const messageRoom = session.room ? session.room.id : -1;
|
||||
const common = [1, session.id, avatar.perUserAvId, avatar.avInvId, avatar.customAvId, avatar.type, ...avatar.colors, avatar.name];
|
||||
session.sendXt("as", messageRoom, ...common, avatar.petInvId, avatar.questLevel || 0);
|
||||
// Switching changes the active animal, but the client keeps a separate
|
||||
// editor model for each avatar. Refresh both parts of that model here:
|
||||
// otherwise a newly bought animal can be shown in the switcher while its
|
||||
// clothing inventory was never populated, leaving the editor unable to
|
||||
// open until the player signs in again.
|
||||
sendAvatarData(session, session, avatar.perUserAvId);
|
||||
sendItemList(session, session, true, avatar.perUserAvId);
|
||||
// Nothing more goes to the switching player here. The client swaps the
|
||||
// animals during the transform animation (AvatarSwitch "hideAvatar"),
|
||||
// copying the in-world avatar into the switcher slot first and asking
|
||||
// for "ad" itself when it needs to. An unasked "ad"/"il" lands on the
|
||||
// in-world avatar before that copy, so the old animal vanished from the
|
||||
// switcher and the new one showed twice.
|
||||
if (session.pos) {
|
||||
for (const other of others(session)) {
|
||||
other.sendXt("as", messageRoom, ...common, ...petFields(activePet(account)), avatar.questLevel || 0);
|
||||
|
||||
@@ -1338,7 +1338,6 @@ const context = {
|
||||
findOnline,
|
||||
findBySfsId,
|
||||
sendItemList,
|
||||
sendAvatarData,
|
||||
sendAvatarCreate,
|
||||
refreshForOthers,
|
||||
petFields,
|
||||
|
||||
Reference in new issue
Block a user