Formatting

This commit is contained in:
MSWS
2024-12-27 12:52:58 -08:00
parent 2a254b683b
commit d61a35a023
4 changed files with 26 additions and 41 deletions

View File

@@ -9,8 +9,8 @@ public class CoinflipLocale : LastRequestLocale, ILRCFLocale {
public IView FailedToChooseInTime(bool choice) {
return new SimpleView {
PREFIX,
"You failed to choose in time, defaulting to" + ChatColors.Green,
choice ? "Heads" : "Tails"
"You failed to choose in time, defaulting to",
$"{ChatColors.Green} {(choice ? "Heads" : "Tails")}{ChatColors.Grey}."
};
}
@@ -18,17 +18,16 @@ public class CoinflipLocale : LastRequestLocale, ILRCFLocale {
return new SimpleView {
PREFIX,
guard,
"chose" + ChatColors.Green,
choice ? "Heads" : "Tails",
ChatColors.Default + ", flipping..."
"chose",
$" {ChatColors.Green}{(choice ? "Heads" : "Tails")}{ChatColors.Grey}, flipping..."
};
}
public IView CoinLandsOn(bool heads) {
return new SimpleView {
PREFIX,
"The coin landed on" + ChatColors.Green,
heads ? "Heads" : "Tails" + ChatColors.White + "."
"The coin landed on",
$" {ChatColors.Green}{(heads ? "Heads" : "Tails")}{ChatColors.Grey}."
};
}
}

View File

@@ -13,10 +13,11 @@ public class DebugZone(IServiceProvider services, BasePlugin plugin)
private readonly IDictionary<ulong, ITypedZoneCreator> creators =
new Dictionary<ulong, ITypedZoneCreator>();
private readonly IZoneFactory? factory = services.GetService<IZoneFactory>();
private readonly IZoneFactory factory =
services.GetRequiredService<IZoneFactory>();
private readonly IZoneManager? zoneManager =
services.GetService<IZoneManager>();
private readonly IZoneManager zoneManager =
services.GetRequiredService<IZoneManager>();
public override void OnCommand(CCSPlayerController? executor,
WrappedInfo info) {
@@ -27,11 +28,6 @@ public class DebugZone(IServiceProvider services, BasePlugin plugin)
return;
}
if (factory == null || zoneManager == null) {
info.ReplyToCommand("Zone factory or manager not found");
return;
}
var position = executor.PlayerPawn.Value.AbsOrigin;
if (info.ArgCount <= 1) {
@@ -90,17 +86,15 @@ public class DebugZone(IServiceProvider services, BasePlugin plugin)
}
if (zoneCount == 0) {
if (specifiedType.HasValue)
info.ReplyToCommand($"No {specifiedType} zones found");
else
info.ReplyToCommand("No zones found");
info.ReplyToCommand(specifiedType.HasValue ?
$"No {specifiedType} zones found" :
"No zones found");
return;
}
if (specifiedType.HasValue)
info.ReplyToCommand($"Showing {zoneCount} {specifiedType} zones");
else
info.ReplyToCommand($"Showing {zoneCount} zones");
info.ReplyToCommand(specifiedType.HasValue ?
$"Showing {zoneCount} {specifiedType} zones" :
$"Showing {zoneCount} zones");
return;
case "remove":
case "delete":
@@ -130,7 +124,6 @@ public class DebugZone(IServiceProvider services, BasePlugin plugin)
return;
case "reload":
case "refresh":
// Server.NextFrameAsync(async () => {
Task.Run(async () => {
await zoneManager.LoadZones(Server.MapName);
var count = (await zoneManager.GetAllZones()).SelectMany(e => e.Value)
@@ -186,11 +179,10 @@ public class DebugZone(IServiceProvider services, BasePlugin plugin)
.GetAwaiter()
.GetResult();
var toRemove = new List<IZone>();
foreach (var spawn in spawns)
if (doNotTeleport.Any(d
=> d.IsInsideZone(spawn.CalculateCenterPoint())))
toRemove.Add(spawn);
var toRemove = spawns.Where(spawn
=> doNotTeleport.Any(
d => d.IsInsideZone(spawn.CalculateCenterPoint())))
.ToList();
info.ReplyToCommand("Removing " + toRemove.Count
+ " auto-generated zones");

View File

@@ -16,19 +16,11 @@ public class SoccerCommandBehavior(IWardenService warden,
new("css_jb_max_soccers",
"The maximum number of soccer balls that the warden can spawn", 3);
private int soccers;
public void Start(BasePlugin basePlugin) {
basePlugin.RegisterListener<Listeners.OnServerPrecacheResources>(manifest
=> {
manifest.AddResource(
"models/props/de_dust/hr_dust/dust_soccerball/dust_soccer_ball001.vmdl");
});
}
private int soccerBalls;
[GameEventHandler]
public HookResult OnRoundStart(EventRoundStart @event, GameEventInfo info) {
soccers = 0;
soccerBalls = 0;
return HookResult.Continue;
}
@@ -42,7 +34,7 @@ public class SoccerCommandBehavior(IWardenService warden,
return;
}
if (soccers >= CV_MAX_SOCCERS.Value) {
if (soccerBalls >= CV_MAX_SOCCERS.Value) {
locale.TooManySoccers.ToChat(player);
return;
}
@@ -66,6 +58,6 @@ public class SoccerCommandBehavior(IWardenService warden,
ball.Teleport(loc);
locale.SoccerSpawned.ToAllChat();
ball.DispatchSpawn();
soccers++;
soccerBalls++;
}
}

View File

@@ -39,6 +39,8 @@ public class Jailbreak : BasePlugin {
manifest.AddResource("soundevents/soundevents_jb.vsndevts");
manifest.AddResource("sounds/explosion.vsnd");
manifest.AddResource("sounds/jihad.vsnd");
manifest.AddResource(
"models/props/de_dust/hr_dust/dust_soccerball/dust_soccer_ball001.vmdl");
});
// Load Managers