Skip to content

Fix for SWs with same Action= shadowing each other - #69

Open
Templarfreak wants to merge 1 commit into
OpenTS-Developers:mainfrom
Templarfreak:SW-Shadowing-Fix
Open

Fix for SWs with same Action= shadowing each other#69
Templarfreak wants to merge 1 commit into
OpenTS-Developers:mainfrom
Templarfreak:SW-Shadowing-Fix

Conversation

@Templarfreak

Copy link
Copy Markdown

Summary

SWs that have the same Action type shadow each other due to pulling which superweapon the player is targeting via From_Action, which only returns the first entry that matches the action. This adds new player state that tracks what the last SW the player started targeting and uses that instead. The new state gets cleaned up when the SW fires or the player clears the targeting mode. The value gets initialized and serializes.

Behavior and compatibility

This should remain fully backwards compatible, no changes to vanilla rules needed for it to continue working as expected.

Validation

Player having access to multiple Superweapons with the same Action= at the same time should now work properly.

Documentation

N/A

Checklist

  • The change is focused; unrelated mechanical cleanup is separate
  • Compatibility effects and any migration are explicit
  • A player- or modder-visible engine change carries its change record
  • Validation distinguishes what passed, failed, and was not run
  • No prohibited assets, binaries, SDKs, credentials, or generated output are included

SWs that have the same Action type shadow each other due to pulling which superweapon the player is targeting via `From_Action`, which only returns the first entry that matches the action. This adds new player state that tracks what the last SW the player started targeting and uses that instead.
@Templarfreak

Templarfreak commented Aug 29, 2026

Copy link
Copy Markdown
Author

launchsite->LastSuperWeaponIndex = Class->Type;

this could also be relevant in the future but it doesnt seem to affect anything noticeable right now.

edit: well it's entirely unused anyway actually so it's weird, whatever lol

@JoyfulShush

Copy link
Copy Markdown

Very nice improvement for sure. Great work!

Few considerations to take into account:

  • Is there a ts-patches or Vinifera fix for this? I ask because DTA has a few missions where a player can have access to 2 or more nukes (which, as far as I know, are different SWs carrying the same Action=), so maybe it was already implemented in some way and it would be better to implement that instead.
  • Is this desync-safe? Since PlayerPtr is local state that may affect gameplay. As long as it produces an event that all sides participate in, should be okay, but worth making sure.
  • What about an AI having multiple SWs of the same type? Is it bugged for it as well? If so, may be worth fixing it generally, rather than only local player.

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