Ejemplo n.º 1
0
        private bool DoDrillAction(bool collectOre)
        {
            m_tryingToDrill = true;
            SinkComp.Update();

            if (!SinkComp.IsPoweredByType(MyResourceDistributorComponent.ElectricityId))
            {
                return(false);
            }

            m_lastTimeDrilled = MySandboxGame.TotalGamePlayTimeInMilliseconds;
            m_drillBase.Drill(collectOre, assignDamagedMaterial: true, speedMultiplier: m_speedMultiplier);
            m_spikeLastUpdateTime = MySandboxGame.TotalGamePlayTimeInMilliseconds;

            return(true);
        }
        public override void UpdateAfterSimulation()
        {
            base.UpdateAfterSimulation();

            //MyRenderProxy.DebugDrawSphere(m_gunBase.PositionMuzzleWorld, 0.2f, new Vector3(1, 0, 0), 1.0f, true);


            if (Owner == null)
            {
                return;
            }

            Vector3  weaponLocalPosition = Owner.GetLocalWeaponPosition();
            Vector3D localDummyPosition  = m_gunBase.GetMuzzleLocalPosition();
            MatrixD  weaponWorld         = WorldMatrix;
            Vector3D localDummyPositionRotated;

            Vector3D.Rotate(ref localDummyPosition, ref weaponWorld, out localDummyPositionRotated);
            m_raycastComponent.SetPointOfReference(Owner.PositionComp.GetPosition() + weaponLocalPosition + localDummyPositionRotated);

            SinkComp.Update();

            if (IsShooting && !SinkComp.IsPoweredByType(MyResourceDistributorComponent.ElectricityId))
            {
                EndShoot(MyShootActionEnum.PrimaryAction);
            }

            UpdateEffect();
            CheckEffectType();

            if (Owner != null && Owner.ControllerInfo.IsLocallyHumanControlled())
            {
                if (MySession.Static.SurvivalMode && (MySession.Static.GetCameraControllerEnum() != MyCameraControllerEnum.Spectator || MyFinalBuildConstants.IS_OFFICIAL))
                {
                    var character = ((MyCharacter)this.CharacterInventory.Owner);
                    MyCubeBuilder.Static.MaxGridDistanceFrom = character.PositionComp.GetPosition() + character.WorldMatrix.Up * 1.8f;
                }
                else
                {
                    MyCubeBuilder.Static.MaxGridDistanceFrom = null;
                }
            }

            //MyTrace.Watch("MyEngineerToolBase.RequiredPowerInput", RequiredPowerInput);
        }
        public virtual void Shoot(MyShootActionEnum action, Vector3 direction, Vector3D?overrideWeaponPos, string gunAction)
        {
            if (action != MyShootActionEnum.PrimaryAction)
            {
                return;
            }

            m_lastTimeShoot = MySandboxGame.TotalGamePlayTimeInMilliseconds;

            m_shootFrameCounter++;
            m_tryingToShoot = true;
            SinkComp.Update();
            if (!SinkComp.IsPoweredByType(MyResourceDistributorComponent.ElectricityId))
            {
                CurrentEffect = 0;
                return;
            }

            m_activated = true;

            var targetBlock = GetTargetBlock();

            if (targetBlock == null)
            {
                CurrentEffect = 2;
                ShakeAmount   = m_handItemDef.ShakeAmountNoTarget;
            }

            int currentTime = MySandboxGame.TotalGamePlayTimeInMilliseconds;

            if (targetBlock != null)
            {
                ShakeAmount   = m_handItemDef.ShakeAmountTarget;
                CurrentEffect = 1;
            }
            return;
        }
Ejemplo n.º 4
0
 protected override bool CheckIsWorking()
 {
     return(SinkComp.IsPoweredByType(MyResourceDistributorComponent.ElectricityId) && base.CheckIsWorking());
 }