Un-hardcode production audio
This commit is contained in:
@@ -961,8 +961,10 @@ namespace OpenRa
|
||||
|
||||
void StartProduction( World world, string item )
|
||||
{
|
||||
var queueInfo = world.LocalPlayer.PlayerActor.Info.Traits.Get<ProductionQueueInfo>();
|
||||
var unit = Rules.Info[item];
|
||||
Sound.Play(unit.Traits.Contains<BuildingInfo>() ? "abldgin1.aud" : "train1.aud");
|
||||
|
||||
Sound.Play(unit.Traits.Contains<BuildingInfo>() ? queueInfo.BuildingSelectAudio : queueInfo.UnitSelectAudio);
|
||||
Game.IssueOrder(Order.StartProduction(world.LocalPlayer, item));
|
||||
}
|
||||
|
||||
@@ -971,9 +973,10 @@ namespace OpenRa
|
||||
var player = world.LocalPlayer;
|
||||
var unit = Rules.Info[item];
|
||||
var queue = player.PlayerActor.traits.Get<Traits.ProductionQueue>();
|
||||
var queueInfo = player.PlayerActor.Info.Traits.Get<Traits.ProductionQueueInfo>();
|
||||
var producing = queue.AllItems(unit.Category).FirstOrDefault( a => a.Item == item );
|
||||
|
||||
Sound.Play("ramenu1.aud");
|
||||
Sound.Play(queueInfo.ClickAudio);
|
||||
|
||||
if (isLmb)
|
||||
{
|
||||
@@ -1002,12 +1005,12 @@ namespace OpenRa
|
||||
// instant cancel of things we havent really started yet, and things that are finished
|
||||
if (producing.Paused || producing.Done || producing.TotalCost == producing.RemainingCost)
|
||||
{
|
||||
Sound.Play("cancld1.aud");
|
||||
Sound.Play(queueInfo.CancelledAudio);
|
||||
Game.IssueOrder(Order.CancelProduction(player, item));
|
||||
}
|
||||
else
|
||||
{
|
||||
Sound.Play("onhold1.aud");
|
||||
Sound.Play(queueInfo.OnHoldAudio);
|
||||
Game.IssueOrder(Order.PauseProduction(player, item, true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ namespace OpenRa.Orders
|
||||
if (!world.CanPlaceBuilding( Building, BuildingInfo, topLeft, null)
|
||||
|| !world.IsCloseEnoughToBase(Producer.Owner, Building, BuildingInfo, topLeft))
|
||||
{
|
||||
Sound.Play("nodeply1.aud");
|
||||
var queueInfo = world.LocalPlayer.PlayerActor.Info.Traits.Get<ProductionQueueInfo>();
|
||||
Sound.Play(queueInfo.BuildingCannotPlaceAudio);
|
||||
yield break;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,15 @@ namespace OpenRa.Traits
|
||||
{
|
||||
class ProductionQueueInfo : ITraitInfo
|
||||
{
|
||||
public readonly string BuildingSelectAudio = "abldgin1.aud";
|
||||
public readonly string BuildingReadyAudio = "conscmp1.aud";
|
||||
public readonly string BuildingCannotPlaceAudio = "nodeply1.aud";
|
||||
public readonly string UnitSelectAudio = "train1.aud";
|
||||
public readonly string UnitReadyAudio = "unitrdy1.aud";
|
||||
public readonly string OnHoldAudio = "onhold1.aud";
|
||||
public readonly string CancelledAudio = "cancld1.aud";
|
||||
public readonly string ClickAudio = "ramenu1.aud";
|
||||
|
||||
public object Create(Actor self) { return new ProductionQueue(self); }
|
||||
}
|
||||
|
||||
@@ -55,7 +64,7 @@ namespace OpenRa.Traits
|
||||
var isBuilding = unit.Traits.Contains<BuildingInfo>();
|
||||
if( !hasPlayedSound )
|
||||
{
|
||||
Sound.PlayToPlayer( order.Player, isBuilding ? "conscmp1.aud" : "unitrdy1.aud" );
|
||||
Sound.PlayToPlayer( order.Player, isBuilding ? self.Info.Traits.Get<ProductionQueueInfo>().BuildingReadyAudio : self.Info.Traits.Get<ProductionQueueInfo>().UnitReadyAudio );
|
||||
hasPlayedSound = true;
|
||||
}
|
||||
if( !isBuilding )
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
Player:
|
||||
ProductionQueue:
|
||||
BuildingSelectAudio: bldging1.aud
|
||||
BuildingReadyAudio: constru1.aud
|
||||
BuildingCannotPlaceAudio: deploy1.aud
|
||||
UnitSelectAudio: bldging1.aud
|
||||
UnitReadyAudio: unitredy.aud
|
||||
OnHoldAudio: onhold1.aud
|
||||
CancelledAudio: cancel1.aud
|
||||
ClickAudio: button.aud
|
||||
PlaceBuilding:
|
||||
|
||||
World:
|
||||
@@ -93,8 +101,8 @@ PROC:
|
||||
Prerequisites: nuke
|
||||
Owner: allies,soviet
|
||||
Cost: 2000
|
||||
Description: Ore Refinery
|
||||
LongDesc: Converts Ore and Gems into money
|
||||
Description: Tiberium Refinery
|
||||
LongDesc: Processes Tiberium into useable resources
|
||||
Building:
|
||||
Power: -30
|
||||
Footprint: _x_ xxx x==
|
||||
|
||||
Reference in New Issue
Block a user