Skip to content

Make cross-type templates behave more sensibly, like legacy#2496

Open
GinjaNinja32 wants to merge 4 commits into
daid:masterfrom
GinjaNinja32:cross-type-templates
Open

Make cross-type templates behave more sensibly, like legacy#2496
GinjaNinja32 wants to merge 4 commits into
daid:masterfrom
GinjaNinja32:cross-type-templates

Conversation

@GinjaNinja32

@GinjaNinja32 GinjaNinja32 commented Jul 9, 2025

Copy link
Copy Markdown
Contributor

Two example cases:

  • PlayerSpaceship():setTemplate("MT52 Hornet") ("Player"), a player ship with a "CPU ship" template
  • CpuShip():setTemplate("MP52 Hornet") ("CPU"), a CPU ship with a "player ship" template
Component Current New Notes
ai_controller Both CPU If the template does not set AI, then CPU/CPU.
comms_receiver Player CPU
comms_transmitter CPU Player
long_range_radar CPU Both The AI system expects CPU ships to have radar ranges.
coolant CPU Player CPU
hacking_device CPU Player CPU
reactor CPU Player CPU
scan_probe_launcher CPU Player CPU
science_scanner CPU Player CPU
self_destruct CPU Player CPU

@daid daid left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I think this is the wrong direction. The templates are not designed for cross-use like this. And I much rather see some simple checks in :setTemplate() to check for certain odd combinations and report that. (like having both player and ai_controller, or an ai_controller and energy/coolant)

Comment thread scripts/api/entity/playerspaceship.lua Outdated
Comment thread scripts/api/entity/shiptemplatebasedobject.lua Outdated
@GinjaNinja32

Copy link
Copy Markdown
Contributor Author

Updated.
Ship capability components (reactor, coolant, hacking, etc) are back on the templates.
Control-type components (AI/player control, comms tx/rx) are still in CpuShip/PlayerSpaceship/SpaceStation and are maintained across template changes.
Long range radar is still on all ships, since the AI code does process it. There's TODOs in the component, there's definitely some player-only bits in there (waypoints!), but the long/short radar range bits should be on AI ships too.

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.

2 participants