Moved SellSounds from Building to Sellable & added upgrade to rules.
This commit is contained in:
@@ -34,7 +34,6 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
public readonly bool AllowInvalidPlacement = false;
|
public readonly bool AllowInvalidPlacement = false;
|
||||||
|
|
||||||
public readonly string[] BuildSounds = { "placbldg.aud", "build5.aud" };
|
public readonly string[] BuildSounds = { "placbldg.aud", "build5.aud" };
|
||||||
public readonly string[] SellSounds = { "cashturn.aud" };
|
|
||||||
public readonly string[] UndeploySounds = { "cashturn.aud" };
|
public readonly string[] UndeploySounds = { "cashturn.aud" };
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new Building(init, this); }
|
public object Create(ActorInitializer init) { return new Building(init, this); }
|
||||||
@@ -176,9 +175,6 @@ namespace OpenRA.Mods.RA.Buildings
|
|||||||
|
|
||||||
public void Selling(Actor self)
|
public void Selling(Actor self)
|
||||||
{
|
{
|
||||||
foreach (var s in Info.SellSounds)
|
|
||||||
Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
|
|
||||||
|
|
||||||
BuildComplete = false;
|
BuildComplete = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using OpenRA.Mods.RA.Activities;
|
using OpenRA.Mods.RA.Activities;
|
||||||
using OpenRA.Mods.RA.Buildings;
|
using OpenRA.Mods.RA.Buildings;
|
||||||
using OpenRA.Mods.RA.Render;
|
using OpenRA.Mods.RA.Render;
|
||||||
@@ -15,14 +16,22 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
[Desc("Building can be sold")]
|
|
||||||
public class SellableInfo : TraitInfo<Sellable>
|
[Desc("Actor can be sold")]
|
||||||
|
public class SellableInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly int RefundPercent = 50;
|
public readonly int RefundPercent = 50;
|
||||||
|
public readonly string[] SellSounds = { };
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new Sellable(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Sellable : IResolveOrder
|
public class Sellable : IResolveOrder
|
||||||
{
|
{
|
||||||
|
readonly SellableInfo info;
|
||||||
|
|
||||||
|
public Sellable(SellableInfo info) { this.info = info; }
|
||||||
|
|
||||||
public void ResolveOrder(Actor self, Order order)
|
public void ResolveOrder(Actor self, Order order)
|
||||||
{
|
{
|
||||||
if (order.OrderString == "Sell")
|
if (order.OrderString == "Sell")
|
||||||
@@ -37,6 +46,9 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
self.CancelActivity();
|
self.CancelActivity();
|
||||||
|
|
||||||
|
foreach (var s in info.SellSounds)
|
||||||
|
Sound.PlayToPlayer(self.Owner, s, self.CenterPosition);
|
||||||
|
|
||||||
foreach (var ns in self.TraitsImplementing<INotifySold>())
|
foreach (var ns in self.TraitsImplementing<INotifySold>())
|
||||||
ns.Selling(self);
|
ns.Selling(self);
|
||||||
|
|
||||||
|
|||||||
@@ -488,6 +488,33 @@ namespace OpenRA.Utility
|
|||||||
node.Key = "DeathType";
|
node.Key = "DeathType";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SellSounds from Building was moved into Sellable
|
||||||
|
if (engineVersion < 20140904)
|
||||||
|
{
|
||||||
|
if (depth == 0)
|
||||||
|
{
|
||||||
|
var actorTraits = node.Value.Nodes;
|
||||||
|
var building = actorTraits.FirstOrDefault(t => t.Key == "Building");
|
||||||
|
if (building != null)
|
||||||
|
{
|
||||||
|
var buildingFields = building.Value.Nodes;
|
||||||
|
var sellSounds = buildingFields.FirstOrDefault(n => n.Key == "SellSounds");
|
||||||
|
if (sellSounds != null)
|
||||||
|
{
|
||||||
|
buildingFields.Remove(sellSounds);
|
||||||
|
var sellable = actorTraits.FirstOrDefault(t => t.Key == "Sellable");
|
||||||
|
if (sellable != null)
|
||||||
|
sellable.Value.Nodes.Add(sellSounds);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Console.WriteLine("Warning: Adding Sellable trait to {0} in {1}".F(node.Key, node.Location.Filename));
|
||||||
|
actorTraits.Add(new MiniYamlNode("Sellable", new MiniYaml("", new List<MiniYamlNode> { sellSounds })));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -334,7 +334,6 @@
|
|||||||
Dimensions: 1,1
|
Dimensions: 1,1
|
||||||
Footprint: x
|
Footprint: x
|
||||||
BuildSounds: constru2.aud, hvydoor1.aud
|
BuildSounds: constru2.aud, hvydoor1.aud
|
||||||
SellSounds: cashturn.aud
|
|
||||||
TerrainTypes: Clear,Road
|
TerrainTypes: Clear,Road
|
||||||
SoundOnDamageTransition:
|
SoundOnDamageTransition:
|
||||||
DamagedSound: xplos.aud
|
DamagedSound: xplos.aud
|
||||||
@@ -374,6 +373,7 @@
|
|||||||
GivesBuildableArea:
|
GivesBuildableArea:
|
||||||
EngineerRepairable:
|
EngineerRepairable:
|
||||||
Sellable:
|
Sellable:
|
||||||
|
SellSounds: cashturn.aud
|
||||||
Capturable:
|
Capturable:
|
||||||
|
|
||||||
^CivBuilding:
|
^CivBuilding:
|
||||||
@@ -473,6 +473,7 @@
|
|||||||
RelativeToTopLeft: yes
|
RelativeToTopLeft: yes
|
||||||
AutoTargetIgnore:
|
AutoTargetIgnore:
|
||||||
Sellable:
|
Sellable:
|
||||||
|
SellSounds: cashturn.aud
|
||||||
Guardable:
|
Guardable:
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
FrozenUnderFog:
|
FrozenUnderFog:
|
||||||
|
|||||||
@@ -243,7 +243,6 @@
|
|||||||
Footprint: x
|
Footprint: x
|
||||||
TerrainTypes: Rock, Concrete
|
TerrainTypes: Rock, Concrete
|
||||||
BuildSounds: BUILD1.WAV
|
BuildSounds: BUILD1.WAV
|
||||||
SellSounds: BUILD1.WAV
|
|
||||||
Adjacent: 3
|
Adjacent: 3
|
||||||
GivesBuildableArea:
|
GivesBuildableArea:
|
||||||
ExternalCapturable:
|
ExternalCapturable:
|
||||||
@@ -268,6 +267,7 @@
|
|||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types: Building
|
Types: Building
|
||||||
Sellable:
|
Sellable:
|
||||||
|
SellSounds: BUILD1.WAV
|
||||||
GivesBounty:
|
GivesBounty:
|
||||||
CombatDebugOverlay:
|
CombatDebugOverlay:
|
||||||
Guardable:
|
Guardable:
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
Adjacent: 4
|
Adjacent: 4
|
||||||
TerrainTypes: Rock
|
TerrainTypes: Rock
|
||||||
BuildSounds: CHUNG.WAV
|
BuildSounds: CHUNG.WAV
|
||||||
SellSounds: CHUNG.WAV
|
|
||||||
AllowInvalidPlacement: true
|
AllowInvalidPlacement: true
|
||||||
LaysTerrain:
|
LaysTerrain:
|
||||||
Template: 88
|
Template: 88
|
||||||
@@ -412,7 +411,6 @@ CONCRETEB:
|
|||||||
AppearsOnRadar:
|
AppearsOnRadar:
|
||||||
Building:
|
Building:
|
||||||
BuildSounds: CHUNG.WAV
|
BuildSounds: CHUNG.WAV
|
||||||
SellSounds: CHUNG.WAV
|
|
||||||
Adjacent: 7
|
Adjacent: 7
|
||||||
TerrainTypes: Rock, Concrete
|
TerrainTypes: Rock, Concrete
|
||||||
Health:
|
Health:
|
||||||
@@ -436,6 +434,7 @@ CONCRETEB:
|
|||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types: Wall
|
Types: Wall
|
||||||
Sellable:
|
Sellable:
|
||||||
|
SellSounds: CHUNG.WAV
|
||||||
Guardable:
|
Guardable:
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
ThrowsShrapnel:
|
ThrowsShrapnel:
|
||||||
@@ -462,6 +461,7 @@ WALL:
|
|||||||
Building:
|
Building:
|
||||||
Adjacent: 4
|
Adjacent: 4
|
||||||
BuildSounds: CHUNG.WAV
|
BuildSounds: CHUNG.WAV
|
||||||
|
Sellable:
|
||||||
SellSounds: CHUNG.WAV
|
SellSounds: CHUNG.WAV
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 32,40,0,-8
|
Bounds: 32,40,0,-8
|
||||||
@@ -514,6 +514,7 @@ WALL:
|
|||||||
Building:
|
Building:
|
||||||
Adjacent: 4
|
Adjacent: 4
|
||||||
BuildSounds: CHUNG.WAV
|
BuildSounds: CHUNG.WAV
|
||||||
|
Sellable:
|
||||||
SellSounds: CHUNG.WAV
|
SellSounds: CHUNG.WAV
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 32,40,0,-8
|
Bounds: 32,40,0,-8
|
||||||
|
|||||||
@@ -298,6 +298,7 @@
|
|||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types: Building
|
Types: Building
|
||||||
Sellable:
|
Sellable:
|
||||||
|
SellSounds: cashturn.aud
|
||||||
AcceptsSupplies:
|
AcceptsSupplies:
|
||||||
GivesBounty:
|
GivesBounty:
|
||||||
UpdatesPlayerStatistics:
|
UpdatesPlayerStatistics:
|
||||||
@@ -348,6 +349,7 @@
|
|||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types: Wall
|
Types: Wall
|
||||||
Sellable:
|
Sellable:
|
||||||
|
SellSounds: cashturn.aud
|
||||||
Guardable:
|
Guardable:
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
FrozenUnderFog:
|
FrozenUnderFog:
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types: Building
|
Types: Building
|
||||||
Sellable:
|
Sellable:
|
||||||
|
SellSounds: cashturn.aud
|
||||||
AcceptsSupplies:
|
AcceptsSupplies:
|
||||||
GivesBounty:
|
GivesBounty:
|
||||||
UpdatesPlayerStatistics:
|
UpdatesPlayerStatistics:
|
||||||
@@ -75,6 +76,7 @@
|
|||||||
ProximityCaptor:
|
ProximityCaptor:
|
||||||
Types: Wall
|
Types: Wall
|
||||||
Sellable:
|
Sellable:
|
||||||
|
SellSounds: cashturn.aud
|
||||||
UpdatesPlayerStatistics:
|
UpdatesPlayerStatistics:
|
||||||
BodyOrientation:
|
BodyOrientation:
|
||||||
LuaScriptEvents:
|
LuaScriptEvents:
|
||||||
|
|||||||
Reference in New Issue
Block a user