Skip to content

49_allies: fix setPlayers errors for Hornet, Phobos, Player Fighter and Lindworm - #2930

Open
dj803 wants to merge 1 commit into
daid:masterfrom
dj803:pr/49-allies-colon-calls
Open

dj803 wants to merge 1 commit into
daid:masterfrom
dj803:pr/49-allies-colon-calls

Conversation

@dj803

@dj803 dj803 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Hello! While testing another change to scenario_49_allies.lua I hit an error when creating some player ships.

Problem
setPlayers() calls p.setWarpDrive(true) / p.setJumpDrive(true) with a dot, so true becomes self. Creating an MP52 Hornet, Phobos M3P, Player Fighter or ZX-Lindworm logs onNewPlayerShip callback function error: api/entity/spaceship.lua:555 attempt to index a boolean value (local 'self'), and setPlayers stops before it sets maxRepairCrew, cargo and the prev*/healthy* fields. Later update code then compares those nils.

Change (4 insertions, 4 deletions): . -> : on those 4 calls.

Checks

  • Windows 11, headless: real scenario_49_allies.lua, one player ship of each type created, state read 25 ticks later:
ship master: maxRepairCrew / cargo / warp / jump this branch
MP52 Hornet nil / nil / false / false (callback error) 1 / 3 / true / false
Phobos M3P nil / nil / false / false (callback error) 3 / 10 / true / false
Player Fighter nil / nil / false / false (callback error) 3 / 3 / false / true
ZX-Lindworm nil / nil / false / false (callback error) 1 / 3 / true / false
Striker, Atlantis 2 / 4 and 3 / 6, no error same

master logged 4 callback errors; this branch none.

  • GUI (Windows 11, Allies and Enemies, Create MP52 Hornet on the Create Ship screen): master scripts log the spaceship.lua:555 callback error; this branch logs no errors and the ship appears in Select ship.
  • precheck.sh (Lua 5.4 syntax parse of scripts/**.lua): 107 files, 0 failed.

NOT tested

  • In the GUI: Phobos M3P, Player Fighter and ZX-Lindworm (headless only).
  • Whether the warp/jump drive then behaves in play (only hasWarpDrive()/hasJumpDrive() read back).
  • Linux, macOS.

🤖 Generated with Claude Code

p.setWarpDrive(true) passed the boolean as self, so onNewPlayerShip errored (spaceship.lua:555 attempt to index a boolean) for MP52 Hornet, Phobos M3P, Player Fighter and ZX-Lindworm, and setPlayers stopped before setting maxRepairCrew and the prev*/healthy* fields.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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