Add property requirements to safe traits

This commit is contained in:
atlimit8
2015-07-11 16:30:27 -05:00
parent 7881ff40bf
commit 1bcc07ce69
50 changed files with 68 additions and 41 deletions

View File

@@ -22,7 +22,7 @@ namespace OpenRA.Mods.D2k.Traits
"If you want more than one unit to be delivered, copy this section and assign IDs like FreeActorWithDelivery@2, ...")]
public class FreeActorWithDeliveryInfo : FreeActorInfo
{
[ActorReference]
[ActorReference, FieldLoader.Require]
[Desc("Name of the delivering actor. This actor must have the `Carryall` trait")]
public readonly string DeliveringActor = null;
@@ -43,11 +43,6 @@ namespace OpenRA.Mods.D2k.Traits
public FreeActorWithDelivery(ActorInitializer init, FreeActorWithDeliveryInfo info)
{
if (string.IsNullOrEmpty(info.Actor))
throw new InvalidDataException("Actor type was not specified!");
if (string.IsNullOrEmpty(info.DeliveringActor))
throw new InvalidDataException("Delivering actor type was not specified!");
self = init.Self;
Info = info;

View File

@@ -20,6 +20,7 @@ namespace OpenRA.Mods.D2k.Traits
"the actor footprint will be filled with this tile.")]
public readonly ushort Template = 0;
[FieldLoader.Require]
[Desc("The terrain types that this template will be placed on")]
public readonly string[] TerrainTypes = { };

View File

@@ -17,6 +17,7 @@ namespace OpenRA.Mods.D2k.Traits
[Desc("Rendered together with an attack.")]
public class WithAttackOverlayInfo : ITraitInfo, Requires<RenderSpritesInfo>
{
[FieldLoader.Require]
[Desc("Sequence name to use")]
[SequenceReference] public readonly string Sequence = null;

View File

@@ -19,8 +19,10 @@ namespace OpenRA.Mods.D2k.Traits
{
class FogPaletteFromR8Info : ITraitInfo
{
[FieldLoader.Require]
[Desc("Internal palette name")]
public readonly string Name = null;
[FieldLoader.Require]
[Desc("Filename to load")]
public readonly string Filename = null;
[Desc("Palette byte offset")]

View File

@@ -19,8 +19,10 @@ namespace OpenRA.Mods.D2k.Traits
{
class PaletteFromR8Info : ITraitInfo
{
[FieldLoader.Require]
[Desc("Internal palette name")]
public readonly string Name = null;
[FieldLoader.Require]
[Desc("Filename to load")]
public readonly string Filename = null;
[Desc("Palette byte offset")]

View File

@@ -19,9 +19,11 @@ namespace OpenRA.Mods.D2k.Traits
[Desc("Create a palette by applying a scale and offset to the colors in another palette.")]
class PaletteFromScaledPaletteInfo : ITraitInfo
{
[FieldLoader.Require]
[Desc("Internal palette name")]
public readonly string Name = null;
[FieldLoader.Require]
[Desc("The name of the palette to base off.")]
public readonly string BasePalette = null;