Skip to content

fix: keep Give item working after the Console asks the Gateway - #31

Closed
Wrathen wants to merge 1 commit into
mainfrom
fix/waypoint-tools-gateway-listings
Closed

Wrathen wants to merge 1 commit into
mainfrom
fix/waypoint-tools-gateway-listings

Conversation

@Wrathen

@Wrathen Wrathen commented Nov 11, 2026

Copy link
Copy Markdown
Member

Problem

A player on LocalExile v0.4.2-beta with Waypoint Tools 1.0.0 loaded in game got "Give item uses the Waypoint Tools mod, and no running game has it loaded" every time. Turning the mod off and on in Mods fixed it.

Cause

Give item counts the mod as loaded when data/waypoint-tools/loaded.json names a process that still runs. The Gateway's commands and values <kind> listing modes call StartMods() before they print (to list the mods' commands), so Waypoint Tools also loads in that short-lived process. It writes loaded.json with the listing's pid, and the process exits without unloading it. Waypoint runs those modes from the Console (command list, argument suggestions) and the lab layout, so after either one, loaded.json names a dead process until the mod loads again in the real Gateway, which is what the Mods off/on did.

Reproduced on a source checkout: dotnet GameServer.Gateway.dll commands rewrote loaded.json with its own pid and left it there after exiting 0.

Fix

CommandCatalog.AskGateway (shared by Windows and Linux):

  • asks one question at a time, since each one now saves and restores the file;
  • before starting, keeps loaded.json if a running process wrote it (WaypointToolsMod.KeepLoaded);
  • after the question, puts it back only if the file now names the question's own process and the Gateway that wrote the original still runs (WaypointToolsMod.PutBack). A reload, unload or stopped Gateway in the meantime leaves the file as it is.

This works with the released mod 1.0.0 and any server version. The root fix belongs in the mod: waypoint-tools should not write loaded.json from a listing process, and on unload should delete it only if it names its own process. That can follow in LocalExile-Mods.

Checks

  • dotnet build Waypoint.slnx and Waypoint.Linux.slnx: 0 warnings
  • dotnet test Waypoint.slnx: 405 passed (2 new tests in WaypointToolsModTests)
  • tests/Launcher.Checks: 201 passed
  • Adapter scripts: all pass except ModControl.Tests.ps1 and Mods.Tests.ps1, which fail the same way on main without this change
  • Not checked in the running app with a live Gateway

🤖 Generated with Claude Code

The Gateway's `commands` and `values` listing modes load the mods to list
theirs. Waypoint Tools then writes data/waypoint-tools/loaded.json with
the listing's process, which exits without unloading it, so Give item
found no running game with the mod loaded until the mod loaded again
(turning it off and on in Mods fixed it).

AskGateway now asks one question at a time, keeps loaded.json as a
running Gateway wrote it, and puts it back when the question wrote over
it and that Gateway still runs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant