Skip to content

Commit

Permalink
Fix misc. bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Aug 29, 2024
1 parent 4a82e2b commit da07024
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
12 changes: 12 additions & 0 deletions mod/Jailbreak.SpecialDay/SpecialDays/HideAndSeekDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
using Jailbreak.Formatting.Extensions;
using Jailbreak.Formatting.Views.SpecialDay;
using Jailbreak.Public.Extensions;
using Jailbreak.Public.Mod.LastRequest;
using Jailbreak.Public.Mod.SpecialDay;
using Jailbreak.Public.Mod.SpecialDay.Enums;
using Jailbreak.Public.Utils;
using Jailbreak.Validator;
using Microsoft.Extensions.DependencyInjection;

namespace Jailbreak.SpecialDay.SpecialDays;

Expand Down Expand Up @@ -143,6 +145,16 @@ public override void Execute() {
foreach (var ct in PlayerUtil.FromTeam(HiderTeam.Value)) ct.SetSpeed(1);
}

override protected HookResult OnPickup(EventItemPickup @event,
GameEventInfo info) {
var lrProvider = provider.GetService<ILastRequestManager>();
if (lrProvider == null) return base.OnPickup(@event, info);

return lrProvider.IsLREnabled ?
HookResult.Continue :
base.OnPickup(@event, info);
}

public class HnsSettings : SpecialDaySettings {
private readonly ISet<string>? cachedGuardWeapons, cachedPrisonerWeapons;

Expand Down
1 change: 1 addition & 0 deletions mod/Jailbreak.SpecialDay/SpecialDays/SpeedrunDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ private void endRound() {
winner.GiveNamedItem(weapon);

Plugin.RemoveListener<Listeners.OnTick>(checkFinishers);
Plugin.DeregisterEventHandler<EventItemPickup>(OnPickup);
RoundUtil.SetTimeRemaining(Math.Min(timeToSet, CV_WIN_TIME_MAX.Value));
Server.ExecuteCommand("mp_ignore_round_win_conditions 0");
return;
Expand Down
19 changes: 14 additions & 5 deletions mod/Jailbreak.Warden/Commands/SoccerCommandBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ namespace Jailbreak.Warden.Commands;

public class SoccerCommandBehavior(IWardenService warden,
IWardenLocale wardenLocale, IWardenCmdSoccerLocale locale) : IPluginBehavior {
public void Start(BasePlugin basePlugin) {
basePlugin.RegisterListener<Listeners.OnServerPrecacheResources>((manifest)
=> {
manifest.AddResource(
"models/props/de_dust/hr_dust/dust_soccerball/dust_soccer_ball001.vmdl");
});
}

public static readonly FakeConVar<int> CV_MAX_SOCCERS =
new("css_jb_max_soccers",
"The maximum number of soccer balls that the warden can spawn", 3);
Expand Down Expand Up @@ -39,10 +47,10 @@ public void Command_Toggle(CCSPlayerController? player, CommandInfo command) {
return;
}

var chicken =
var ball =
Utilities.CreateEntityByName<CPhysicsPropMultiplayer>(
"prop_physics_multiplayer");
if (chicken == null || !chicken.IsValid) {
if (ball == null || !ball.IsValid) {
locale.SpawnFailed.ToChat(player);
return;
}
Expand All @@ -52,11 +60,12 @@ public void Command_Toggle(CCSPlayerController? player, CommandInfo command) {
locale.SpawnFailed.ToChat(player);
return;
}
chicken.SetModel(

ball.SetModel(
"models/props/de_dust/hr_dust/dust_soccerball/dust_soccer_ball001.vmdl");
chicken.Teleport(loc);
ball.Teleport(loc);
locale.SoccerSpawned.ToAllChat();
chicken.DispatchSpawn();
ball.DispatchSpawn();
soccers++;
}
}

0 comments on commit da07024

Please sign in to comment.