Skip to content

Commit

Permalink
Resolve circular dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Jul 20, 2024
1 parent 54c38ae commit 357c6ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions mod/TTT.Round/RoundBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using CounterStrikeSharp.API.Modules.Memory;
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
using CounterStrikeSharp.API.Modules.Timers;
using Microsoft.Extensions.DependencyInjection;
using TTT.Public.Behaviors;
using TTT.Public.Extensions;
using TTT.Public.Formatting;
Expand All @@ -13,13 +14,17 @@

namespace TTT.Round;

public class RoundBehavior(IRoleService _roleService)
: IRoundService, IPluginBehavior {
public class RoundBehavior : IRoundService, IPluginBehavior {
private Round? _round;
private int _roundId = 1;
private RoundStatus _roundStatus = RoundStatus.Paused;
private readonly IServiceProvider _provider;
private IRoleService _roleService = null!;

public RoundBehavior(IServiceProvider provider) { _provider = provider; }

public void Start(BasePlugin plugin) {
_roleService = _provider.GetRequiredService<IRoleService>();
plugin.RegisterListener<Listeners.OnTick>(TickWaiting);
plugin.AddCommandListener("jointeam", OnTeamJoin);
VirtualFunctions.CBaseEntity_TakeDamageOldFunc.Hook(BlockDamage,
Expand Down
2 changes: 1 addition & 1 deletion src/TTT/TTTServiceCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ namespace TTT;

public class TTTServiceCollection : IPluginServiceCollection<TTTPlugin> {
public void ConfigureServices(IServiceCollection serviceCollection) {
serviceCollection.AddTTTRoles();
serviceCollection.AddRoundService();
serviceCollection.AddPlayerService();
serviceCollection.AddTTTRoles();
serviceCollection.AddDetectiveBehavior();
serviceCollection.AddLogsService();
serviceCollection.AddManagerService();
Expand Down

0 comments on commit 357c6ad

Please sign in to comment.