a bit of cleanup
This commit is contained in:
@@ -42,15 +42,16 @@ namespace OpenRA.Traits
|
|||||||
if (producing == null || producing.Item != order.TargetString || producing.RemainingTime != 0)
|
if (producing == null || producing.Item != order.TargetString || producing.RemainingTime != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var buildingInfo = unit.Traits.Get<BuildingInfo>();
|
||||||
|
|
||||||
if (order.OrderString == "LineBuild")
|
if (order.OrderString == "LineBuild")
|
||||||
{
|
{
|
||||||
bool playSounds = true;
|
bool playSounds = true;
|
||||||
var buildingInfo = unit.Traits.Get<BuildingInfo>();
|
|
||||||
foreach (var t in LineBuildUtils.GetLineBuildCells(w, order.TargetLocation, order.TargetString, buildingInfo))
|
foreach (var t in LineBuildUtils.GetLineBuildCells(w, order.TargetLocation, order.TargetString, buildingInfo))
|
||||||
{
|
{
|
||||||
var building = w.CreateActor(order.TargetString, t, order.Player);
|
var building = w.CreateActor(order.TargetString, t, order.Player);
|
||||||
if (playSounds)
|
if (playSounds)
|
||||||
foreach( var s in building.Info.Traits.Get<BuildingInfo>().BuildSounds )
|
foreach (var s in buildingInfo.BuildSounds)
|
||||||
Sound.PlayToPlayer(order.Player, s, building.CenterLocation);
|
Sound.PlayToPlayer(order.Player, s, building.CenterLocation);
|
||||||
playSounds = false;
|
playSounds = false;
|
||||||
}
|
}
|
||||||
@@ -58,7 +59,7 @@ namespace OpenRA.Traits
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
var building = w.CreateActor(order.TargetString, order.TargetLocation, order.Player);
|
var building = w.CreateActor(order.TargetString, order.TargetLocation, order.Player);
|
||||||
foreach (var s in building.Info.Traits.Get<BuildingInfo>().BuildSounds)
|
foreach (var s in buildingInfo.BuildSounds)
|
||||||
Sound.PlayToPlayer(order.Player, s, building.CenterLocation);
|
Sound.PlayToPlayer(order.Player, s, building.CenterLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user