Fix errors

This commit is contained in:
DrSmugleaf
2021-12-05 21:02:04 +01:00
parent 2a3b7d809d
commit ab9d0cc6d8
94 changed files with 568 additions and 591 deletions

View File

@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Content.Server.Chat.Managers;
using Content.Shared.CCVar;
@@ -62,9 +60,8 @@ namespace Content.Server.GameTicking.Rules
IPlayerSession? winner = null;
foreach (var playerSession in _playerManager.ServerSessions)
{
var playerEntity = playerSession.AttachedEntity;
if (playerEntity == null
|| !IoCManager.Resolve<IEntityManager>().TryGetComponent(playerEntity, out MobStateComponent? state))
if (playerSession.AttachedEntity is not {Valid: true} playerEntity
|| !_entityManager.TryGetComponent(playerEntity, out MobStateComponent? state))
{
continue;
}

View File

@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Content.Server.Chat.Managers;
using Content.Server.Doors;
@@ -35,6 +33,7 @@ namespace Content.Server.GameTicking.Rules
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly IEntityManager _entities = default!;
[DataField("addedSound")] private SoundSpecifier _addedSound = new SoundPathSpecifier("/Audio/Misc/tatoralert.ogg");
@@ -90,9 +89,9 @@ namespace Content.Server.GameTicking.Rules
foreach (var playerSession in _playerManager.ServerSessions)
{
if (playerSession.AttachedEntity == null
|| !IoCManager.Resolve<IEntityManager>().TryGetComponent(playerSession.AttachedEntity, out MobStateComponent? mobState)
|| !IoCManager.Resolve<IEntityManager>().HasComponent<SuspicionRoleComponent>(playerSession.AttachedEntity))
if (playerSession.AttachedEntity is not {Valid: true} playerEntity
|| !_entities.TryGetComponent(playerEntity, out MobStateComponent? mobState)
|| !_entities.HasComponent<SuspicionRoleComponent>(playerEntity))
{
continue;
}