Esempio n. 1
0
        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            base.Init(objectBuilder, cubeGrid);

            if (BlockDefinition is MyLandingGearDefinition)
            {
                var landingGearDefinition = (MyLandingGearDefinition)BlockDefinition;
                m_lockSound         = new MySoundPair(landingGearDefinition.LockSound);
                m_unlockSound       = new MySoundPair(landingGearDefinition.UnlockSound);
                m_failedAttachSound = new MySoundPair(landingGearDefinition.FailedAttachSound);
            }
            else
            {
                m_lockSound         = new MySoundPair("ShipLandGearOn");
                m_unlockSound       = new MySoundPair("ShipLandGearOff");
                m_failedAttachSound = new MySoundPair("ShipLandGearNothing01");
            }

            SyncObject = new MySyncLandingGear(this);

            Flags |= Sandbox.ModAPI.EntityFlags.NeedsUpdate10 | Sandbox.ModAPI.EntityFlags.NeedsUpdate;
            LoadDummies();
            SlimBlock.ComponentStack.IsFunctionalChanged += ComponentStack_IsFunctionalChanged;
            var builder = objectBuilder as MyObjectBuilder_LandingGear;

            if (builder.IsLocked)
            {
                // This mode will be applied during one-time update, when we have scene prepared.
                LockMode           = LandingGearMode.Locked;
                m_needsToRetryLock = true;
            }

            BreakForce = RatioToThreshold(builder.BrakeForce);
            AutoLock   = builder.AutoLock;

            IsWorkingChanged += MyLandingGear_IsWorkingChanged;
            UpdateText();
            AddDebugRenderComponent(new Components.MyDebugRenderComponentLandingGear(this));
        }
        public override void Init(MyObjectBuilder_CubeBlock objectBuilder, MyCubeGrid cubeGrid)
        {
            base.Init(objectBuilder, cubeGrid);

            if (BlockDefinition is MyLandingGearDefinition)
            {
                var landingGearDefinition = (MyLandingGearDefinition)BlockDefinition;
                m_lockSound = new MySoundPair(landingGearDefinition.LockSound);
                m_unlockSound = new MySoundPair(landingGearDefinition.UnlockSound);
                m_failedAttachSound = new MySoundPair(landingGearDefinition.FailedAttachSound);
            }
            else
            {
                m_lockSound = new MySoundPair("ShipLandGearOn");
                m_unlockSound = new MySoundPair("ShipLandGearOff");
                m_failedAttachSound = new MySoundPair("ShipLandGearNothing01");
            }

            SyncObject = new MySyncLandingGear(this);

            Flags |= Sandbox.ModAPI.EntityFlags.NeedsUpdate10 | Sandbox.ModAPI.EntityFlags.NeedsUpdate;
            LoadDummies();
            SlimBlock.ComponentStack.IsFunctionalChanged += ComponentStack_IsFunctionalChanged;
            var builder = objectBuilder as MyObjectBuilder_LandingGear;
            if (builder.IsLocked)
            {
                // This mode will be applied during one-time update, when we have scene prepared.
                LockMode = LandingGearMode.Locked;
                m_needsToRetryLock = true;
            }

            BreakForce = RatioToThreshold(builder.BrakeForce);
            AutoLock = builder.AutoLock;

            IsWorkingChanged += MyLandingGear_IsWorkingChanged;
            UpdateText();
            AddDebugRenderComponent(new Components.MyDebugRenderComponentLandingGear(this));
        }