Skip to content

Commit

Permalink
Add helper LR print function
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Feb 21, 2024
1 parent 7ec2bf5 commit e72ba27
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 9 additions & 4 deletions mod/Jailbreak.LastRequest/LastRequests/KnifeFight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,25 @@ public override void Setup()
guard.RemoveWeapons();
guard.Teleport(prisoner.Pawn.Value!.AbsOrigin!, prisoner.Pawn.Value.AbsRotation!, new Vector());
state = LRState.Pending;
plugin.AddTimer(3, Execute);
for (var i = 3; i >= 1; i--)
{
var copy = i;
plugin.AddTimer(3 - i, () => { PrintToParticipants($"{copy}..."); });
}

plugin.AddTimer(4, Execute);
}

public override void Execute()
{
prisoner.PrintToChat("Begin!");
guard.PrintToChat("Begin!");
PrintToParticipants("Go!");
prisoner.GiveNamedItem("weapon_knife");
guard.GiveNamedItem("weapon_knife");
this.state = LRState.Active;
}

public override void End(LRResult result)
{
this.state = LRState.Completed;
state = LRState.Completed;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public abstract class AbstractLastRequest

public LRState state { get; protected set; }
protected BasePlugin plugin;
protected DateTimeOffset startTime;

protected AbstractLastRequest(BasePlugin plugin, CCSPlayerController prisoner, CCSPlayerController guard)
{
Expand All @@ -20,6 +19,11 @@ protected AbstractLastRequest(BasePlugin plugin, CCSPlayerController prisoner, C
this.guard = guard;
}

public void PrintToParticipants(string message)
{
prisoner.PrintToChat(message);
guard.PrintToChat(message);
}

public abstract void Setup();
public abstract void Execute();
Expand Down

0 comments on commit e72ba27

Please sign in to comment.