Fix repair depot crash
This commit is contained in:
@@ -17,21 +17,21 @@ namespace OpenRA.Mods.RA.Activities
|
||||
{
|
||||
public class Rearm : Activity
|
||||
{
|
||||
|
||||
readonly LimitedAmmo limitedAmmo;
|
||||
int ticksPerPip = 25 * 2;
|
||||
int remainingTicks = 25 * 2;
|
||||
|
||||
public Rearm(Actor actor)
|
||||
{
|
||||
ticksPerPip = actor.TraitOrDefault<LimitedAmmo>().ReloadTimePerAmmo();
|
||||
public Rearm(Actor self)
|
||||
{
|
||||
limitedAmmo = self.TraitOrDefault<LimitedAmmo>();
|
||||
if (limitedAmmo != null)
|
||||
ticksPerPip = limitedAmmo.ReloadTimePerAmmo();
|
||||
remainingTicks = ticksPerPip;
|
||||
}
|
||||
|
||||
public override Activity Tick(Actor self)
|
||||
{
|
||||
if (IsCanceled) return NextActivity;
|
||||
var limitedAmmo = self.TraitOrDefault<LimitedAmmo>();
|
||||
if (limitedAmmo == null) return NextActivity;
|
||||
if (IsCanceled || limitedAmmo == null) return NextActivity;
|
||||
|
||||
if (--remainingTicks == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user