Use expression body syntax
This commit is contained in:
@@ -19,14 +19,14 @@ namespace OpenRA.Mods.Common.Scripting.Global
|
||||
public AngleGlobal(ScriptContext context)
|
||||
: base(context) { }
|
||||
|
||||
public WAngle North { get { return WAngle.Zero; } }
|
||||
public WAngle NorthWest { get { return new WAngle(128); } }
|
||||
public WAngle West { get { return new WAngle(256); } }
|
||||
public WAngle SouthWest { get { return new WAngle(384); } }
|
||||
public WAngle South { get { return new WAngle(512); } }
|
||||
public WAngle SouthEast { get { return new WAngle(640); } }
|
||||
public WAngle East { get { return new WAngle(768); } }
|
||||
public WAngle NorthEast { get { return new WAngle(896); } }
|
||||
public WAngle North => WAngle.Zero;
|
||||
public WAngle NorthWest => new WAngle(128);
|
||||
public WAngle West => new WAngle(256);
|
||||
public WAngle SouthWest => new WAngle(384);
|
||||
public WAngle South => new WAngle(512);
|
||||
public WAngle SouthEast => new WAngle(640);
|
||||
public WAngle East => new WAngle(768);
|
||||
public WAngle NorthEast => new WAngle(896);
|
||||
|
||||
[Desc("Create an arbitrary angle.")]
|
||||
public WAngle New(int a) { return new WAngle(a); }
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("The center of the visible viewport.")]
|
||||
public WPos Position
|
||||
{
|
||||
get { return Context.WorldRenderer.Viewport.CenterPosition; }
|
||||
set { Context.WorldRenderer.Viewport.Center(value); }
|
||||
get => Context.WorldRenderer.Viewport.CenterPosition;
|
||||
set => Context.WorldRenderer.Viewport.Center(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,41 +51,41 @@ namespace OpenRA.Mods.Common.Scripting.Global
|
||||
throw new LuaException("Invalid rrggbb[aa] hex string.");
|
||||
}
|
||||
|
||||
public Color Aqua { get { return Color.Aqua; } }
|
||||
public Color Black { get { return Color.Black; } }
|
||||
public Color Blue { get { return Color.Blue; } }
|
||||
public Color Brown { get { return Color.Brown; } }
|
||||
public Color Cyan { get { return Color.Cyan; } }
|
||||
public Color DarkBlue { get { return Color.DarkBlue; } }
|
||||
public Color DarkCyan { get { return Color.DarkCyan; } }
|
||||
public Color DarkGray { get { return Color.DarkGray; } }
|
||||
public Color DarkGreen { get { return Color.DarkGreen; } }
|
||||
public Color DarkOrange { get { return Color.DarkOrange; } }
|
||||
public Color DarkRed { get { return Color.DarkRed; } }
|
||||
public Color Fuchsia { get { return Color.Fuchsia; } }
|
||||
public Color Gold { get { return Color.Gold; } }
|
||||
public Color Gray { get { return Color.Gray; } }
|
||||
public Color Green { get { return Color.Green; } }
|
||||
public Color LawnGreen { get { return Color.LawnGreen; } }
|
||||
public Color LightBlue { get { return Color.LightBlue; } }
|
||||
public Color LightCyan { get { return Color.LightCyan; } }
|
||||
public Color LightGray { get { return Color.LightGray; } }
|
||||
public Color LightGreen { get { return Color.LightGreen; } }
|
||||
public Color LightYellow { get { return Color.LightYellow; } }
|
||||
public Color Lime { get { return Color.Lime; } }
|
||||
public Color LimeGreen { get { return Color.LimeGreen; } }
|
||||
public Color Magenta { get { return Color.Magenta; } }
|
||||
public Color Maroon { get { return Color.Maroon; } }
|
||||
public Color Navy { get { return Color.Navy; } }
|
||||
public Color Olive { get { return Color.Olive; } }
|
||||
public Color Orange { get { return Color.Orange; } }
|
||||
public Color OrangeRed { get { return Color.OrangeRed; } }
|
||||
public Color Purple { get { return Color.Purple; } }
|
||||
public Color Red { get { return Color.Red; } }
|
||||
public Color Salmon { get { return Color.Salmon; } }
|
||||
public Color SkyBlue { get { return Color.SkyBlue; } }
|
||||
public Color Teal { get { return Color.Teal; } }
|
||||
public Color Yellow { get { return Color.Yellow; } }
|
||||
public Color White { get { return Color.White; } }
|
||||
public Color Aqua => Color.Aqua;
|
||||
public Color Black => Color.Black;
|
||||
public Color Blue => Color.Blue;
|
||||
public Color Brown => Color.Brown;
|
||||
public Color Cyan => Color.Cyan;
|
||||
public Color DarkBlue => Color.DarkBlue;
|
||||
public Color DarkCyan => Color.DarkCyan;
|
||||
public Color DarkGray => Color.DarkGray;
|
||||
public Color DarkGreen => Color.DarkGreen;
|
||||
public Color DarkOrange => Color.DarkOrange;
|
||||
public Color DarkRed => Color.DarkRed;
|
||||
public Color Fuchsia => Color.Fuchsia;
|
||||
public Color Gold => Color.Gold;
|
||||
public Color Gray => Color.Gray;
|
||||
public Color Green => Color.Green;
|
||||
public Color LawnGreen => Color.LawnGreen;
|
||||
public Color LightBlue => Color.LightBlue;
|
||||
public Color LightCyan => Color.LightCyan;
|
||||
public Color LightGray => Color.LightGray;
|
||||
public Color LightGreen => Color.LightGreen;
|
||||
public Color LightYellow => Color.LightYellow;
|
||||
public Color Lime => Color.Lime;
|
||||
public Color LimeGreen => Color.LimeGreen;
|
||||
public Color Magenta => Color.Magenta;
|
||||
public Color Maroon => Color.Maroon;
|
||||
public Color Navy => Color.Navy;
|
||||
public Color Olive => Color.Olive;
|
||||
public Color Orange => Color.Orange;
|
||||
public Color OrangeRed => Color.OrangeRed;
|
||||
public Color Purple => Color.Purple;
|
||||
public Color Red => Color.Red;
|
||||
public Color Salmon => Color.Salmon;
|
||||
public Color SkyBlue => Color.SkyBlue;
|
||||
public Color Teal => Color.Teal;
|
||||
public Color Yellow => Color.Yellow;
|
||||
public Color White => Color.White;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
public CPos New(int x, int y) { return new CPos(x, y); }
|
||||
|
||||
[Desc("The cell coordinate origin.")]
|
||||
public CPos Zero { get { return CPos.Zero; } }
|
||||
public CPos Zero => CPos.Zero;
|
||||
}
|
||||
|
||||
[ScriptGlobal("CVec")]
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
public CVec New(int x, int y) { return new CVec(x, y); }
|
||||
|
||||
[Desc("The cell zero-vector.")]
|
||||
public CVec Zero { get { return CVec.Zero; } }
|
||||
public CVec Zero => CVec.Zero;
|
||||
}
|
||||
|
||||
[ScriptGlobal("WPos")]
|
||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
public WPos New(int x, int y, int z) { return new WPos(x, y, z); }
|
||||
|
||||
[Desc("The world coordinate origin.")]
|
||||
public WPos Zero { get { return WPos.Zero; } }
|
||||
public WPos Zero => WPos.Zero;
|
||||
}
|
||||
|
||||
[ScriptGlobal("WVec")]
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
public WVec New(int x, int y, int z) { return new WVec(x, y, z); }
|
||||
|
||||
[Desc("The world zero-vector.")]
|
||||
public WVec Zero { get { return WVec.Zero; } }
|
||||
public WVec Zero => WVec.Zero;
|
||||
}
|
||||
|
||||
[ScriptGlobal("WDist")]
|
||||
|
||||
@@ -28,16 +28,10 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("True on the 31st of October.")]
|
||||
public bool IsHalloween
|
||||
{
|
||||
get { return DateTime.Today.Month == 10 && DateTime.Today.Day == 31; }
|
||||
}
|
||||
public bool IsHalloween => DateTime.Today.Month == 10 && DateTime.Today.Day == 31;
|
||||
|
||||
[Desc("Get the current game time (in ticks).")]
|
||||
public int GameTime
|
||||
{
|
||||
get { return Context.World.WorldTick; }
|
||||
}
|
||||
public int GameTime => Context.World.WorldTick;
|
||||
|
||||
[Desc("Converts the number of seconds into game time (ticks).")]
|
||||
public int Seconds(int seconds)
|
||||
@@ -54,10 +48,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Return or set the time limit (in ticks). When setting, the time limit will count from now. Setting the time limit to 0 will disable it.")]
|
||||
public int TimeLimit
|
||||
{
|
||||
get
|
||||
{
|
||||
return tlm != null ? tlm.TimeLimit : 0;
|
||||
}
|
||||
get => tlm != null ? tlm.TimeLimit : 0;
|
||||
|
||||
set
|
||||
{
|
||||
@@ -71,10 +62,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("The notification string used for custom time limit warnings. See the TimeLimitManager trait documentation for details.")]
|
||||
public string TimeLimitNotification
|
||||
{
|
||||
get
|
||||
{
|
||||
return tlm != null ? tlm.Notification : null;
|
||||
}
|
||||
get => tlm != null ? tlm.Notification : null;
|
||||
|
||||
set
|
||||
{
|
||||
|
||||
@@ -40,25 +40,25 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
|
||||
public double Red
|
||||
{
|
||||
get { return hasLighting ? lighting.Red : 1d; }
|
||||
get => hasLighting ? lighting.Red : 1d;
|
||||
set { if (hasLighting) lighting.Red = (float)value; }
|
||||
}
|
||||
|
||||
public double Green
|
||||
{
|
||||
get { return hasLighting ? lighting.Green : 1d; }
|
||||
get => hasLighting ? lighting.Green : 1d;
|
||||
set { if (hasLighting) lighting.Green = (float)value; }
|
||||
}
|
||||
|
||||
public double Blue
|
||||
{
|
||||
get { return hasLighting ? lighting.Blue : 1d; }
|
||||
get => hasLighting ? lighting.Blue : 1d;
|
||||
set { if (hasLighting) lighting.Blue = (float)value; }
|
||||
}
|
||||
|
||||
public double Ambient
|
||||
{
|
||||
get { return hasLighting ? lighting.Ambient : 1d; }
|
||||
get => hasLighting ? lighting.Ambient : 1d;
|
||||
set { if (hasLighting) lighting.Ambient = (float)value; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,27 +49,15 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
return FilteredObjects(actors, filter).ToArray();
|
||||
}
|
||||
|
||||
// HACK: This api method abuses the coordinate system, and should be removed
|
||||
// in favour of proper actor queries. See #8549.
|
||||
[Desc("Returns the location of the top-left corner of the map (assuming zero terrain height).")]
|
||||
public WPos TopLeft
|
||||
{
|
||||
get
|
||||
{
|
||||
// HACK: This api method abuses the coordinate system, and should be removed
|
||||
// in favour of proper actor queries. See #8549.
|
||||
return Context.World.Map.ProjectedTopLeft;
|
||||
}
|
||||
}
|
||||
public WPos TopLeft => Context.World.Map.ProjectedTopLeft;
|
||||
|
||||
// HACK: This api method abuses the coordinate system, and should be removed
|
||||
// in favour of proper actor queries. See #8549.
|
||||
[Desc("Returns the location of the bottom-right corner of the map (assuming zero terrain height).")]
|
||||
public WPos BottomRight
|
||||
{
|
||||
get
|
||||
{
|
||||
// HACK: This api method abuses the coordinate system, and should be removed
|
||||
// in favour of proper actor queries. See #8549.
|
||||
return Context.World.Map.ProjectedBottomRight;
|
||||
}
|
||||
}
|
||||
public WPos BottomRight => Context.World.Map.ProjectedBottomRight;
|
||||
|
||||
[Desc("Returns a random cell inside the visible region of the map.")]
|
||||
public CPos RandomCell()
|
||||
@@ -109,10 +97,10 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Returns true if there is only one human player.")]
|
||||
public bool IsSinglePlayer { get { return Context.World.LobbyInfo.NonBotPlayers.Count() == 1; } }
|
||||
public bool IsSinglePlayer => Context.World.LobbyInfo.NonBotPlayers.Count() == 1;
|
||||
|
||||
[Desc("Returns true if this is a shellmap and the player has paused animations.")]
|
||||
public bool IsPausedShellmap { get { return Context.World.Type == WorldType.Shellmap && gameSettings.PauseShellmap; } }
|
||||
public bool IsPausedShellmap => Context.World.Type == WorldType.Shellmap && gameSettings.PauseShellmap;
|
||||
|
||||
[Desc("Returns the value of a `ScriptLobbyDropdown` selected in the game lobby.")]
|
||||
public LuaValue LobbyOption(string id)
|
||||
@@ -127,10 +115,10 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Returns a table of all the actors that were specified in the map file.")]
|
||||
public Actor[] NamedActors { get { return sma.Actors.Values.ToArray(); } }
|
||||
public Actor[] NamedActors => sma.Actors.Values.ToArray();
|
||||
|
||||
[Desc("Returns the actor that was specified with a given name in " +
|
||||
"the map file (or nil, if the actor is dead or not found).")]
|
||||
"the map file (or nil, if the actor is dead or not found).")]
|
||||
public Actor NamedActor(string actorName)
|
||||
{
|
||||
if (!sma.Actors.TryGetValue(actorName, out var ret))
|
||||
@@ -155,6 +143,6 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Returns a table of all the actors that are currently on the map/in the world.")]
|
||||
public Actor[] ActorsInWorld { get { return world.Actors.ToArray(); } }
|
||||
public Actor[] ActorsInWorld => world.Actors.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,6 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
public bool FatalErrorOccurred { get { return context.FatalErrorOccurred; } }
|
||||
public bool FatalErrorOccurred => context.FatalErrorOccurred;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,16 +27,16 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("The actor's amount of experience.")]
|
||||
public int Experience { get { return exp.Experience; } }
|
||||
public int Experience => exp.Experience;
|
||||
|
||||
[Desc("The actor's level.")]
|
||||
public int Level { get { return exp.Level; } }
|
||||
public int Level => exp.Level;
|
||||
|
||||
[Desc("The actor's maximum possible level.")]
|
||||
public int MaxLevel { get { return exp.MaxLevel; } }
|
||||
public int MaxLevel => exp.MaxLevel;
|
||||
|
||||
[Desc("Returns true if the actor can gain a level.")]
|
||||
public bool CanGainLevel { get { return exp.CanGainLevel; } }
|
||||
public bool CanGainLevel => exp.CanGainLevel;
|
||||
|
||||
[Desc("Gives the actor experience. If 'silent' is true, no animation or sound will be played if the actor levels up.")]
|
||||
public void GiveExperience(int amount, bool silent = false)
|
||||
|
||||
@@ -31,10 +31,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Specifies whether the actor is in the world.")]
|
||||
public bool IsInWorld
|
||||
{
|
||||
get
|
||||
{
|
||||
return Self.IsInWorld;
|
||||
}
|
||||
get => Self.IsInWorld;
|
||||
|
||||
set
|
||||
{
|
||||
@@ -46,18 +43,15 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Specifies whether the actor is alive or dead.")]
|
||||
public bool IsDead { get { return Self.IsDead; } }
|
||||
public bool IsDead => Self.IsDead;
|
||||
|
||||
[Desc("Specifies whether the actor is idle (not performing any activities).")]
|
||||
public bool IsIdle { get { return Self.IsIdle; } }
|
||||
public bool IsIdle => Self.IsIdle;
|
||||
|
||||
[Desc("The player that owns the actor.")]
|
||||
public Player Owner
|
||||
{
|
||||
get
|
||||
{
|
||||
return Self.Owner;
|
||||
}
|
||||
get => Self.Owner;
|
||||
|
||||
set
|
||||
{
|
||||
@@ -70,7 +64,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("The type of the actor (e.g. \"e1\").")]
|
||||
public string Type { get { return Self.Info.Name; } }
|
||||
public string Type => Self.Info.Name;
|
||||
|
||||
[Desc("Test whether an actor has a specific property.")]
|
||||
public bool HasProperty(string name)
|
||||
@@ -116,10 +110,10 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("The actor position in cell coordinates.")]
|
||||
public CPos Location { get { return Self.Location; } }
|
||||
public CPos Location => Self.Location;
|
||||
|
||||
[Desc("The actor position in world coordinates.")]
|
||||
public WPos CenterPosition { get { return Self.CenterPosition; } }
|
||||
public WPos CenterPosition => Self.CenterPosition;
|
||||
|
||||
[Desc("The direction that the actor is facing.")]
|
||||
public WAngle Facing
|
||||
@@ -170,10 +164,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Current actor stance. Returns nil if this actor doesn't support stances.")]
|
||||
public string Stance
|
||||
{
|
||||
get
|
||||
{
|
||||
return autotarget?.Stance.ToString();
|
||||
}
|
||||
get => autotarget?.Stance.ToString();
|
||||
|
||||
set
|
||||
{
|
||||
@@ -200,7 +191,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Specifies whether or not the actor supports 'tags'.")]
|
||||
public bool IsTaggable { get { return scriptTags != null; } }
|
||||
public bool IsTaggable => scriptTags != null;
|
||||
|
||||
[Desc("Add a tag to the actor. Returns true on success, false otherwise (for example the actor may already have the given tag).")]
|
||||
public bool AddTag(string tag)
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Current health of the actor.")]
|
||||
public int Health
|
||||
{
|
||||
get { return health.HP; }
|
||||
set { health.InflictDamage(Self, Self, new Damage(health.HP - value), true); }
|
||||
get => health.HP;
|
||||
set => health.InflictDamage(Self, Self, new Damage(health.HP - value), true);
|
||||
}
|
||||
|
||||
[Desc("Maximum health of the actor.")]
|
||||
public int MaxHealth { get { return health.MaxHP; } }
|
||||
public int MaxHealth => health.MaxHP;
|
||||
|
||||
[Desc("Kill the actor. damageTypes may be omitted, specified as a string, or as table of strings.")]
|
||||
public void Kill(object damageTypes = null)
|
||||
|
||||
@@ -67,6 +67,6 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Whether the actor can move (false if immobilized).")]
|
||||
public bool IsMobile { get { return !mobile.IsTraitDisabled && !mobile.IsTraitPaused; } }
|
||||
public bool IsMobile => !mobile.IsTraitDisabled && !mobile.IsTraitPaused;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,15 +28,9 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
|
||||
public int Experience
|
||||
{
|
||||
get
|
||||
{
|
||||
return exp.Experience;
|
||||
}
|
||||
get => exp.Experience;
|
||||
|
||||
set
|
||||
{
|
||||
exp.GiveExperience(value - exp.Experience);
|
||||
}
|
||||
set => exp.GiveExperience(value - exp.Experience);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,22 +25,22 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
: base(context, player) { }
|
||||
|
||||
[Desc("The player's internal name.")]
|
||||
public string InternalName { get { return Player.InternalName; } }
|
||||
public string InternalName => Player.InternalName;
|
||||
|
||||
[Desc("The player's name.")]
|
||||
public string Name { get { return Player.PlayerName; } }
|
||||
public string Name => Player.PlayerName;
|
||||
|
||||
[Desc("The player's color.")]
|
||||
public Color Color { get { return Player.Color; } }
|
||||
public Color Color => Player.Color;
|
||||
|
||||
[Desc("The player's faction.")]
|
||||
public string Faction { get { return Player.Faction.InternalName; } }
|
||||
public string Faction => Player.Faction.InternalName;
|
||||
|
||||
[Desc("The player's spawnpoint ID.")]
|
||||
public int Spawn { get { return Player.SpawnPoint; } }
|
||||
public int Spawn => Player.SpawnPoint;
|
||||
|
||||
[Desc("The player's home/starting location.")]
|
||||
public CPos HomeLocation { get { return Player.HomeLocation; } }
|
||||
public CPos HomeLocation => Player.HomeLocation;
|
||||
|
||||
[Desc("The player's team ID.")]
|
||||
public int Team
|
||||
@@ -63,13 +63,13 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Returns true if the player is a bot.")]
|
||||
public bool IsBot { get { return Player.IsBot; } }
|
||||
public bool IsBot => Player.IsBot;
|
||||
|
||||
[Desc("Returns true if the player is non combatant.")]
|
||||
public bool IsNonCombatant { get { return Player.NonCombatant; } }
|
||||
public bool IsNonCombatant => Player.NonCombatant;
|
||||
|
||||
[Desc("Returns true if the player is the local player.")]
|
||||
public bool IsLocalPlayer { get { return Player == (Player.World.RenderPlayer ?? Player.World.LocalPlayer); } }
|
||||
public bool IsLocalPlayer => Player == (Player.World.RenderPlayer ?? Player.World.LocalPlayer);
|
||||
|
||||
[Desc("Returns all living actors staying inside the world for this player.")]
|
||||
public Actor[] GetActors()
|
||||
|
||||
@@ -27,21 +27,21 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("The combined value of units killed by this player.")]
|
||||
public int KillsCost { get { return stats.KillsCost; } }
|
||||
public int KillsCost => stats.KillsCost;
|
||||
|
||||
[Desc("The combined value of all units lost by this player.")]
|
||||
public int DeathsCost { get { return stats.DeathsCost; } }
|
||||
public int DeathsCost => stats.DeathsCost;
|
||||
|
||||
[Desc("The total number of units killed by this player.")]
|
||||
public int UnitsKilled { get { return stats.UnitsKilled; } }
|
||||
public int UnitsKilled => stats.UnitsKilled;
|
||||
|
||||
[Desc("The total number of units lost by this player.")]
|
||||
public int UnitsLost { get { return stats.UnitsDead; } }
|
||||
public int UnitsLost => stats.UnitsDead;
|
||||
|
||||
[Desc("The total number of buildings killed by this player.")]
|
||||
public int BuildingsKilled { get { return stats.BuildingsKilled; } }
|
||||
public int BuildingsKilled => stats.BuildingsKilled;
|
||||
|
||||
[Desc("The total number of buildings lost by this player.")]
|
||||
public int BuildingsLost { get { return stats.BuildingsDead; } }
|
||||
public int BuildingsLost => stats.BuildingsDead;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,23 +29,14 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Returns the total of the power the player has.")]
|
||||
public int PowerProvided
|
||||
{
|
||||
get { return pm.PowerProvided; }
|
||||
}
|
||||
public int PowerProvided => pm.PowerProvided;
|
||||
|
||||
[Desc("Returns the power used by the player.")]
|
||||
public int PowerDrained
|
||||
{
|
||||
get { return pm.PowerDrained; }
|
||||
}
|
||||
public int PowerDrained => pm.PowerDrained;
|
||||
|
||||
[Desc("Returns the player's power state " +
|
||||
"(\"Normal\", \"Low\" or \"Critical\").")]
|
||||
public string PowerState
|
||||
{
|
||||
get { return pm.PowerState.ToString(); }
|
||||
}
|
||||
"(\"Normal\", \"Low\" or \"Critical\").")]
|
||||
public string PowerState => pm.PowerState.ToString();
|
||||
|
||||
[Desc("Triggers low power for the chosen amount of ticks.")]
|
||||
public void TriggerPowerOutage(int ticks)
|
||||
|
||||
@@ -92,10 +92,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
|
||||
return Self.Location;
|
||||
}
|
||||
set
|
||||
{
|
||||
rp.Path = new List<CPos> { value };
|
||||
}
|
||||
set => rp.Path = new List<CPos> { value };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,8 +110,8 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("Query or set the factory's primary building status.")]
|
||||
public bool IsPrimaryBuilding
|
||||
{
|
||||
get { return pb.IsPrimary; }
|
||||
set { pb.SetPrimaryProducer(Self, value); }
|
||||
get => pb.IsPrimary;
|
||||
set => pb.SetPrimaryProducer(Self, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,18 +30,18 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
[Desc("The amount of harvestable resources held by the player.")]
|
||||
public int Resources
|
||||
{
|
||||
get { return pr.Resources; }
|
||||
set { pr.Resources = value.Clamp(0, pr.ResourceCapacity); }
|
||||
get => pr.Resources;
|
||||
set => pr.Resources = value.Clamp(0, pr.ResourceCapacity);
|
||||
}
|
||||
|
||||
[Desc("The maximum resource storage of the player.")]
|
||||
public int ResourceCapacity { get { return pr.ResourceCapacity; } }
|
||||
public int ResourceCapacity => pr.ResourceCapacity;
|
||||
|
||||
[Desc("The amount of cash held by the player.")]
|
||||
public int Cash
|
||||
{
|
||||
get { return pr.Cash; }
|
||||
set { pr.Cash = Math.Max(0, value); }
|
||||
get => pr.Cash;
|
||||
set => pr.Cash = Math.Max(0, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,13 +30,13 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
}
|
||||
|
||||
[Desc("Returns references to passengers inside the transport.")]
|
||||
public Actor[] Passengers { get { return cargo.Passengers.ToArray(); } }
|
||||
public Actor[] Passengers => cargo.Passengers.ToArray();
|
||||
|
||||
[Desc("Specifies whether transport has any passengers.")]
|
||||
public bool HasPassengers { get { return cargo.Passengers.Any(); } }
|
||||
public bool HasPassengers => cargo.Passengers.Any();
|
||||
|
||||
[Desc("Specifies the amount of passengers.")]
|
||||
public int PassengerCount { get { return cargo.Passengers.Count(); } }
|
||||
public int PassengerCount => cargo.Passengers.Count();
|
||||
|
||||
[Desc("Teleport an existing actor inside this transport.")]
|
||||
public void LoadPassenger(Actor a)
|
||||
|
||||
Reference in New Issue
Block a user