use integer math to calculate next auto-target scan-time
to combat random desync problem because of rounding problems
This commit is contained in:
@@ -36,8 +36,8 @@ namespace OpenRA.Mods.RA
|
||||
public readonly bool AlignIdleTurrets = false;
|
||||
public readonly bool CanAttackGround = true;
|
||||
|
||||
public readonly float ScanTimeAverage = 2f;
|
||||
public readonly float ScanTimeSpread = .5f;
|
||||
public readonly int MinimumScanTimeInterval = 30;
|
||||
public readonly int MaximumScanTimeInterval = 60;
|
||||
|
||||
public abstract object Create(ActorInitializer init);
|
||||
|
||||
|
||||
@@ -107,9 +107,7 @@ namespace OpenRA.Mods.RA
|
||||
Actor ChooseTarget(Actor self, float range)
|
||||
{
|
||||
var info = self.Info.Traits.Get<AttackBaseInfo>();
|
||||
nextScanTime = (int)(25 * (info.ScanTimeAverage +
|
||||
(self.World.SharedRandom.NextFloat() * 2 - 1) * info.ScanTimeSpread));
|
||||
Log.Write("debug", "Actor {0}; nextScanTime: {1}", self.ActorID, nextScanTime);
|
||||
nextScanTime = self.World.SharedRandom.Next(info.MinimumScanTimeInterval, info.MaximumScanTimeInterval);
|
||||
|
||||
var inRange = self.World.FindUnitsInCircle(self.CenterLocation, (int)(Game.CellSize * range));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user