Added PlaceBuildingInit.

This commit is contained in:
Andre Mohren
2018-07-26 18:50:11 +02:00
committed by abcdefg30
parent 34d887ecc3
commit be2c41d51c

View File

@@ -16,6 +16,9 @@ using OpenRA.Traits;
namespace OpenRA.Mods.Common.Traits namespace OpenRA.Mods.Common.Traits
{ {
// Allows third party mods to detect whether an actor was created by PlaceBuilding.
public class PlaceBuildingInit : IActorInit { }
[Desc("Allows the player to execute build orders.", " Attach this to the player actor.")] [Desc("Allows the player to execute build orders.", " Attach this to the player actor.")]
public class PlaceBuildingInfo : ITraitInfo public class PlaceBuildingInfo : ITraitInfo
{ {
@@ -84,6 +87,7 @@ namespace OpenRA.Mods.Common.Traits
new LocationInit(order.TargetLocation), new LocationInit(order.TargetLocation),
new OwnerInit(order.Player), new OwnerInit(order.Player),
new FactionInit(faction), new FactionInit(faction),
new PlaceBuildingInit()
}); });
foreach (var s in buildingInfo.BuildSounds) foreach (var s in buildingInfo.BuildSounds)
@@ -105,7 +109,8 @@ namespace OpenRA.Mods.Common.Traits
new OwnerInit(order.Player), new OwnerInit(order.Player),
new FactionInit(faction), new FactionInit(faction),
new LineBuildDirectionInit(t.First.X == order.TargetLocation.X ? LineBuildDirection.Y : LineBuildDirection.X), new LineBuildDirectionInit(t.First.X == order.TargetLocation.X ? LineBuildDirection.Y : LineBuildDirection.X),
new LineBuildParentInit(new[] { t.Second, placed }) new LineBuildParentInit(new[] { t.Second, placed }),
new PlaceBuildingInit()
}); });
} }
} }
@@ -153,6 +158,7 @@ namespace OpenRA.Mods.Common.Traits
new LocationInit(order.TargetLocation), new LocationInit(order.TargetLocation),
new OwnerInit(order.Player), new OwnerInit(order.Player),
new FactionInit(faction), new FactionInit(faction),
new PlaceBuildingInit()
}); });
foreach (var s in buildingInfo.BuildSounds) foreach (var s in buildingInfo.BuildSounds)