Skip to content

Commit

Permalink
No more var (#2369)
Browse files Browse the repository at this point in the history
  • Loading branch information
BoltonDev authored Dec 30, 2023
1 parent 3a11321 commit 878dde7
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Exiled.API/Extensions/CommonExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static class CommonExtensions
/// <returns>The new modfied curve.</returns>
public static AnimationCurve Multiply(this AnimationCurve curve, float amount)
{
for (var i = 0; i < curve.length; i++)
for (int i = 0; i < curve.length; i++)
curve.keys[i].value *= amount;

return curve;
Expand All @@ -56,7 +56,7 @@ public static AnimationCurve Multiply(this AnimationCurve curve, float amount)
/// <returns>The new modfied curve.</returns>
public static AnimationCurve Add(this AnimationCurve curve, float amount)
{
for (var i = 0; i < curve.length; i++)
for (int i = 0; i < curve.length; i++)
curve.keys[i].value += amount;

return curve;
Expand Down
4 changes: 2 additions & 2 deletions Exiled.API/Extensions/ReflectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public static void InvokeStaticMethod(this Type type, string methodName, object[
/// <param name="param">The event arguments.</param>
public static void InvokeStaticEvent(this Type type, string eventName, object[] param)
{
var eventDelegate = (MulticastDelegate)type.GetField(eventName, AccessTools.all).GetValue(null);
MulticastDelegate eventDelegate = (MulticastDelegate)type.GetField(eventName, AccessTools.all).GetValue(null);
if (eventDelegate != null)
{
foreach (var handler in eventDelegate.GetInvocationList())
foreach (Delegate handler in eventDelegate.GetInvocationList())
{
handler.Method.Invoke(handler.Target, param);
}
Expand Down
6 changes: 3 additions & 3 deletions Exiled.API/Features/Doors/CheckpointDoor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public float Health
{
float health = value / Subdoors.Count;

foreach (var door in Subdoors)
foreach (BreakableDoor door in Subdoors)
{
door.Health = health;
}
Expand All @@ -108,7 +108,7 @@ public float MaxHealth
{
float health = value / Subdoors.Count;

foreach (var door in Subdoors)
foreach (BreakableDoor door in Subdoors)
{
door.MaxHealth = health;
}
Expand All @@ -121,7 +121,7 @@ public DoorDamageType IgnoredDamage
get => Subdoors.Aggregate(DoorDamageType.None, (current, door) => current | door.IgnoredDamage);
set
{
foreach (var door in Subdoors)
foreach (BreakableDoor door in Subdoors)
{
door.IgnoredDamage = value;
}
Expand Down
2 changes: 1 addition & 1 deletion Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public string CustomInfo
// NW Client check.
if (value.Contains('<'))
{
foreach (var token in value.Split('<'))
foreach (string token in value.Split('<'))
{
if (token.StartsWith("/", StringComparison.Ordinal) ||
token.StartsWith("b>", StringComparison.Ordinal) ||
Expand Down
2 changes: 1 addition & 1 deletion Exiled.API/Features/Roles/Scp079Role.cs
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ public void ActivateTesla(bool consumeEnergy = true)
Scp079Camera cam = CurrentCameraSync.CurrentCamera;
RewardManager.MarkRoom(cam.Room);

if (!TeslaGateController.Singleton.TeslaGates.TryGetFirst(x => RoomIdUtils.IsTheSameRoom(cam.Position, x.transform.position), out var teslaGate))
if (!TeslaGateController.Singleton.TeslaGates.TryGetFirst(x => RoomIdUtils.IsTheSameRoom(cam.Position, x.transform.position), out global::TeslaGate teslaGate))
return;

if (consumeEnergy)
Expand Down
4 changes: 2 additions & 2 deletions Exiled.API/Features/Roles/Scp1507Role.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public IEnumerable<Player> NearbyFlamingos
{
SwarmAbility._nearbyFlamingos.Clear();

foreach (var player in value.Where(x => x.Role.Is<Scp1507Role>(out _)))
foreach (Player player in value.Where(x => x.Role.Is<Scp1507Role>(out _)))
SwarmAbility._nearbyFlamingos.Add(player.Role.As<Scp1507Role>().Base);
}
}
Expand All @@ -118,7 +118,7 @@ public IEnumerable<Player> AllFlamingos
{
SwarmAbility._entireFlock.Clear();

foreach (var player in value.Where(x => x.Role.Is<Scp1507Role>(out _)))
foreach (Player player in value.Where(x => x.Role.Is<Scp1507Role>(out _)))
SwarmAbility._entireFlock.Add(player.Role.As<Scp1507Role>().Base);

SwarmAbility._flockSize = (byte)(SwarmAbility._entireFlock.Count - 1);
Expand Down
4 changes: 2 additions & 2 deletions Exiled.API/Features/Scp2536.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static HashSet<Player> IgnoredPlayers
{
Controller._ignoredPlayers.Clear();

foreach (var player in value)
foreach (Player player in value)
Controller._ignoredPlayers.Add(player.NetId);
}
}
Expand Down Expand Up @@ -69,7 +69,7 @@ public static Dictionary<Player, Stopwatch> Cooldowns
{
GiftController._cooldowns.Clear();

foreach (var kvp in value)
foreach (KeyValuePair<Player, Stopwatch> kvp in value)
GiftController._cooldowns.Add(kvp.Key.NetId, kvp.Value);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Exiled.CustomItems/API/Features/CustomGrenade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public virtual Pickup Throw(Vector3 position, float force, float weight, float f
player = Server.Host;

player.Role.Is(out FpcRole fpcRole);
var velocity = fpcRole.FirstPersonController.FpcModule.Motor.Velocity;
Vector3 velocity = fpcRole.FirstPersonController.FpcModule.Motor.Velocity;

Throwable throwable = (Throwable)Item.Create(grenadeType, player);

Expand Down
2 changes: 1 addition & 1 deletion Exiled.Events/Patches/Events/Player/TogglingRadio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi

newInstructions[newInstructions.Count - 1].labels.Add(retLabel);

foreach (var instruction in newInstructions)
foreach (CodeInstruction instruction in newInstructions)
yield return instruction;

ListPool<CodeInstruction>.Pool.Return(newInstructions);
Expand Down
2 changes: 1 addition & 1 deletion Exiled.Events/Patches/Events/Scp0492/Consuming.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Ret),
});

foreach (var instruction in newInstructions)
foreach (CodeInstruction instruction in newInstructions)
yield return instruction;

ListPool<CodeInstruction>.Pool.Return(newInstructions);
Expand Down
2 changes: 1 addition & 1 deletion Exiled.Events/Patches/Events/Scp106/Teleporting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Stloc_0),
});

foreach (var instruction in newInstructions)
foreach (CodeInstruction instruction in newInstructions)
yield return instruction;

ListPool<CodeInstruction>.Pool.Return(newInstructions);
Expand Down

0 comments on commit 878dde7

Please sign in to comment.