Fix a bad comparison against Target.Invalid.

Target.Invalid acts like a NaN, and will not compare equal with itself. Compare against the TargetType instead, which performs the intended comparison.
This commit is contained in:
RoosterDragon
2025-02-11 18:58:14 +00:00
committed by Paul Chote
parent 97f81d0aa4
commit aebb97967d

View File

@@ -195,7 +195,7 @@ namespace OpenRA.Mods.Common.Traits
// Tell the idle harvester to quit slacking:
var newSafeResourcePatch = FindNextResource(h.Actor, h);
AIUtils.BotDebug($"AI: Harvester {h.Actor} is idle. Ordering to {newSafeResourcePatch} in search for new resources.");
if (newSafeResourcePatch != Target.Invalid)
if (newSafeResourcePatch.Type != TargetType.Invalid)
bot.QueueOrder(new Order("Harvest", h.Actor, newSafeResourcePatch, false));
else
h.NoResourcesCooldown = Info.ScanIntervalMultiplerWhenNoResources;