Space Engineers

Space Engineers

Not enough ratings
Stu's Connector Docking Status
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
413.265 KB
22 Jan, 2022 @ 10:22pm
22 Dec, 2023 @ 7:21pm
3 Change Notes ( view )

Subscribe to download
Stu's Connector Docking Status

Description
THIS IS A SCRIPT ORIGINALLY DONE BY AltonV ("Connector Docking Status 1.5.3") that has been updated by me at the request of a Redditor.

**NEW** Connectors now sorted at discovery

Added ability to change image on a per-connector LCD based on connector state (default = green Arrow for Unoccupied, red-X for Proximity/Occupied/Disabled.

I have made the following changes to the original script:
  • updated some deprecated calls
  • changed the way blocks are discovered so they don't have to be discovered on every run (which is inefficient, but at the cost of having to run the script with argument "setup" if any relevant blocks are added / removed / name-changed)
  • changed the status check logic to be more efficient by not updating all the status outputs if nothing changed.
  • changed it so the outputs are updated on initial run (the original might have done this, not totally sure)
  • restored the "Show on HUD" feature
  • added some LCD and light-color configurability that was absent/not working in the original.
  • made the block search enforce that all discovered connectors / lights / timers / LCDs must be on the same grid as the PB, getting rid of the "prefix" concept of the original.
  • changed the PB's detailed info area to output discovered blocks instead of script summary status for debugging purposes
  • changed it so the summary status is output on the PB's LCD instead of the PB detailed info area

However, the idea and the general logic are AltonV's.
I contacted AltonV and they were ok with me re-publishing this.

This is a script that sets the name of connectors according to the status, if they are locked, in proximity, unoccupied or disabled.

Optionally, show the connector name on HUD in the various states.
Optionally, show the connector statuses on LCDs.
Optionally, change the color of light(s) associated with each connector.
Optionally, trigger timer block(s) associated with each state of each monitored connector.

If you change relevant blocks or change their names, run the script with "setup" as argument. (The original script dynamically detected blocks, but at the cost of discovering blocks inefficiently, every single run, instead of once at init.)

TL;DR Example using default config:
  • Connector name: Connector A
  • Summary LCD name: Connector LCD 1
  • per-connector LCD name: Connector A LCD
  • Status Light name: Connector A Light 1
  • Status Light name: Connector A Light 2
  • Timer to run on connector A entering connected state: Connector A Timer Connected
  • Timer to run on connector A entering disconnected state: Connector A Timer Unoccupied
9 Comments
Stollie 12 Jan, 2024 @ 6:28pm 
Hey mate,

Added some more :D

I use Spug's docking script so renaming the connectors breaks things for me.

bool FEATURE_RENAME_CONNECTORS = false; // Set to false to disable the connector renaming feature

void setName(IMyShipConnector connector, String status)
{

// Check if the feature is enabled before updating connector names
if (!FEATURE_RENAME_CONNECTORS)
return;

String name = getStrippedName(connector);
if (status != "")
{
name = name + " - " + status;
}
connector.CustomName = name;
}
StubieDubie  [author] 22 Dec, 2023 @ 7:28pm 
@Stollie Good idea. I added it and credited you.
Stollie 22 Dec, 2023 @ 6:41am 
Hey mate, I wanted the connectors sorted aphabetically so I updated the code to do this: -

//
// Find all connectors containing the text defined in CONNECTOR_BASE_NAME
//
List<IMyTerminalBlock> connectorBlockList = new List<IMyTerminalBlock>();
GridTerminalSystem.SearchBlocksOfName(CONNECTOR_BASE_NAME, connectorBlockList, b => b is IMyShipConnector && b.IsSameConstructAs(Me));
_connectorList.Clear();

// Sort connectors alphabetically by name
connectorBlockList.Sort((a, b) => string.Compare(a.CustomName, b.CustomName, StringComparison.OrdinalIgnoreCase));

foreach(var block in connectorBlockList)
{
IMyShipConnector connector = block as IMyShipConnector;
_connectorList.Add(connector);
}
Echo(String.Format("Found {0} connectors", _connectorList.Count()));
StubieDubie  [author] 27 Apr, 2023 @ 6:56pm 
Cheers!
Bednar12 27 Apr, 2023 @ 12:15pm 
It works on the newest Automatons update (as of 27.04.2023)

THANK YOU GOOD SIR!

(also, Event Controller = dogshite, wasted 5hrs on trying to make the connector lights work, then gave up and looked for a script, and whaddya know, it exists, and is a thousand times better and easier to use than the Event Controller)
StubieDubie  [author] 20 Mar, 2023 @ 10:48am 
<bows in gratitude>
Doruaraebe_ 20 Mar, 2023 @ 8:00am 
Absolutely amazing script. Nice and simple, definitely worth it if it's what your looking for :steamhappy:
StubieDubie  [author] 18 Oct, 2022 @ 3:41pm 
Glad to help!
♥♥♥♥♥♥♥♥ Prime 16 Oct, 2022 @ 6:47am 
If everything is setup correctly, it's one of the best docking status scripts out there. Thank you so much for updating this gem!