sugardose / SpaceEngineers

25 stars 21 forks source link

Query or Request | Using SAM 'hierarchically' to dock drones to a mothership, and a mothership (with drones attached) to a station #11

Open roberestarkk opened 3 years ago

roberestarkk commented 3 years ago

Basically what I want to be able to do is have SAM pilot the mothership to a station and dock with it, without it first undocking the mothership from the drones to do so.

I'm effectively looking for a way to indicate directionality of docking... That the drones are docked TO the mothership, the mothership isn't docked TO the drones... If that makes sense?

Is there a way to do something like this already that I'm just not seeing? I initially tried it by changing the mothership's tag to 'MSAM' but that meant it couldn't see any advertised docks from scripts tagged with 'SAM'. Then I thought maybe if I have two copies of SAM running on the mothership, one for controlling the mothership itself, and one for advertising docks to the drones. But I couldn't quite get that to work either, as the second copy seemed to never want to do anything at all, even if it had a different tag, though it did leave the drones docked to the advertising-only tagged connectors when the navigation script ran.

One possible solution I can come up with is to have a dedicated modifier tag on the connectors, (like type=dock|ship) to specify whether SAM should advertise it as a possible place for another ship to dock (and then consider any attached grid a 'child' of itself for the purposes of deciding whether to undock from it before navigating), or use it as part of the ship that would connect to a dock on another grid (and thus consider itself a child of any attached grid when deciding it if should be undocking before navigating). Where the default would of course be 'any', unless specifically overridden, to maintain the current scheme of things.

Another solution might be to have the dock-seeking code use a separate list of tags, or a wildcard mechanism, to allow for grids to specify their own special SAM tag to navigate themselves without impacting their advertised docks, while still allowing them to advertise potential docks to other grids with different SAM tags. Though that one I've not 100% thought through, and might not work as I'm expecting.

sugardose commented 3 years ago

You can use [SAM MAIN] in the connector of the mothership you want to use as the main docking connector. This way the mothership will only use this connector to connect to other stations and it will not advertise it for drones to dock.

roberestarkk commented 3 years ago

Ah excellent! Can I use more than one? Typically my current mothership docks by one of two wings, depending on which way the longer front part will fit to the station...

Also, I've just tried using it and it lowercases the phrase 'MAIN' to 'main', even when I've only got the one connector with that in the name, and still advertises it... I have re-edited the PB to ensure it uses the latest version on both the mothership and the test drone.