Fix ghost role exceptions (#6106)
This commit is contained in:
@@ -5,7 +5,9 @@ using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Ghost.Roles.Components
|
||||
@@ -31,7 +33,7 @@ namespace Content.Server.Ghost.Roles.Components
|
||||
|
||||
[CanBeNull]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("prototype")]
|
||||
[DataField("prototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
|
||||
public string? Prototype { get; private set; }
|
||||
|
||||
public override bool Take(IPlayerSession session)
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
using System;
|
||||
using Content.Server.Mind.Commands;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Players;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Ghost.Roles.Components
|
||||
{
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace Content.Server.Ghost.Roles
|
||||
SubscribeLocalEvent<PlayerAttachedEvent>(OnPlayerAttached);
|
||||
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MindRemovedMessage>(OnMindRemoved);
|
||||
SubscribeLocalEvent<GhostTakeoverAvailableComponent, MobStateChangedEvent>(OnMobStateChanged);
|
||||
|
||||
_playerManager.PlayerStatusChanged += PlayerStatusChanged;
|
||||
}
|
||||
|
||||
@@ -231,8 +230,10 @@ namespace Content.Server.Ghost.Roles
|
||||
|
||||
private void OnMindRemoved(EntityUid uid, GhostRoleComponent component, MindRemovedMessage args)
|
||||
{
|
||||
if (!component.ReregisterOnGhost)
|
||||
// Avoid re-registering it for duplicate entries and potential exceptions.
|
||||
if (!component.ReregisterOnGhost || component.LifeStage > ComponentLifeStage.Running)
|
||||
return;
|
||||
|
||||
component.Taken = false;
|
||||
RegisterGhostRole(component);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
sprite: Markers/jobs.rsi
|
||||
state: centcom
|
||||
- type: GhostRoleMobSpawner
|
||||
prototype: HumanMob_CentcomOfficial
|
||||
prototype: MobHumanCentcomOfficial
|
||||
deleteOnSpawn: true
|
||||
makeSentient: false
|
||||
name: centcom official
|
||||
|
||||
Reference in New Issue
Block a user