示例#1
0
 public override void Tick()
 {
     base.Tick();
     if (CanExtractShell && MannedByColonist)
     {
         CompChangeableProjectile compChangeableProjectile = gun.TryGetComp <CompChangeableProjectile>();
         if (!compChangeableProjectile.allowedShellsSettings.AllowedToAccept(compChangeableProjectile.LoadedShell))
         {
             ExtractShell();
         }
     }
     if (forcedTarget.IsValid && !CanSetForcedTarget)
     {
         ResetForcedTarget();
     }
     if (!CanToggleHoldFire)
     {
         holdFire = false;
     }
     if (forcedTarget.ThingDestroyed)
     {
         ResetForcedTarget();
     }
     if ((powerComp == null || powerComp.PowerOn) && (mannableComp == null || mannableComp.MannedNow) && base.Spawned)
     {
         GunCompEq.verbTracker.VerbsTick();
         if (!stunner.Stunned && AttackVerb.state != VerbState.Bursting)
         {
             if (WarmingUp)
             {
                 burstWarmupTicksLeft--;
                 if (burstWarmupTicksLeft == 0)
                 {
                     BeginBurst();
                 }
             }
             else
             {
                 if (burstCooldownTicksLeft > 0)
                 {
                     burstCooldownTicksLeft--;
                 }
                 if (burstCooldownTicksLeft <= 0 && this.IsHashIntervalTick(10))
                 {
                     TryStartShootSomething(canBeginBurstImmediately: true);
                 }
             }
             top.TurretTopTick();
         }
     }
     else
     {
         ResetCurrentTarget();
     }
 }
示例#2
0
 public override void Tick()
 {
     base.Tick();
     if (CanExtractShell && MannedByColonist)
     {
         CompChangeableProjectile compChangeableProjectile = gun.TryGetComp <CompChangeableProjectile>();
         if (!compChangeableProjectile.allowedShellsSettings.AllowedToAccept(compChangeableProjectile.LoadedShell))
         {
             ExtractShell();
         }
     }
     if (forcedTarget.IsValid && !CanSetForcedTarget)
     {
         ResetForcedTarget();
     }
     if (!CanToggleHoldFire)
     {
         holdFire = false;
     }
     if (forcedTarget.ThingDestroyed)
     {
         ResetForcedTarget();
     }
     if (Active && (mannableComp == null || mannableComp.MannedNow) && !stunner.Stunned && base.Spawned)
     {
         GunCompEq.verbTracker.VerbsTick();
         if (AttackVerb.state == VerbState.Bursting)
         {
             return;
         }
         if (WarmingUp)
         {
             burstWarmupTicksLeft--;
             if (burstWarmupTicksLeft == 0)
             {
                 BeginBurst();
             }
         }
         else
         {
             if (burstCooldownTicksLeft > 0)
             {
                 burstCooldownTicksLeft--;
                 if (IsMortar)
                 {
                     if (progressBarEffecter == null)
                     {
                         progressBarEffecter = EffecterDefOf.ProgressBar.Spawn();
                     }
                     progressBarEffecter.EffectTick(this, TargetInfo.Invalid);
                     MoteProgressBar mote = ((SubEffecter_ProgressBar)progressBarEffecter.children[0]).mote;
                     mote.progress = 1f - (float)Math.Max(burstCooldownTicksLeft, 0) / (float)BurstCooldownTime().SecondsToTicks();
                     mote.offsetZ  = -0.8f;
                 }
             }
             if (burstCooldownTicksLeft <= 0 && this.IsHashIntervalTick(10))
             {
                 TryStartShootSomething(canBeginBurstImmediately: true);
             }
         }
         top.TurretTopTick();
     }
     else
     {
         ResetCurrentTarget();
     }
 }