Custom build sounds for walls
This commit is contained in:
@@ -46,8 +46,10 @@ namespace OpenRa.Traits.Activities
|
||||
var rb = self.traits.Get<RenderBuilding>();
|
||||
rb.PlayCustomAnimBackwards(self, "make",
|
||||
() => self.World.AddFrameEndTask(w => DoUndeploy(w,self)));
|
||||
|
||||
Sound.PlayToPlayer(self.Owner, self.Owner.PlayerActor.Info.Traits.Get<PlaceBuildingInfo>().SellSound);
|
||||
|
||||
foreach (var s in self.Info.Traits.Get<BuildingInfo>().SellSounds)
|
||||
Sound.PlayToPlayer(self.Owner, s);
|
||||
|
||||
started = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#region Copyright & License Information
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||
* This file is part of OpenRA.
|
||||
@@ -49,6 +49,9 @@ namespace OpenRa.Traits
|
||||
public readonly int2 Dimensions = new int2(1, 1);
|
||||
public readonly bool Unsellable = false;
|
||||
|
||||
public readonly string[] BuildSounds = {"placbldg.aud", "build5.aud"};
|
||||
public readonly string[] SellSounds = {"cashturn.aud"};
|
||||
|
||||
public object Create(Actor self) { return new Building(self); }
|
||||
}
|
||||
|
||||
|
||||
@@ -22,11 +22,7 @@ using System.Linq;
|
||||
|
||||
namespace OpenRa.Traits
|
||||
{
|
||||
class PlaceBuildingInfo : StatelessTraitInfo<PlaceBuilding>
|
||||
{
|
||||
public readonly string[] BuildSounds = {"placbldg.aud", "build5.aud"};
|
||||
public readonly string SellSound = "cashturn.aud";
|
||||
}
|
||||
class PlaceBuildingInfo : StatelessTraitInfo<PlaceBuilding> {}
|
||||
|
||||
class PlaceBuilding : IResolveOrder
|
||||
{
|
||||
@@ -42,10 +38,9 @@ namespace OpenRa.Traits
|
||||
if( producing == null || producing.Item != order.TargetString || producing.RemainingTime != 0 )
|
||||
return;
|
||||
|
||||
self.World.CreateActor( order.TargetString, order.TargetLocation, order.Player );
|
||||
var info = self.Info.Traits.Get<PlaceBuildingInfo>();
|
||||
|
||||
foreach (var s in info.BuildSounds)
|
||||
var building = self.World.CreateActor( order.TargetString, order.TargetLocation, order.Player );
|
||||
|
||||
foreach (var s in building.Info.Traits.Get<BuildingInfo>().BuildSounds)
|
||||
Sound.PlayToPlayer(order.Player, s);
|
||||
|
||||
var facts = self.World.Queries.OwnedBy[self.Owner]
|
||||
|
||||
@@ -128,7 +128,8 @@ namespace OpenRa.Traits
|
||||
if( !Game.skipMakeAnims && self.Info.Traits.Get<RenderBuildingInfo>().HasMakeAnimation )
|
||||
anim.PlayBackwardsThen( "make", null );
|
||||
|
||||
Sound.PlayToPlayer(self.Owner, self.Owner.PlayerActor.Info.Traits.Get<PlaceBuildingInfo>().SellSound);
|
||||
foreach (var s in self.Info.Traits.Get<BuildingInfo>().SellSounds)
|
||||
Sound.PlayToPlayer(self.Owner, s);
|
||||
}
|
||||
|
||||
public void Sold(Actor self) { DoBib(self, true); }
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
Building:
|
||||
Dimensions: 1,1
|
||||
Footprint: x
|
||||
BuildSounds: constru2.aud, hvydoor1.aud
|
||||
SellSounds: cashturn.aud
|
||||
RenderBuilding:
|
||||
|
||||
^Tree:
|
||||
@@ -57,6 +59,8 @@
|
||||
Building:
|
||||
Dimensions: 1,1
|
||||
Footprint: x
|
||||
BuildSounds: hvydoor1.aud
|
||||
SellSounds: cashturn.aud
|
||||
Capturable: false
|
||||
Bib: no
|
||||
Crewed: no
|
||||
|
||||
@@ -22,8 +22,6 @@ Player:
|
||||
NavalUnitLost: unitlost.aud
|
||||
PrimaryBuildingSelected: pribldg1.aud
|
||||
PlaceBuilding:
|
||||
BuildSounds: constru2.aud, hvydoor1.aud
|
||||
SellSound: cashturn.aud
|
||||
SpawnDefaultUnits:
|
||||
|
||||
World:
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
Building:
|
||||
Dimensions: 1,1
|
||||
Footprint: x
|
||||
BuildSounds: placbldg.aud
|
||||
Capturable: false
|
||||
Bib: no
|
||||
Crewed: no
|
||||
|
||||
Reference in New Issue
Block a user