예제 #1
0
        public void Init()
        {
            var entities = GetEntities();

            rotor1 = FindRotor("Arm Rotor 1", entities);
            rotor2 = FindRotor("Arm Rotor 2", entities);
            rotor3 = FindRotor("Arm Rotor 3", entities);
            rotors = GetRotors(entities);

            var connectors = GetEntitiesOfType <MyShipConnector>(entities);

            connector = connectors.SingleOrDefault(x => x.CustomName.ToString() == "Arm Connector 1");

            entities.Clear();
        }
예제 #2
0
        private void Disconnect()
        {
            IMyLandingGear asGear = m_unlandBlock.Block as IMyLandingGear;

            if (asGear != null)
            {
                m_attached = asGear.GetAttachedEntity() != null;
                if (m_attached)
                {
                    Log.DebugLog("Unlocking landing gear", Logger.severity.DEBUG);
                    MyAPIGateway.Utilities.TryInvokeOnGameThread(() => {
                        asGear.ApplyAction("Unlock");
                    });
                }
            }
            else
            {
                MyShipConnector asConn = (MyShipConnector)m_unlandBlock.Block;
                if (asConn != null)
                {
                    m_attached = asConn.Connected;
                    if (m_attached)
                    {
                        MyShipConnector otherConnector = (MyShipConnector)((IMyShipConnector)asConn).OtherConnector;
                        ReserveTarget(otherConnector.EntityId);
                        Log.DebugLog("Unlocking connector", Logger.severity.DEBUG);
                        MyAPIGateway.Utilities.TryInvokeOnGameThread(() => {
                            asConn.Enabled         = true;
                            otherConnector.Enabled = true;
                            asConn.ApplyAction("Unlock");
                        });
                    }
                }
                else
                {
                    Log.DebugLog("cannot unlock: " + m_unlandBlock.Block.DisplayNameText, Logger.severity.INFO);
                    m_attached = false;
                }
            }
        }
예제 #3
0
 public MyDebugRenderCompoonentShipConnector(MyShipConnector shipConnector) : base(shipConnector)
 {
     this.m_shipConnector = shipConnector;
 }
 public ConnectorWrapper(MySlimBlock block) : base(block)
 {
     Block = (MyShipConnector)block.FatBlock;
 }