Fix warnings and code cleanup/fixes (#13570)

This commit is contained in:
Visne
2023-01-19 03:56:45 +01:00
committed by GitHub
parent 3ca5a0224b
commit c6d3e4f3bd
265 changed files with 499 additions and 666 deletions

View File

@@ -256,7 +256,6 @@ public sealed class PiratesRuleSystem : GameRuleSystem
{
_chatManager.DispatchServerAnnouncement(Loc.GetString("nukeops-no-one-ready"));
ev.Cancel();
return;
}
}
}

View File

@@ -23,9 +23,7 @@ public sealed class SecretRuleSystem : GameRuleSystem
public override void Ended()
{
// noop
// Preset should already handle it.
return;
}
private void PickRule()

View File

@@ -114,7 +114,6 @@ public sealed class SuspicionRuleSystem : GameRuleSystem
{
_chatManager.DispatchServerAnnouncement("No players readied up! Can't start Suspicion.");
ev.Cancel();
return;
}
}
@@ -176,8 +175,7 @@ public sealed class SuspicionRuleSystem : GameRuleSystem
traitors.Add(traitorRole);
// try to place uplink
if (!_uplink.AddUplink(mind.OwnedEntity!.Value, traitorStartingBalance))
continue;
_uplink.AddUplink(mind.OwnedEntity!.Value, traitorStartingBalance);
}
foreach (var player in list)

View File

@@ -81,7 +81,6 @@ public sealed class TraitorRuleSystem : GameRuleSystem
{
_chatManager.DispatchServerAnnouncement(Loc.GetString("traitor-no-one-ready"));
ev.Cancel();
return;
}
}
@@ -239,7 +238,7 @@ public sealed class TraitorRuleSystem : GameRuleSystem
float chance = (1f / _playersPerTraitor);
/// If we have too many traitors, divide by how many players below target for next traitor we are.
// If we have too many traitors, divide by how many players below target for next traitor we are.
if (ev.JoinOrder < target)
{
chance /= (target - ev.JoinOrder);
@@ -252,7 +251,7 @@ public sealed class TraitorRuleSystem : GameRuleSystem
// Now that we've calculated our chance, roll and make them a traitor if we roll under.
// You get one shot.
if (_random.Prob((float) chance))
if (_random.Prob(chance))
{
MakeTraitor(ev.Player);
}
@@ -330,10 +329,10 @@ public sealed class TraitorRuleSystem : GameRuleSystem
ev.AddLine(result);
}
public IEnumerable<Traitor.TraitorRole> GetOtherTraitorsAliveAndConnected(Mind.Mind ourMind)
public IEnumerable<TraitorRole> GetOtherTraitorsAliveAndConnected(Mind.Mind ourMind)
{
var traitors = Traitors;
List<Traitor.TraitorRole> removeList = new();
List<TraitorRole> removeList = new();
return Traitors // don't want
.Where(t => t.Mind is not null) // no mind

View File

@@ -1,3 +1,4 @@
using System.Globalization;
using System.Linq;
using Content.Server.Actions;
using Content.Server.Chat.Managers;
@@ -77,9 +78,9 @@ public sealed class ZombieRuleSystem : GameRuleSystem
else if (percent <= 0.25)
ev.AddLine(Loc.GetString("zombie-round-end-amount-low"));
else if (percent <= 0.5)
ev.AddLine(Loc.GetString("zombie-round-end-amount-medium", ("percent", Math.Round((percent * 100), 2).ToString())));
ev.AddLine(Loc.GetString("zombie-round-end-amount-medium", ("percent", Math.Round((percent * 100), 2).ToString(CultureInfo.InvariantCulture))));
else if (percent < 1)
ev.AddLine(Loc.GetString("zombie-round-end-amount-high", ("percent", Math.Round((percent * 100), 2).ToString())));
ev.AddLine(Loc.GetString("zombie-round-end-amount-high", ("percent", Math.Round((percent * 100), 2).ToString(CultureInfo.InvariantCulture))));
else
ev.AddLine(Loc.GetString("zombie-round-end-amount-all"));
@@ -174,7 +175,6 @@ public sealed class ZombieRuleSystem : GameRuleSystem
{
_chatManager.DispatchServerAnnouncement(Loc.GetString("zombie-no-one-ready"));
ev.Cancel();
return;
}
}
@@ -216,7 +216,7 @@ public sealed class ZombieRuleSystem : GameRuleSystem
livingHumans.Add(mob.Owner);
}
}
return ((float) livingZombies.Count) / (float) totalPlayers.Count;
return livingZombies.Count / (float) totalPlayers.Count;
}
/// <summary>