Space Engineers

Space Engineers

评价数不足
Stu's Connector Docking Status
   
奖励
收藏
已收藏
取消收藏
标签: other_script
文件大小
发表于
更新日期
413.265 KB
2022 年 1 月 22 日 下午 10:22
2023 年 12 月 22 日 下午 7:21
3 项改动说明 ( 查看 )

订阅以下载
Stu's Connector Docking Status

描述
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 条留言
Stollie 2024 年 1 月 12 日 下午 6:28 
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  [作者] 2023 年 12 月 22 日 下午 7:28 
@Stollie Good idea. I added it and credited you.
Stollie 2023 年 12 月 22 日 上午 6:41 
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  [作者] 2023 年 4 月 27 日 下午 6:56 
Cheers!
Bednar12 2023 年 4 月 27 日 下午 12:15 
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  [作者] 2023 年 3 月 20 日 上午 10:48 
<bows in gratitude>
Doruaraebe_ 2023 年 3 月 20 日 上午 8:00 
Absolutely amazing script. Nice and simple, definitely worth it if it's what your looking for :steamhappy:
StubieDubie  [作者] 2022 年 10 月 18 日 下午 3:41 
Glad to help!
♥♥♥♥♥♥♥♥ Prime 2022 年 10 月 16 日 上午 6:47 
If everything is setup correctly, it's one of the best docking status scripts out there. Thank you so much for updating this gem!