Disables "building"-speech when nothing more can be built
This commit is contained in:
@@ -225,11 +225,8 @@ namespace OpenRA.Mods.RA
|
|||||||
{
|
{
|
||||||
var inQueue = Queue.Count(pi => pi.Item == order.TargetString);
|
var inQueue = Queue.Count(pi => pi.Item == order.TargetString);
|
||||||
var owned = self.Owner.World.ActorsWithTrait<Buildable>().Count(a => a.Actor.Info.Name == order.TargetString && a.Actor.Owner == self.Owner);
|
var owned = self.Owner.World.ActorsWithTrait<Buildable>().Count(a => a.Actor.Info.Name == order.TargetString && a.Actor.Owner == self.Owner);
|
||||||
if (inQueue + owned >= bi.BuildLimit)
|
if (inQueue + owned >= bi.BuildLimit)
|
||||||
{
|
return;
|
||||||
Sound.PlayNotification(self.Owner, "Speech", Info.BlockedAudio, self.Owner.Country.Race);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var n = 0; n < order.TargetLocation.X; n++) // repeat count
|
for (var n = 0; n < order.TargetLocation.X; n++) // repeat count
|
||||||
|
|||||||
@@ -366,7 +366,16 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Sound.PlayNotification(world.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, world.LocalPlayer.Country.Race);
|
{
|
||||||
|
// Check if the item's build-limit has already been reached
|
||||||
|
var queued = CurrentQueue.AllQueued().Count(a => a.Item == unit.Name);
|
||||||
|
var inWorld = world.ActorsWithTrait<Buildable>().Count(a => a.Actor.Info.Name == unit.Name && a.Actor.Owner == world.LocalPlayer);
|
||||||
|
|
||||||
|
if (!((unit.Traits.Get<BuildableInfo>().BuildLimit != 0) && (inWorld + queued >= unit.Traits.Get<BuildableInfo>().BuildLimit)))
|
||||||
|
Sound.PlayNotification(world.LocalPlayer, "Speech", CurrentQueue.Info.QueuedAudio, world.LocalPlayer.Country.Race);
|
||||||
|
else
|
||||||
|
Sound.PlayNotification(world.LocalPlayer, "Speech", CurrentQueue.Info.BlockedAudio, world.LocalPlayer.Country.Race);
|
||||||
|
}
|
||||||
|
|
||||||
StartProduction(world, item);
|
StartProduction(world, item);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user