🐛 fix: don't mark self online on offline location events

This commit is contained in:
2026-06-30 23:27:10 +07:00
parent 68b2242787
commit d6d9c54ed6
+8 -1
View File
@@ -139,8 +139,15 @@ function subscribe(vrc: VRChat & Pipeline): void {
const d = asRecord(data);
const id = (d.userId ?? userOf(data).id) as string | undefined;
if (!id) return;
const loc = d.location as string | undefined;
const fromUser = patchFromUser(userOf(data)) ?? { id };
entityStore.upsert({ ...fromUser, id, location: d.location as string, state: "online" });
const offline = !loc || loc.startsWith("offline");
entityStore.upsert({
...fromUser,
id,
location: offline ? "offline" : loc,
state: offline ? "offline" : "online",
});
};
vrc.on("friend-location", location);
vrc.on("user-location", location);