Movecraft icon indicating copy to clipboard operation
Movecraft copied to clipboard

Cannot pilot crafts which are part of other crafts

Open galacticwarrior9 opened this issue 3 years ago • 4 comments

Describe the bug If a craft happens to be part of another craft that is already piloted, its detection will fail and you will be told that it is already being controlled. The scenario in which I encountered this issue involved a fighter craft attempting to launch from a larger, piloted aircraft carrier.

To Reproduce Steps to reproduce the behavior:

  1. Build a craft and ensure it is piloted. Example: Aircraft Carrier
  2. Build a smaller craft on the craft that was just built. Example: Fighter
  3. Attempt to pilot the smaller craft. (The Fighter craft excludes concrete while the Aircraft Carrier craft above does not; this is for separation)
  4. The detection of the smaller craft will fail and the message "The craft is already being controlled!" will be sent in chat.

Expected behavior It is possible to pilot craft under these circumstances when using Movecraft 7

Screenshots Below you can see the fighter and aircraft carrier in question:

The crafts in question

Versions (please complete the following information):

  • Movecraft: [e.g. 7.0.0 prerelease 6] Movecraft 8.0.0 alpha 3
  • Java [e.g. JDK 8.0.1] Java 11
  • Minecraft [e.g. 1.10.2] 1.16.5

Additional context N/A

galacticwarrior9 avatar Jun 04 '21 18:06 galacticwarrior9

Similar to #438, this issue is complex and will require some major changes internally to how detection works.

TylerS1066 avatar Nov 25 '21 15:11 TylerS1066

As of https://github.com/APDevTeam/Movecraft/commit/dca0fbb4c79693ead9749b3635fdfb2e5da46daa, the fix for cruiseOnPilot: true type crafts has been merged, but non cruise on pilot type crafts still can not be piloted separately.

I'm still uncertain as to how we want this mechanism to work, but I'll be leaving this issue open until it is resolved.

TylerS1066 avatar Dec 04 '21 18:12 TylerS1066

On our server we appear to have fixed the problem like this, but the solution was thrown together quite quickly so I am not sure whether it is any good

galacticwarrior9 avatar Jan 26 '22 15:01 galacticwarrior9

That solution was along the lines of what I was suspecting we'd go with, but I think we'd like to avoid making it a PlayerSubCraft to avoid the naming confusion with actual crafts which implement SubCraft.

The problem (as you mention) is finding an elegant method to prevent re-piloting of the same craft. The initial idea is if it's a different type, then allow it, but then as you mention piloting from say an airship to a factory is possible.

My initial thoughts are that for this to be allowed, the craft:

  1. Must wholly be a subset of the carrier craft, as in every block of the new craft's hitbox is part of the carrier craft's hitbox.
  2. Must be a different craft type than the carrier craft.
  3. Must have a smaller maxSize in its type than the minSize of the carrier craft's type.
  4. Must have a different pilot than the carrier craft.

This would allow skiffs to be piloted off of a carrier, but situations 1 & 3 will prevent "up piloting". It also prevents the need to explicitly declare a craft type flag (of which we already have far too many in the base Movecraft) but does not preclude custom addons adding their own (for example, you could make an addon which restricts carrier piloting to only be between a specific carrier type and a specific plane type).

TylerS1066 avatar Jan 26 '22 16:01 TylerS1066