commit 761f9070ea91aa83d0f780a30e12f10f1d089359
parent ae241d4e5c56f072b2f69c4717baf705fefd37dd
Author: anon <anon@example.com>
Date: Tue, 3 Nov 2026 21:48:57 +0000
Retire collected mission floor models after native pickup
Diffstat:
8 files changed, 213 insertions(+), 15 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -2477,13 +2477,19 @@ client rendering fixes and checks are in [nano damage](docs/nano-damage.md).
GPU WASM verifies the visible floor model, immediate native pickup icon,
page reconnect, exit/reentry and cold-server recovery with no respawn.
See [mission floor items](docs/mission-objectives.md).
-- [ ] [P0] Remove the collector's mission-floor model after successful pickup.
+- [x] [P0] Remove the collector's mission-floor model after successful pickup.
Reproduction: native R creates the Blue Book inventory proxy, but the collected
snapshot still contains type51005:3 and its selected floor label until reload;
see `local/mission-generation/20261103-103107/collected/`. Completion: a fixture
beside the book verifies immediate collector removal after the move reply,
usable inventory metadata, unchanged physical ownership and page/cold replay.
Preserve failure rollback, duplicate-request refusal and observer isolation.
+ A focused fixture reproduces the lingering actor in17.29seconds; the fixed
+ native check passes in11.38seconds with a usable icon, immediate removal and
+ exact page/cold ownership. The shared path now retires the floor actor only
+ after the native move constructs its inventory proxy. Existing seeded-mission
+ traversal also requires this outcome; no established traversal or leveling
+ was repeated. See [mission floor pickup](docs/mission-objectives.md#collector-floor-removal).
- [x] [P1] Preserve native template metadata when collecting mission-floor items.
World stat23 supplies the visible resource, while the original pickup descriptor
independently reads stat702/703. Supply the authored low endpoint in stat702
diff --git a/docs/mission-objectives.md b/docs/mission-objectives.md
@@ -98,8 +98,10 @@ expiry, original Carry permission, five-metre three-dimensional distance,
Unique ownership, free main-inventory space and pending inventory interactions.
It transfers the same instance through the shared inventory transaction before
acknowledging success. Other clients in that world receive its removal. The
-collector retains the world dynel until InventoryMove reparents it; removing it
-before that native callback would discard the source of the transfer.
+collector receives InventoryMove before the typed floor-dynel removal. The native
+callback constructs a separate simple inventory proxy; it leaves the floor dynel
+alive, so an explicit removal must follow the move. Removing it before that
+callback would discard the source templates needed for the transfer.
The acknowledgement preserves destination0/0 and sentinel111. The original
inventory dispatcher (`kkr.dll`0x100614e0) routes that destination to world pickup
@@ -204,6 +206,40 @@ It also describes killing a mission target after completing find-person,
supporting continued occupancy after success. This is near-period player
evidence, not an original14.9.1 server capture.
+## Collector floor removal
+
+The original simple-proxy pickup constructor copies the QL/template triple into
+a separate inventory representation; its successful move did not retire the
+collector's parentless floor dynel. An archived collected-book snapshot retained
+type51005:3 and its selected floor label. A focused saved-nearby-book fixture
+reproduced that defect in17.29seconds, without entering the mission on foot or
+replaying progression.
+
+All shared world pickups now send the normal destination0/0, sentinel111 move
+reply before typed floor removal. This preserves the source long enough to
+construct the correct inventory proxy, then removes the obsolete floor model
+and selection. The transaction, observer removal and physical ownership remain
+the same. Failed database writes emit neither packet; output failure after
+commit retains ownership, and duplicate requests still refuse.
+
+The accepted focused WASM run is
+`local/mission-pickup-removal/20261103-134415/`:11.38seconds, three clean traces.
+It uses an accepted mission's saved room checkpoint beside book3. Native R
+pickup removes the source immediately and preserves the usable40822/40822QL1
+icon, the original weapon1/key2, four credits and item counter3. Page replay
+restores physical book3 in native slot50; the Go fixture independently cold-loads
+the exact three owned items and no world item. Visual review confirms the book
+icon and cleared floor selection. This is a controlled protocol/ownership
+check, not earned mission progression. The existing generated-mission traversal
+script now also requires immediate collector removal; that established route
+was not repeated for this fix.
+
+The final shared pickup/Use, private-world and submission checks pass34 roots/
+171 results. The focused race run passes3 roots/3 results; vet and both client
+script syntax checks pass. Packet verification confirms exactly one move reply
+followed by one type51005:3 removal, with no dropped events or page exceptions.
+The retained audit is `local/mission-pickup-removal/verification.json`.
+
## Carried-backpack return sources
Return-item hand-in also accepts a known carried backpack's contents. Source
diff --git a/server/browser_mission_pickup_test.go b/server/browser_mission_pickup_test.go
@@ -0,0 +1,71 @@
+package main
+
+import (
+ "context"
+ "crypto/sha256"
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "runtime"
+ "slices"
+ "testing"
+ "time"
+)
+
+func TestBrowserMissionPickupRemovesFloorModel(t *testing.T) {
+ if os.Getenv("AO_GAME_TEST") != "1" {
+ t.Skip("set AO_GAME_TEST=1 for the focused mission pickup check")
+ }
+ _, source, _, _ := runtime.Caller(0)
+ root := filepath.Dir(filepath.Dir(source))
+ output := filepath.Join(root, "local/mission-pickup-removal", time.Now().Format("20060102-150405"))
+ world, _, _ := enteredObjectiveWorld(t)
+ player := world.characters[1]
+ player.position[2] += 2.5
+ player.rotation = [4]float32{0, 1, 0, 0}
+ player.browserTokenHash = fmt.Sprintf("%x", sha256.Sum256([]byte("mission-pickup")))
+ if err := world.saveUser_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ if err := world.savePosition_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ before, counter := slices.Clone(player.inventory.Items), world.nextItem
+ if err := world.db.Close(); err != nil {
+ t.Fatal(err)
+ }
+ world = newServerForTest(t)
+ mux := http.NewServeMux()
+ mux.Handle("/", world.httpHandler())
+ mux.HandleFunc("GET /test-state", func(w http.ResponseWriter, r *http.Request) {
+ world.mutex.Lock()
+ defer world.mutex.Unlock()
+ _, onGround := world.worldItems[3]
+ json.NewEncoder(w).Encode(map[string]any{"inventory": world.characters[1].inventory,
+ "onGround": onGround, "objective": 3, "lastID": world.nextItem})
+ })
+ host := httptest.NewServer(mux)
+ t.Cleanup(host.Close)
+ closeTestBrowserStreams(t, world)
+ ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
+ defer cancel()
+
+ command := exec.CommandContext(ctx, "node", filepath.Join(root, "tools/client/test_mission_pickup.mjs"), host.URL, output)
+ command.Dir, command.Stdout, command.Stderr = root, os.Stdout, os.Stderr
+ err := command.Run()
+ cold := newServerForTest(t)
+
+ t.Logf("Browser artifacts: %s", output)
+ if err != nil {
+ t.Fatal(err)
+ }
+ expected := append(before, ownedItem{ID: 3, Type: 51005, Template: 40822, Quality: 1, Slot: 66, Count: 1})
+ if !slices.Equal(world.characters[1].inventory.Items, expected) || !slices.Equal(cold.characters[1].inventory.Items, expected) ||
+ len(world.worldItems) != 0 || len(cold.worldItems) != 0 || world.nextItem != counter || cold.nextItem != counter {
+ t.Fatal("floor retirement changed pickup ownership, other items or the counter")
+ }
+}
diff --git a/server/mission_boundaries_test.go b/server/mission_boundaries_test.go
@@ -323,7 +323,9 @@ func TestMissionBoundariesInterestMovementAndObjectivePickupIncludeOnlyGuests(t
}
cold := reloadMissionEntranceWorld(t)
if len(outputs[0].packets) != 1 || binary.BigEndian.Uint32(outputs[0].packets[0][24:28]) != objective || len(outputs[1].packets) != 0 ||
- len(outputs[2].packets) != 1 || len(cold.characters[3].inventory.Items) != 2 || cold.characters[3].inventory.Items[1].ID != objective ||
+ len(outputs[2].packets) != 2 || binary.BigEndian.Uint32(outputs[2].packets[0][16:20]) != 0x47537a24 ||
+ binary.BigEndian.Uint32(outputs[2].packets[1][16:20]) != 0x36510078 ||
+ len(cold.characters[3].inventory.Items) != 2 || cold.characters[3].inventory.Items[1].ID != objective ||
cold.worldItems[second.objective].mission != second.id || len(cold.worldItems) != 1 {
t.Fatal("guest pickup lost the exact objective or removed another world's item")
}
diff --git a/server/world_items.go b/server/world_items.go
@@ -211,11 +211,8 @@ func (server *server) takeWorldItem_locked(client *worldClient, body []byte) err
if err := client.send(n3Packet(0x47537a24, 50000, client.id, slices.Clone(body[16:]))); err != nil {
return err
}
- // Retire the resource shape after its proxy has constructed the carried item.
- if resourcePickup {
- return client.send(n3Packet(0x36510078, item.Type, id, nil))
- }
- return nil
+ // Retire the floor shape after its proxy has constructed the carried item.
+ return client.send(n3Packet(0x36510078, item.Type, id, nil))
}
func simpleItemBody(template, playfield uint32, position [3]float32, rotation [4]float32, stats [][2]uint32) []byte {
diff --git a/server/world_items_test.go b/server/world_items_test.go
@@ -98,8 +98,9 @@ func TestWorldPickupMovesSameInstanceAndSurvivesRestart(t *testing.T) {
player.inventory.Credits != before || len(player.missions) != 1 || player.missions[0].objective != 3 {
t.Fatal("pickup lost, duplicated or rewarded an objective", owner, slot, player.inventory)
}
- if len(output.packets) != 1 || !bytes.Equal(output.packets[0], inventoryWorldPickupReply(1, 3)) {
- t.Fatal("incorrect native reparent reply", output.packets)
+ if len(output.packets) != 2 || !bytes.Equal(output.packets[0], inventoryWorldPickupReply(1, 3)) ||
+ !bytes.Equal(output.packets[1], targetPacket(n3Packet(0x36510078, 51005, 3, nil))) {
+ t.Fatal("pickup must construct the carried proxy before retiring its floor model", output.packets)
}
destination := world.characters[1].userData()
@@ -228,7 +229,7 @@ func TestWorldPickupRollsBackAndCanRetry(t *testing.T) {
t.Fatal(err)
}
- if len(world.worldItems) != 0 || len(world.characters[1].inventory.Items) != 3 || len(output.packets) != 1 {
+ if len(world.worldItems) != 0 || len(world.characters[1].inventory.Items) != 3 || len(output.packets) != 2 {
t.Fatal("pickup retry did not succeed once")
}
})
@@ -252,8 +253,10 @@ func TestWorldPickupConcurrentDuplicatesTransferOnce(t *testing.T) {
}
}
- if len(world.characters[1].inventory.Items) != 3 || len(world.worldItems) != 0 || len(output.packets) != 2 ||
- !bytes.Equal(output.packets[0], inventoryWorldPickupReply(1, 3)) || binary.BigEndian.Uint32(output.packets[1][16:]) != 0x5e477770 {
+ if len(world.characters[1].inventory.Items) != 3 || len(world.worldItems) != 0 || len(output.packets) != 3 ||
+ !bytes.Equal(output.packets[0], inventoryWorldPickupReply(1, 3)) ||
+ !bytes.Equal(output.packets[1], targetPacket(n3Packet(0x36510078, 51005, 3, nil))) ||
+ binary.BigEndian.Uint32(output.packets[2][16:]) != 0x5e477770 {
t.Fatal("duplicate pickup transferred twice", output.packets)
}
}
@@ -361,7 +364,7 @@ func TestWorldPickupBetweenPlayersRemovesOnlyItsWorldCopy(t *testing.T) {
t.Fatal(err)
}
- if holder != 1 && holder != 2 || len(cold.worldItems) != 0 || len(output.packets)+len(guestOutput.packets) != 3 || len(publicOutput.packets) != 0 ||
+ if holder != 1 && holder != 2 || len(cold.worldItems) != 0 || len(output.packets)+len(guestOutput.packets) != 4 || len(publicOutput.packets) != 0 ||
len(cold.characters[1].inventory.Items)+len(cold.characters[2].inventory.Items) != 3 || len(cold.characters[holder].inventory.Items) == 0 {
t.Fatal("contested pickup duplicated ownership or crossed worlds", holder, output.packets, guestOutput.packets, publicOutput.packets)
}
diff --git a/tools/client/test_generated_mission.mjs b/tools/client/test_generated_mission.mjs
@@ -70,6 +70,8 @@ try {
await game.click(...await game.pick(51005, evidence.entered.objective));
await game.key('KeyR');
await game.wait('objective proxy collected', snapshot => game.local(snapshot).inventory.some(item => item.templates.includes(40822)));
+ await game.wait('collected objective floor model removed', snapshot => !snapshot.actors.some(actor =>
+ actor.type === 51005 && actor.id === evidence.entered.objective));
evidence.collected = await server();
assert.equal(evidence.collected.inventory.Items.filter(item => item.ID === evidence.entered.objective && item.Template === 40822).length, 1);
await game.save(output + '/collected');
diff --git a/tools/client/test_mission_pickup.mjs b/tools/client/test_mission_pickup.mjs
@@ -0,0 +1,81 @@
+import assert from 'node:assert/strict';
+import fs from 'node:fs/promises';
+import {createRequire} from 'node:module';
+import {GameTest} from './game_test.mjs';
+
+const {chromium} = createRequire(import.meta.url)('playwright');
+const [url, output] = process.argv.slice(2);
+const browser = await chromium.launch({executablePath: '/usr/bin/chromium', args: [
+ '--enable-gpu', '--use-gl=angle', '--use-angle=gl', '--no-sandbox', '--disable-dev-shm-usage',
+ '--disable-background-timer-throttling', '--disable-renderer-backgrounding']});
+let game;
+const evidence = {};
+try {
+ const context = await browser.newContext({viewport: {width: 1024, height: 768}});
+ await context.addCookies([{name: 'ao_client', value: 'mission-pickup', url}]);
+ const page = await context.newPage();
+ game = await GameTest.attach(page);
+ const server = async () => (await page.request.get(url + '/test-state')).json();
+ await page.goto(url);
+ await game.ready();
+ await page.waitForFunction(() => touchRegion(500, 400)?.world === true);
+ await game.snapshot();
+ if (!game.state.camera.firstPerson) await game.key('F8');
+ evidence.before = await server();
+ assert(evidence.before.onGround);
+
+ // Frame the saved nearby book using ordinary mouse look, then pick it up.
+ const point = await game.point(500, 400), deadline = Date.now() + 10000;
+ let cursorY = point.y;
+ await page.mouse.move(point.x, cursorY);
+ await page.mouse.down({button: 'right'});
+ try {
+ while (true) {
+ const state = await game.snapshot();
+ const book = state.actors.find(actor => actor.type === 51005 && actor.id === evidence.before.objective);
+ assert(book?.screenPosition);
+ const screenY = book.screenPosition[1];
+ if (screenY >= 350 && screenY <= 540) break;
+ assert(Date.now() < deadline, 'Saved nearby book did not enter the camera view');
+ cursorY += screenY > 540 ? 20 : -20;
+ await page.mouse.move(point.x, cursorY, {steps: 2});
+ }
+ } finally { await page.mouse.up({button: 'right'}); }
+ await game.save(output + '/before');
+ await game.click(...await game.pick(51005, evidence.before.objective));
+ await game.key('KeyR');
+ await game.wait('book inventory proxy', state => game.local(state).inventory.some(item => item.templates.includes(40822)));
+ evidence.collected = await server();
+ await game.wait('collector floor model removed after pickup', state => !state.actors.some(actor =>
+ actor.type === 51005 && actor.id === evidence.before.objective));
+ evidence.fresh = game.local().inventory.find(item => item.templates.includes(40822));
+ assert.deepEqual(evidence.fresh.templates, [40822, 40822]);
+ assert.equal(evidence.fresh.quality, 1);
+ assert.equal(evidence.fresh.count, 1);
+ assert.equal(evidence.collected.onGround, false);
+ assert.equal(evidence.collected.lastID, evidence.before.lastID);
+ assert.equal(evidence.collected.inventory.Credits, evidence.before.inventory.Credits);
+ assert.deepEqual(evidence.collected.inventory.Items.slice(0, 2), evidence.before.inventory.Items);
+ assert.deepEqual(evidence.collected.inventory.Items[2], {ID: 3, Type: 51005, Template: 40822,
+ Quality: 1, Slot: 66, Count: 1, Ammo: 0});
+ await game.key('KeyI');
+ await game.save(output + '/collected');
+
+ await page.reload();
+ await game.ready();
+ await page.waitForFunction(() => touchRegion(500, 400)?.world === true);
+ await game.snapshot();
+ assert(!game.state.actors.some(actor => actor.type === 51005 && actor.id === 3));
+ assert.deepEqual(game.local().inventory.find(item => item.id === 3), {slot: 50, type: 51005, id: 3,
+ quality: 1, templates: [40822, 40822], count: 1});
+ evidence.reloaded = await server();
+ assert.deepEqual(evidence.reloaded, evidence.collected);
+ assert.deepEqual(game.errors, []);
+ console.log('PASS: immediate collector floor removal, usable book proxy and exact ownership after page replay');
+} finally {
+ try {
+ await fs.mkdir(output, {recursive: true});
+ await fs.writeFile(output + '/verification.json', JSON.stringify(evidence, null, 2) + '\n');
+ if (game) await game.save(output + '/final');
+ } finally { await browser.close(); }
+}