Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

Checking Connector Lock

Discussion in 'Programming Questions and Suggestions' started by Hellothere!, Mar 19, 2015.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Hellothere! Apprentice Engineer

    Messages:
    412
    Is there any way to test is a connector is actually locked? The "IsLocked" Function already returns true if it is in locking range.
     
  2. Kagee Trainee Engineer

    Messages:
    78
    Actually you have to workaround.
    - You can count the number of connectors in GridTerminalSystem.Blocks, and if it's bigger than the number of connectors on your station, a ship is connected.

    - A ship behind a connector is another grid, you can loop through all blocks and get the different block.CubeGrid(s)
    (Keep in mind, rotors and pistons also split grids.)
     
  3. Hellothere! Apprentice Engineer

    Messages:
    412
    The thing is, I need to know which of my Connectors is the one that is connected.
     
  4. Kagee Trainee Engineer

    Messages:
    78
    AFAIK there is no easy way.

    You can SwitchLock your connectors one by one and count the number of connectors again.
     
  5. mze9412 Junior Engineer

    Messages:
    791
    Check the Details string to see what it says :)
     
  6. Hellothere! Apprentice Engineer

    Messages:
    412
    Details String? I'm sorry, I don't know that much on how programming in SE works. What is it, how do I access it and what use can it be of? (Alternatively just tell me where I can get that information ;) )
     
  7. plaYer2k Master Engineer

    Messages:
    3,160
    http://forums.keenswh.com/post/show_single_post?pid=1285594431&postcount=3
     
  8. mze9412 Junior Engineer

    Messages:
    791
    Thanks plaYer2k, I didn't find the concrete info :)
     
  9. Hellothere! Apprentice Engineer

    Messages:
    412
  10. whiskeyfur Trainee Engineer

    Messages:
    14
    Probably what should be in the API is something like this?

    GridTerminalSystem grid = connector.GetConnectedGrid();

    ?
     
  11. plaYer2k Master Engineer

    Messages:
    3,160
    Either that or the actual block (connector) they are connected to, which would be more useful.

    That got suggested in a discussion (no suggestion post yet afaik) and implemented by phoenix.

    I really hope to see that soonish.

    Edit: woops i read your grid, which actually is an IMyGridTerminalSystem, as IMyCubeGrid.
    Well getting the gridterminalsystem(gts) is useless as both gts merge when the connectors connect to each other.
     
    Last edited by a moderator: Mar 24, 2015
  12. Rapt0r828 Trainee Engineer

    Messages:
    2
    i got a similar question, so didnt want to make a new thread.

    ive built a rocket for my ship with a connector on top. Ships connector holds it in place. On the rocket is a programmable block.
    What i need: Programmable block on the rocket should check if connector on the rocket is locked. If yes, nothing happens. If no, a timer block should be started.

    How can i make this?
     
  13. Rapt0r828 Trainee Engineer

    Messages:
    2
    I got a similar question, so didnt want to make a new thread.

    I have a rocket, that is connected to my ship via connector.

    on the rocket is a programmable block.
    What i want now, is that the programmable block checks the connector if its locked. If yes, nothing happens. If no, a timer block should be started.

    How can i do this?
     
  14. Oli J Trainee Engineer

    Messages:
    12
    The "IsLocked" property is obsolete, i.e. it is an old property that is not used anymore. Use the "Status" property instead. It returns an enum telling you whether the connector is connectable (in proximity), connected or unconnected.

    Code:
    if (connector.Status == MyShipConnectorStatus.Connected)
     
Thread Status:
This last post in this thread was made more than 31 days old.