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) { public IView FailedToChooseInTime(bool choice) {
return new SimpleView { return new SimpleView {
PREFIX, PREFIX,
"You failed to choose in time, defaulting to" + ChatColors.Green, "You failed to choose in time, defaulting to",
choice ? "Heads" : "Tails" $"{ChatColors.Green} {(choice ? "Heads" : "Tails")}{ChatColors.Grey}."
}; };
} }
@@ -18,17 +18,16 @@ public class CoinflipLocale : LastRequestLocale, ILRCFLocale {
return new SimpleView { return new SimpleView {
PREFIX, PREFIX,
guard, guard,
"chose" + ChatColors.Green, "chose",
choice ? "Heads" : "Tails", $" {ChatColors.Green}{(choice ? "Heads" : "Tails")}{ChatColors.Grey}, flipping..."
ChatColors.Default + ", flipping..."
}; };
} }
public IView CoinLandsOn(bool heads) { public IView CoinLandsOn(bool heads) {
return new SimpleView { return new SimpleView {
PREFIX, PREFIX,
"The coin landed on" + ChatColors.Green, "The coin landed on",
heads ? "Heads" : "Tails" + ChatColors.White + "." $" {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 = private readonly IDictionary<ulong, ITypedZoneCreator> creators =
new Dictionary<ulong, ITypedZoneCreator>(); new Dictionary<ulong, ITypedZoneCreator>();
private readonly IZoneFactory? factory = services.GetService<IZoneFactory>(); private readonly IZoneFactory factory =
services.GetRequiredService<IZoneFactory>();
private readonly IZoneManager? zoneManager = private readonly IZoneManager zoneManager =
services.GetService<IZoneManager>(); services.GetRequiredService<IZoneManager>();
public override void OnCommand(CCSPlayerController? executor, public override void OnCommand(CCSPlayerController? executor,
WrappedInfo info) { WrappedInfo info) {
@@ -27,11 +28,6 @@ public class DebugZone(IServiceProvider services, BasePlugin plugin)
return; return;
} }
if (factory == null || zoneManager == null) {
info.ReplyToCommand("Zone factory or manager not found");
return;
}
var position = executor.PlayerPawn.Value.AbsOrigin; var position = executor.PlayerPawn.Value.AbsOrigin;
if (info.ArgCount <= 1) { if (info.ArgCount <= 1) {
@@ -90,17 +86,15 @@ public class DebugZone(IServiceProvider services, BasePlugin plugin)
} }
if (zoneCount == 0) { if (zoneCount == 0) {
if (specifiedType.HasValue) info.ReplyToCommand(specifiedType.HasValue ?
info.ReplyToCommand($"No {specifiedType} zones found"); $"No {specifiedType} zones found" :
else "No zones found");
info.ReplyToCommand("No zones found");
return; return;
} }
if (specifiedType.HasValue) info.ReplyToCommand(specifiedType.HasValue ?
info.ReplyToCommand($"Showing {zoneCount} {specifiedType} zones"); $"Showing {zoneCount} {specifiedType} zones" :
else $"Showing {zoneCount} zones");
info.ReplyToCommand($"Showing {zoneCount} zones");
return; return;
case "remove": case "remove":
case "delete": case "delete":
@@ -130,7 +124,6 @@ public class DebugZone(IServiceProvider services, BasePlugin plugin)
return; return;
case "reload": case "reload":
case "refresh": case "refresh":
// Server.NextFrameAsync(async () => {
Task.Run(async () => { Task.Run(async () => {
await zoneManager.LoadZones(Server.MapName); await zoneManager.LoadZones(Server.MapName);
var count = (await zoneManager.GetAllZones()).SelectMany(e => e.Value) var count = (await zoneManager.GetAllZones()).SelectMany(e => e.Value)
@@ -186,11 +179,10 @@ public class DebugZone(IServiceProvider services, BasePlugin plugin)
.GetAwaiter() .GetAwaiter()
.GetResult(); .GetResult();
var toRemove = new List<IZone>(); var toRemove = spawns.Where(spawn
foreach (var spawn in spawns) => doNotTeleport.Any(
if (doNotTeleport.Any(d d => d.IsInsideZone(spawn.CalculateCenterPoint())))
=> d.IsInsideZone(spawn.CalculateCenterPoint()))) .ToList();
toRemove.Add(spawn);
info.ReplyToCommand("Removing " + toRemove.Count info.ReplyToCommand("Removing " + toRemove.Count
+ " auto-generated zones"); + " auto-generated zones");

View File

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

View File

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