Skip to content

Commit

Permalink
Fix DelayablePathfinderAction
Browse files Browse the repository at this point in the history
  • Loading branch information
Windows10CE committed Aug 6, 2021
1 parent 9d0dcbe commit e66581f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions PathfinderAPI/Action/DelayablePathfinderAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ public abstract class DelayablePathfinderAction : PathfinderAction

public sealed override void Trigger(object os_obj)
{
if (delayHost == null && DelayHost != null)
{
var delayComp = Programs.getComputer(OS.currentInstance, DelayHost);
if (delayComp == null)
throw new FormatException($"{this.GetType().Name}: DelayHost could not be found");
delayHost = DelayableActionSystem.FindDelayableActionSystemOnComputer(delayComp);
}

if (delay <= 0f || delayHost == null)
{
Trigger((OS)os_obj);
Expand All @@ -36,14 +44,6 @@ public override void LoadFromXml(ElementInfo info)

if (Delay != null && !float.TryParse(Delay, out delay))
throw new FormatException($"{this.GetType().Name}: Couldn't parse delay time!");

if (DelayHost != null)
{
var delayComp = Programs.getComputer(OS.currentInstance, DelayHost);
if (delayComp == null)
throw new FormatException($"{this.GetType().Name}: DelayHost could not be found");
delayHost = DelayableActionSystem.FindDelayableActionSystemOnComputer(delayComp);
}
}
}
}

0 comments on commit e66581f

Please sign in to comment.