Replace F extension with string interpolation
This commit is contained in:
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
var pool = ammoPools.FirstOrDefault(a => a.Info.Name == poolName);
|
||||
if (pool == null)
|
||||
throw new LuaException("Invalid ammopool name {0} queried on actor {1}.".F(poolName, self));
|
||||
throw new LuaException($"Invalid ammopool name {poolName} queried on actor {self}.");
|
||||
|
||||
return pool.CurrentAmmoCount;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
var pool = ammoPools.FirstOrDefault(a => a.Info.Name == poolName);
|
||||
if (pool == null)
|
||||
throw new LuaException("Invalid ammopool name {0} queried on actor {1}.".F(poolName, self));
|
||||
throw new LuaException($"Invalid ammopool name {poolName} queried on actor {self}.");
|
||||
|
||||
return pool.Info.Ammo;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
var pool = ammoPools.FirstOrDefault(a => a.Info.Name == poolName);
|
||||
if (pool == null)
|
||||
throw new LuaException("Invalid ammopool name {0} queried on actor {1}.".F(poolName, self));
|
||||
throw new LuaException($"Invalid ammopool name {poolName} queried on actor {self}.");
|
||||
|
||||
if (amount > 0)
|
||||
pool.GiveAmmo(self, amount);
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
var targetManager = target.TraitOrDefault<CaptureManager>();
|
||||
if (targetManager == null || !targetManager.CanBeTargetedBy(target, Self, captureManager))
|
||||
throw new LuaException("Actor '{0}' cannot capture actor '{1}'!".F(Self, target));
|
||||
throw new LuaException($"Actor '{Self}' cannot capture actor '{target}'!");
|
||||
|
||||
// NB: Scripted actions get no visible targetlines.
|
||||
Self.QueueActivity(new CaptureActor(Self, Target.FromActor(target), null));
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
.FirstOrDefault(t => t.Info.Condition == condition && t.CanGrantCondition(Self, this));
|
||||
|
||||
if (external == null)
|
||||
throw new LuaException("Condition `{0}` has not been listed on an enabled ExternalCondition trait".F(condition));
|
||||
throw new LuaException($"Condition `{condition}` has not been listed on an enabled ExternalCondition trait");
|
||||
|
||||
return external.GrantCondition(Self, this, duration);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
var targetGainsExperience = target.TraitOrDefault<GainsExperience>();
|
||||
if (targetGainsExperience == null)
|
||||
throw new LuaException("Actor '{0}' cannot gain experience!".F(target));
|
||||
throw new LuaException($"Actor '{target}' cannot gain experience!");
|
||||
|
||||
if (targetGainsExperience.Level == targetGainsExperience.MaxLevel)
|
||||
return;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
throw new LuaException("Attempted to change the owner of actor '{0}' to nil value.".F(Self));
|
||||
throw new LuaException($"Attempted to change the owner of actor '{Self}' to nil value.");
|
||||
|
||||
if (Self.Owner != value)
|
||||
Self.ChangeOwner(value);
|
||||
@@ -121,7 +121,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
get
|
||||
{
|
||||
if (facing == null)
|
||||
throw new LuaException("Actor '{0}' doesn't define a facing".F(Self));
|
||||
throw new LuaException($"Actor '{Self}' doesn't define a facing");
|
||||
|
||||
return facing.Facing;
|
||||
}
|
||||
@@ -172,7 +172,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
return;
|
||||
|
||||
if (!Enum<UnitStance>.TryParse(value, true, out var stance))
|
||||
throw new LuaException("Unknown stance type '{0}'".F(value));
|
||||
throw new LuaException($"Unknown stance type '{value}'");
|
||||
|
||||
autotarget.PredictedStance = stance;
|
||||
autotarget.SetStance(Self, stance);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
.FirstOrDefault(t => t.Info.Condition == condition && t.CanGrantCondition(Player.PlayerActor, this));
|
||||
|
||||
if (external == null)
|
||||
throw new LuaException("Condition `{0}` has not been listed on an enabled ExternalCondition trait".F(condition));
|
||||
throw new LuaException($"Condition `{condition}` has not been listed on an enabled ExternalCondition trait");
|
||||
|
||||
return external.GrantCondition(Player.PlayerActor, this, duration);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
var result = new List<Actor>();
|
||||
|
||||
if (!Context.World.Map.Rules.Actors.TryGetValue(type, out var ai))
|
||||
throw new LuaException("Unknown actor type '{0}'".F(type));
|
||||
throw new LuaException($"Unknown actor type '{type}'");
|
||||
|
||||
result.AddRange(Player.World.Actors
|
||||
.Where(actor => actor.Owner == Player && !actor.IsDead && actor.IsInWorld && actor.Info.Name == ai.Name));
|
||||
@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
|
||||
foreach (var type in types)
|
||||
if (!Context.World.Map.Rules.Actors.ContainsKey(type))
|
||||
throw new LuaException("Unknown actor type '{0}'".F(type));
|
||||
throw new LuaException($"Unknown actor type '{type}'");
|
||||
|
||||
result.AddRange(Player.World.Actors
|
||||
.Where(actor => actor.Owner == Player && !actor.IsDead && actor.IsInWorld && types.Contains(actor.Info.Name)));
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
{
|
||||
var tt = Player.PlayerActor.TraitOrDefault<TechTree>();
|
||||
if (tt == null)
|
||||
throw new LuaException("Missing TechTree trait on player {0}!".F(Player));
|
||||
throw new LuaException($"Missing TechTree trait on player {Player}!");
|
||||
|
||||
return tt.HasPrerequisites(type);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
public void Produce(string actorType, string factionVariant = null, string productionType = null)
|
||||
{
|
||||
if (!Self.World.Map.Rules.Actors.TryGetValue(actorType, out var actorInfo))
|
||||
throw new LuaException("Unknown actor type '{0}'".F(actorType));
|
||||
throw new LuaException($"Unknown actor type '{actorType}'");
|
||||
|
||||
var bi = actorInfo.TraitInfo<BuildableInfo>();
|
||||
Self.QueueActivity(new WaitFor(() =>
|
||||
@@ -197,7 +197,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
var bi = ri.TraitInfoOrDefault<BuildableInfo>();
|
||||
|
||||
if (bi == null)
|
||||
throw new LuaException("Actor of type {0} cannot be produced".F(actorType));
|
||||
throw new LuaException($"Actor of type {actorType} cannot be produced");
|
||||
else
|
||||
return bi;
|
||||
}
|
||||
@@ -304,7 +304,7 @@ namespace OpenRA.Mods.Common.Scripting
|
||||
var bi = ri.TraitInfoOrDefault<BuildableInfo>();
|
||||
|
||||
if (bi == null)
|
||||
throw new LuaException("Actor of type {0} cannot be produced".F(actorType));
|
||||
throw new LuaException($"Actor of type {actorType} cannot be produced");
|
||||
else
|
||||
return bi;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user