protected void TryStartShootSomething(bool canBeginBurstImmediately) { if (!base.Spawned || (holdFire && CanToggleHoldFire) || (AttackVerb.ProjectileFliesOverhead() && base.Map.roofGrid.Roofed(base.Position)) || !AttackVerb.Available()) { ResetCurrentTarget(); } else { bool isValid = currentTargetInt.IsValid; if (forcedTarget.IsValid) { currentTargetInt = forcedTarget; } else { currentTargetInt = TryFindNewTarget(); } if (!isValid && currentTargetInt.IsValid) { SoundDefOf.TurretAcquireTarget.PlayOneShot(new TargetInfo(base.Position, base.Map)); } if (currentTargetInt.IsValid) { if (def.building.turretBurstWarmupTime > 0f) { burstWarmupTicksLeft = def.building.turretBurstWarmupTime.SecondsToTicks(); } else if (canBeginBurstImmediately) { BeginBurst(); } else { burstWarmupTicksLeft = 1; } } else { ResetCurrentTarget(); } } }
protected new virtual void TryStartShootSomething(bool canBeginBurstImmediately) { if (progressBarEffecter != null) { progressBarEffecter.Cleanup(); progressBarEffecter = null; } if (!Spawned || ((bool)AccessTools.Field(typeof(Building_TurretGun), "holdFire")?.GetValue(this) && CanToggleHoldFire) || (AttackVerb.ProjectileFliesOverhead() && Map.roofGrid.Roofed(Position)) || !AttackVerb.Available()) { ResetCurrentTarget(); return; } bool isValid = currentTargetInt.IsValid || worldTarget.IsValid; if (forcedTarget.IsValid) { currentTargetInt = forcedTarget; } else { currentTargetInt = TryFindNewTarget(); } if (forcedWorldTarget.IsValid) { worldTarget = forcedWorldTarget; } else { //Find new target? } if (!isValid && (currentTargetInt.IsValid || worldTarget.IsValid)) { SoundDefOf.TurretAcquireTarget.PlayOneShot(new TargetInfo(Position, Map, false)); } if (!currentTargetInt.IsValid && !worldTarget.IsValid) { ResetCurrentTarget(); return; } if (def.building.turretBurstWarmupTime > 0f) { burstWarmupTicksLeft = def.building.turretBurstWarmupTime.SecondsToTicks(); return; } if (canBeginBurstImmediately) { BeginBurst(); return; } burstWarmupTicksLeft = 1; }