Made all traitInfo fields readonly
This came up while working on the new documentation generation and comparing the results to ORAIDE's own code parser.
This commit is contained in:
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string SpreadCondition = "spreading";
|
||||
|
||||
[Desc("Time in ticks to wait between spreading further.")]
|
||||
public int Delay = 5;
|
||||
public readonly int Delay = 5;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new SpreadsCondition(this); }
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
[ActorReference]
|
||||
[Desc("Actor types that this crate action will not occur for.")]
|
||||
public string[] ExcludedActorTypes = Array.Empty<string>();
|
||||
public readonly string[] ExcludedActorTypes = Array.Empty<string>();
|
||||
|
||||
public override object Create(ActorInitializer init) { return new CrateAction(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[WeaponReference]
|
||||
[FieldLoader.Require]
|
||||
[Desc("The weapon to fire upon collection.")]
|
||||
public string Weapon = null;
|
||||
public readonly string Weapon = null;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new ExplodeCrateAction(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
class GiveCashCrateActionInfo : CrateActionInfo
|
||||
{
|
||||
[Desc("Amount of cash to give.")]
|
||||
public int Amount = 2000;
|
||||
public readonly int Amount = 2000;
|
||||
|
||||
[Desc("Should the collected amount be displayed as a cash tick?")]
|
||||
public bool UseCashTick = false;
|
||||
public readonly bool UseCashTick = false;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new GiveCashCrateAction(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
class GiveMcvCrateActionInfo : GiveUnitCrateActionInfo
|
||||
{
|
||||
[Desc("The selection shares to use if the collector has no base.")]
|
||||
public int NoBaseSelectionShares = 1000;
|
||||
public readonly int NoBaseSelectionShares = 1000;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new GiveMcvCrateAction(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class MustBeDestroyedInfo : TraitInfo
|
||||
{
|
||||
[Desc("In a short game only actors that have this value set to true need to be destroyed.")]
|
||||
public bool RequiredForShortGame = false;
|
||||
public readonly bool RequiredForShortGame = false;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new MustBeDestroyed(this); }
|
||||
}
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
[NotificationReference("Speech")]
|
||||
[Desc("The audio notification type to play.")]
|
||||
public string Notification = "BaseAttack";
|
||||
public readonly string Notification = "BaseAttack";
|
||||
|
||||
[NotificationReference("Speech")]
|
||||
[Desc("The audio notification to play to allies when under attack.",
|
||||
"Won't play a notification to allies if this is null.")]
|
||||
public string AllyNotification = null;
|
||||
public readonly string AllyNotification = null;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new BaseAttackNotifier(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
[NotificationReference("Speech")]
|
||||
[Desc("The audio notification type to play.")]
|
||||
public string Notification = "HarvesterAttack";
|
||||
public readonly string Notification = "HarvesterAttack";
|
||||
|
||||
public override object Create(ActorInitializer init) { return new HarvesterAttackNotifier(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -265,10 +265,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
"Current options for PanelName are 'SKIRMISH_STATS' and 'MISSION_OBJECTIVES'.")]
|
||||
public class ObjectivesPanelInfo : TraitInfo
|
||||
{
|
||||
public string PanelName = null;
|
||||
public readonly string PanelName = null;
|
||||
|
||||
[Desc("in ms")]
|
||||
public int ExitDelay = 1400;
|
||||
public readonly int ExitDelay = 1400;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new ObjectivesPanel(this); }
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly string CannotPlaceNotification = null;
|
||||
|
||||
[Desc("Hotkey to toggle between PlaceBuildingVariants when placing a structure.")]
|
||||
public HotkeyReference ToggleVariantKey = new HotkeyReference();
|
||||
public readonly HotkeyReference ToggleVariantKey = new HotkeyReference();
|
||||
|
||||
public override object Create(ActorInitializer init) { return new PlaceBuilding(this); }
|
||||
}
|
||||
|
||||
@@ -176,14 +176,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class UpdatesPlayerStatisticsInfo : TraitInfo
|
||||
{
|
||||
[Desc("Add to army value in statistics")]
|
||||
public bool AddToArmyValue = false;
|
||||
public readonly bool AddToArmyValue = false;
|
||||
|
||||
[Desc("Add to assets value in statistics")]
|
||||
public bool AddToAssetsValue = true;
|
||||
public readonly bool AddToAssetsValue = true;
|
||||
|
||||
[ActorReference]
|
||||
[Desc("Count this actor as a different type in the spectator army display.")]
|
||||
public string OverrideActor = null;
|
||||
public readonly string OverrideActor = null;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new UpdatesPlayerStatistics(this, init.Self); }
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[TraitLocation(SystemActors.World)]
|
||||
class ProductionQueueFromSelectionInfo : TraitInfo
|
||||
{
|
||||
public string ProductionTabsWidget = null;
|
||||
public string ProductionPaletteWidget = null;
|
||||
public readonly string ProductionTabsWidget = null;
|
||||
public readonly string ProductionPaletteWidget = null;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new ProductionQueueFromSelection(init.World, this); }
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
[NotificationReference("Speech")]
|
||||
[Desc("The audio notification type to play.")]
|
||||
public string Notification = null;
|
||||
public readonly string Notification = null;
|
||||
|
||||
[Desc("Whether to show the cash tick indicators rising from the actor.")]
|
||||
public readonly bool ShowTicks = true;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly BitSet<TargetableType> TargetTypes;
|
||||
public BitSet<TargetableType> GetTargetTypes() { return TargetTypes; }
|
||||
|
||||
public bool RequiresForceFire = false;
|
||||
public readonly bool RequiresForceFire = false;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new Targetable(this); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user