Fixes uplink account creation failing if you have any non-antag role.

Fixes #2740
This commit is contained in:
Vera Aguilera Puerto
2020-12-15 11:29:11 +01:00
parent a9481bc05f
commit 0a50f608c6
2 changed files with 5 additions and 16 deletions

View File

@@ -1,12 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Content.Server.GameTicking.GameRules; using Content.Server.GameTicking.GameRules;
using Content.Server.Interfaces.GameTicking; using Content.Server.Interfaces.GameTicking;
using Content.Server.Interfaces.Chat; using Content.Server.Interfaces.Chat;
using Content.Server.GameObjects.Components.GUI; using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Items.Storage; using Content.Server.GameObjects.Components.Items.Storage;
using Content.Server.GameObjects.Components.PDA; using Content.Server.GameObjects.Components.PDA;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Markers; using Content.Server.GameObjects.Components.Markers;
using Content.Server.GameObjects.Components.TraitorDeathMatch; using Content.Server.GameObjects.Components.TraitorDeathMatch;
using Content.Server.Mobs; using Content.Server.Mobs;
@@ -20,10 +19,8 @@ using Content.Shared.GameObjects.Components.PDA;
using Content.Shared.GameObjects.Components.Mobs.State; using Content.Shared.GameObjects.Components.Mobs.State;
using Content.Shared; using Content.Shared;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Server.Player;
using Robust.Server.Interfaces.Player; using Robust.Server.Interfaces.Player;
using Robust.Server.Interfaces.Console; using Robust.Shared.IoC;
using Robust.Shared.IoC;
using Robust.Shared.Localization; using Robust.Shared.Localization;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
@@ -79,7 +76,7 @@ namespace Content.Server.GameTicking.GamePresets
// Delete anything that may contain "dangerous" role-specific items. // Delete anything that may contain "dangerous" role-specific items.
// (This includes the PDA, as everybody gets the captain PDA in this mode for true-all-access reasons.) // (This includes the PDA, as everybody gets the captain PDA in this mode for true-all-access reasons.)
var inventory = mind.OwnedEntity.GetComponent<InventoryComponent>(); var inventory = mind.OwnedEntity.GetComponent<InventoryComponent>();
EquipmentSlotDefines.Slots[] victimSlots = new EquipmentSlotDefines.Slots[] {EquipmentSlotDefines.Slots.IDCARD, EquipmentSlotDefines.Slots.BELT, EquipmentSlotDefines.Slots.BACKPACK}; var victimSlots = new[] {EquipmentSlotDefines.Slots.IDCARD, EquipmentSlotDefines.Slots.BELT, EquipmentSlotDefines.Slots.BACKPACK};
foreach (var slot in victimSlots) foreach (var slot in victimSlots)
if (inventory.TryGetSlotItem(slot, out ItemComponent vItem)) if (inventory.TryGetSlotItem(slot, out ItemComponent vItem))
vItem.Owner.Delete(); vItem.Owner.Delete();

View File

@@ -53,17 +53,9 @@ namespace Content.Server.PDA
{ {
var entity = _entityManager.GetEntity(acc.AccountHolder); var entity = _entityManager.GetEntity(acc.AccountHolder);
if (entity.TryGetComponent(out MindComponent mindComponent)) if (entity.TryGetComponent(out MindComponent mindComponent) && !mindComponent.HasMind)
{ {
if (!mindComponent.HasMind) return false;
{
return false;
}
if (mindComponent.Mind!.AllRoles.Any(role => !role.Antagonist))
{
return false;
}
} }
if (_accounts.Contains(acc)) if (_accounts.Contains(acc))