Make Tick return bool

This commit is contained in:
tovl
2019-05-14 21:13:25 +02:00
committed by teinarss
parent 09c1611239
commit 3790169db9
49 changed files with 328 additions and 318 deletions

View File

@@ -46,13 +46,13 @@ namespace OpenRA.Mods.Cnc.Traits
this.forceAttack = forceAttack;
}
public override Activity Tick(Actor self)
public override bool Tick(Actor self)
{
if (IsCanceling || !target.IsValidFor(self))
return NextActivity;
return true;
if (attack.IsTraitDisabled)
return this;
return false;
var weapon = attack.ChooseArmamentsForTarget(target, forceAttack).FirstOrDefault();
if (weapon != null)
@@ -60,13 +60,13 @@ namespace OpenRA.Mods.Cnc.Traits
// Check that AttackTDGunboatTurreted hasn't cancelled the target by modifying attack.Target
// Having both this and AttackTDGunboatTurreted modify that field is a horrible hack.
if (hasTicked && attack.RequestedTarget.Type == TargetType.Invalid)
return NextActivity;
return true;
attack.SetRequestedTarget(self, target);
hasTicked = true;
}
return NextActivity;
return true;
}
}
}

View File

@@ -94,13 +94,13 @@ namespace OpenRA.Mods.Cnc.Traits
this.forceAttack = forceAttack;
}
public override Activity Tick(Actor self)
public override bool Tick(Actor self)
{
if (IsCanceling || !attack.CanAttack(self, target))
return NextActivity;
return true;
if (attack.charges == 0)
return this;
return false;
foreach (var notify in self.TraitsImplementing<INotifyTeslaCharging>())
notify.Charging(self, target);
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Cnc.Traits
QueueChild(new Wait(attack.info.InitialChargeDelay));
QueueChild(new ChargeFire(attack, target));
return this;
return false;
}
void IActivityNotifyStanceChanged.StanceChanged(Actor self, AutoTarget autoTarget, UnitStance oldStance, UnitStance newStance)
@@ -145,18 +145,18 @@ namespace OpenRA.Mods.Cnc.Traits
this.target = target;
}
public override Activity Tick(Actor self)
public override bool Tick(Actor self)
{
if (IsCanceling || !attack.CanAttack(self, target))
return NextActivity;
return true;
if (attack.charges == 0)
return NextActivity;
return true;
attack.DoAttack(self, target);
QueueChild(new Wait(attack.info.ChargeDelay));
return this;
return false;
}
}
}