From e66581f5501d9baf8f0102ec9e0f0f43af07d2a6 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Fri, 6 Aug 2021 05:04:26 -0500 Subject: [PATCH] Fix DelayablePathfinderAction --- .../Action/DelayablePathfinderAction.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/PathfinderAPI/Action/DelayablePathfinderAction.cs b/PathfinderAPI/Action/DelayablePathfinderAction.cs index 171519ea..ae2ede83 100644 --- a/PathfinderAPI/Action/DelayablePathfinderAction.cs +++ b/PathfinderAPI/Action/DelayablePathfinderAction.cs @@ -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); @@ -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); - } } } }