Skip to content

Commit 2bedf55

Browse files
authored
Merge pull request #109 from ELDment/beta-3
feat: Implement `OnPlayerPawnPostThink` event
2 parents 0b79890 + 4882c5a commit 2bedf55

File tree

9 files changed

+1311
-1226
lines changed

9 files changed

+1311
-1226
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
using SwiftlyS2.Shared.Events;
2+
using SwiftlyS2.Shared.SchemaDefinitions;
3+
4+
namespace SwiftlyS2.Core.Events;
5+
6+
internal class OnPlayerPawnPostThinkHookEvent : IOnPlayerPawnPostThinkHookEvent
7+
{
8+
public required CCSPlayerPawn PlayerPawn { get; init; }
9+
}

managed/src/SwiftlyS2.Core/Modules/Events/EventPublisher.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,4 +724,21 @@ public static void InvokeOnMovementServicesRunCommandHook( OnMovementServicesRun
724724
return;
725725
}
726726
}
727+
728+
public static void InvokeOnPlayerPawnPostThinkHook( OnPlayerPawnPostThinkHookEvent @event )
729+
{
730+
if (_subscribers.Count == 0) return;
731+
try
732+
{
733+
foreach (var subscriber in _subscribers)
734+
{
735+
subscriber.InvokeOnPlayerPawnPostThinkHook(@event);
736+
}
737+
}
738+
catch (Exception e)
739+
{
740+
if (!GlobalExceptionHandler.Handle(e)) return;
741+
AnsiConsole.WriteException(e);
742+
}
743+
}
727744
}

0 commit comments

Comments
 (0)