Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In-mission docking breaks the warpIn() scripting function #6445

Open
naomimyselfandi opened this issue Nov 29, 2024 · 4 comments · May be fixed by #6446
Open

In-mission docking breaks the warpIn() scripting function #6445

naomimyselfandi opened this issue Nov 29, 2024 · 4 comments · May be fixed by #6446
Labels
bug An issue from unintended consequences gameplay A feature or issue that can significantly impact gameplay Requested by Active Mod A feature request that has been requested by a mod that is actively in development.

Comments

@naomimyselfandi
Copy link
Contributor

naomimyselfandi commented Nov 29, 2024

Bit of a niche case here... If a ship is not initially docked, or is initially docked but isn't the dock leader, and becomes docked during gameplay, calling the warpIn() scripting function on that ship will do nothing until it becomes undocked. This is due to a combination of two factors: warpIn() calls shipfx_warpin_start(object*), which short-circuits if it's called on a ship that's docked but not a Dock_leader; and the Dock_leader flag is only set at parse time, not as a result of docking during gameplay. Even if Dock_leader were updated dynamically, warpIn() would still mysteriously do nothing in some cases, so I feel like the right solution is to have shipfx_warpin_start skip that check when called by warpIn().

Additionally, shipfx_warpin_start fails with an Int3() when called on a ship that's already arriving; it should just do nothing in this case.

@naomimyselfandi
Copy link
Contributor Author

BtA has a workaround (starting the ship docked to a cloaked container that is immediately jettisoned and vanished), so this isn't a high priority for us.

@Goober5000
Copy link
Contributor

The selection of dock leader is more of a heuristic than a rule; it's barely possible during parsing (since the leader is de facto the ship that does the arriving) and would not be reliable for in-mission docking.

I feel like the right solution is to have shipfx_warpin_start skip that check when called by warpIn().

I think you're almost 100% correct here. The one issue is that the handling of the warp effect is slightly different for dock leaders and dock followers. But the script function offers its own solution. The ship on which you call warpIn() is the one you want to do the arriving, right? If so, then the solution is to set the dock leader flag inside the implementation of warpIn() before calling shipfx_warpin_start(). (Unless this is what you mean by "Even if Dock_leader were updated dynamically" in which case I'm curious to know more.)

@naomimyselfandi
Copy link
Contributor Author

The selection of dock leader is more of a heuristic than a rule; it's barely possible during parsing (since the leader is de facto the ship that does the arriving) and would not be reliable for in-mission docking.

Yup, we're saying the same thing here: trying to manage the Dock_leader flag during normal docking operations (which is what I meant by "dynamically") is way more trouble than its worth, especially for such a niche use case.

"The ship that you call warpIn() becomes the dock leader" sounds good to me.

@Goober5000
Copy link
Contributor

Ok, cool. Should be quick and easy to fix.

@Goober5000 Goober5000 added bug An issue from unintended consequences gameplay A feature or issue that can significantly impact gameplay Requested by Active Mod A feature request that has been requested by a mod that is actively in development. labels Nov 29, 2024
Goober5000 added a commit to Goober5000/fs2open.github.com that referenced this issue Nov 29, 2024
As described in scp-fs2open#6445, the `warpIn()` script function did not work correctly for docked ships because the dock leader flag was not set.  So, set the flag, but make sure to set it only for the first ship for which `warpIn()` is called.

Also remove an `Int3()` in `shipfx_warpin_start()`.  (This Int3() was not actually in the original Volition source code release.)

Fixes scp-fs2open#6445.
@Goober5000 Goober5000 linked a pull request Nov 29, 2024 that will close this issue
Goober5000 added a commit to Goober5000/fs2open.github.com that referenced this issue Nov 30, 2024
As described in scp-fs2open#6445, the `warpIn()` script function did not work correctly for docked ships because the dock leader flag was not set.  So, set the flag, but make sure to set it only for the first ship for which `warpIn()` is called.  And make sure the flag is removed after the ship finishes arriving.

Also remove an `Int3()` in `shipfx_warpin_start()`.  (This Int3() was not actually in the original Volition source code release.)

Fixes scp-fs2open#6445.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An issue from unintended consequences gameplay A feature or issue that can significantly impact gameplay Requested by Active Mod A feature request that has been requested by a mod that is actively in development.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants