Skip to content

Fix /reveal ignoring surface name when coordinates are given#114

Open
wormeyman wants to merge 1 commit into
M45-Science:Mainfrom
wormeyman:fix/reveal-surface-with-coords
Open

Fix /reveal ignoring surface name when coordinates are given#114
wormeyman wants to merge 1 commit into
M45-Science:Mainfrom
wormeyman:fix/reveal-surface-with-coords

Conversation

@wormeyman

Copy link
Copy Markdown
Contributor

Problem

/reveal <size> <surface> <x,y> (e.g. /reveal 2048 vulcanus 0,0) silently charted the caller's current surface instead of the named one. The command resolved surface and center in a single if/elseif chain, so an explicit x,y (or GPS) match short-circuited the surface branch. The bare surface-name pattern was also anchored to the whole parameter (^...$), so it could never match alongside any other argument.

This has been the behavior since the multi-arg forms were introduced in 4c89aa7 (2025-05-27) - it is not a 2.1 regression; the combined form never worked.

Fix

  • Resolve the surface independently by scanning the post-size tokens for a valid surface name, then resolve the center separately (GPS -> x,y -> origin when only a surface was named).
  • Surface and coordinates can now be combined in any order.
  • Removed the dead whole-string surfname pattern.
  • Updated the command help string to document the [surface] argument and the order-independence.

Verification

  • Extracted the parsing block into a standalone harness and executed it against 9 input variants (original failing case, size-only, bare surface, size+coords, GPS, console/no-player invocations). All produce correct size/surface/center.
  • Parse-checked commands.lua under genuine Lua 5.2 (nickblah/lua:5.2-alpine), per AGENTS.md.

Key results:

Input size surface center
2048 vulcanus 0,0 (the bug) 2048 vulcanus (0,0)
2048 vulcanus 100,-200 2048 vulcanus (100,-200)
vulcanus 1024 vulcanus (0,0)
2048 (player at 500,-300) 2048 (current) (500,-300)
2048 [gps=0,0,vulcanus] 2048 vulcanus (0,0)

Bumped version.lua to 662-07.02.2026-849p per the AGENTS.md versioning convention.

🤖 Generated with Claude Code

The reveal command resolved surface and center in a single if/elseif
chain, so an explicit x,y (or GPS) match short-circuited the surface
branch. As a result `/reveal <size> <surface> <x,y>` charted the
caller's current surface instead of the named one, and the surface-name
pattern was anchored to the whole parameter so it could never match
alongside other arguments.

Resolve the surface independently by scanning the post-size tokens for a
valid surface name, then resolve the center separately (GPS, then x,y,
then origin when only a surface was named). Surface and coordinates can
now be combined in any order.

Verified by executing the parsing logic against nine input variants,
including the original failing case and console (no-player) invocation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SqUp4baDTeLBFeYWQgEb9R
@wormeyman

Copy link
Copy Markdown
Contributor Author

It's late and I had claude generate this for me. I have always used /reveal 1024 Vulcanus 0,0 and had it work. It has stopped working in 2.1.9 so I think something may have changed.

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