1 #region Copyright & License Information
2 /*
3  * Copyright 2007-2020 The OpenRA Developers (see AUTHORS)
4  * This file is part of OpenRA, which is free software. It is made
5  * available to you under the terms of the GNU General Public License
6  * as published by the Free Software Foundation, either version 3 of
7  * the License, or (at your option) any later version. For more
8  * information, see COPYING.
9  */
10 #endregion
11 
12 using System;
13 
14 namespace OpenRA.Traits
15 {
16 	/* attributes used by OpenRA.Lint to understand the rules */
17 
18 	[AttributeUsage(AttributeTargets.Field)]
19 	public sealed class ActorReferenceAttribute : Attribute
20 	{
21 		public Type[] RequiredTraits;
ActorReferenceAttribute(params Type[] requiredTraits)22 		public ActorReferenceAttribute(params Type[] requiredTraits)
23 		{
24 			RequiredTraits = requiredTraits;
25 		}
26 	}
27 
28 	[AttributeUsage(AttributeTargets.Field)]
29 	public sealed class WeaponReferenceAttribute : Attribute { }
30 
31 	[AttributeUsage(AttributeTargets.Field)]
32 	public sealed class VoiceSetReferenceAttribute : Attribute { }
33 
34 	[AttributeUsage(AttributeTargets.Field)]
35 	public sealed class VoiceReferenceAttribute : Attribute { }
36 
37 	[AttributeUsage(AttributeTargets.Field)]
38 	public sealed class LocomotorReferenceAttribute : Attribute { }
39 
40 	[AttributeUsage(AttributeTargets.Field)]
41 	public sealed class NotificationReferenceAttribute : Attribute
42 	{
43 		public readonly string NotificationTypeFieldName = null;
44 		public readonly string NotificationType = null;
45 
NotificationReferenceAttribute(string type = null, string typeFromField = null)46 		public NotificationReferenceAttribute(string type = null, string typeFromField = null)
47 		{
48 			NotificationType = type;
49 			NotificationTypeFieldName = typeFromField;
50 		}
51 	}
52 
53 	[AttributeUsage(AttributeTargets.Field)]
54 	public sealed class SequenceReferenceAttribute : Attribute
55 	{
56 		public readonly string ImageReference; // The field name in the same trait info that contains the image name.
57 		public readonly bool Prefix;
SequenceReferenceAttribute(string imageReference = null, bool prefix = false)58 		public SequenceReferenceAttribute(string imageReference = null, bool prefix = false)
59 		{
60 			ImageReference = imageReference;
61 			Prefix = prefix;
62 		}
63 	}
64 
65 	[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
66 	public sealed class GrantedConditionReferenceAttribute : Attribute { }
67 
68 	[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
69 	public sealed class ConsumedConditionReferenceAttribute : Attribute { }
70 
71 	[AttributeUsage(AttributeTargets.Field)]
72 	public sealed class PaletteDefinitionAttribute : Attribute
73 	{
74 		public readonly bool IsPlayerPalette;
PaletteDefinitionAttribute(bool isPlayerPalette = false)75 		public PaletteDefinitionAttribute(bool isPlayerPalette = false)
76 		{
77 			IsPlayerPalette = isPlayerPalette;
78 		}
79 	}
80 
81 	[AttributeUsage(AttributeTargets.Field)]
82 	public sealed class PaletteReferenceAttribute : Attribute
83 	{
84 		public readonly bool IsPlayerPalette;
PaletteReferenceAttribute(bool isPlayerPalette = false)85 		public PaletteReferenceAttribute(bool isPlayerPalette = false)
86 		{
87 			IsPlayerPalette = isPlayerPalette;
88 		}
89 
90 		public readonly string PlayerPaletteReferenceSwitch;
PaletteReferenceAttribute(string playerPaletteReferenceSwitch)91 		public PaletteReferenceAttribute(string playerPaletteReferenceSwitch)
92 		{
93 			PlayerPaletteReferenceSwitch = playerPaletteReferenceSwitch;
94 		}
95 	}
96 }
97