Let harvesters tick idle for a while before queueing Wait activity
This commit is contained in:
@@ -57,6 +57,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Search radius (in cells) from the last harvest order location to find more resources.")]
|
[Desc("Search radius (in cells) from the last harvest order location to find more resources.")]
|
||||||
public readonly int SearchFromOrderRadius = 12;
|
public readonly int SearchFromOrderRadius = 12;
|
||||||
|
|
||||||
|
[Desc("Maximum duration of being idle before queueing a Wait activity.")]
|
||||||
|
public readonly int MaxIdleDuration = 25;
|
||||||
|
|
||||||
|
[Desc("Duration to wait before becoming idle again.")]
|
||||||
|
public readonly int WaitDuration = 25;
|
||||||
|
|
||||||
[VoiceReference] public readonly string HarvestVoice = "Action";
|
[VoiceReference] public readonly string HarvestVoice = "Action";
|
||||||
[VoiceReference] public readonly string DeliverVoice = "Action";
|
[VoiceReference] public readonly string DeliverVoice = "Action";
|
||||||
|
|
||||||
@@ -239,6 +245,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int idleDuration;
|
||||||
public void TickIdle(Actor self)
|
public void TickIdle(Actor self)
|
||||||
{
|
{
|
||||||
// Should we be intelligent while idle?
|
// Should we be intelligent while idle?
|
||||||
@@ -252,9 +259,16 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
|
|
||||||
UnblockRefinery(self);
|
UnblockRefinery(self);
|
||||||
|
idleDuration += 1;
|
||||||
|
|
||||||
|
// Wait a bit before queueing Wait activity
|
||||||
|
if (idleDuration > Info.MaxIdleDuration)
|
||||||
|
{
|
||||||
|
idleDuration = 0;
|
||||||
|
|
||||||
// Wait for a bit before becoming idle again:
|
// Wait for a bit before becoming idle again:
|
||||||
self.QueueActivity(new Wait(10));
|
self.QueueActivity(new Wait(Info.WaitDuration));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns true when unloading is complete
|
// Returns true when unloading is complete
|
||||||
|
|||||||
Reference in New Issue
Block a user