Fixed some map saving bugs with ID cards/PDAs.

This commit is contained in:
Pieter-Jan Briers
2021-01-15 17:20:02 +01:00
parent a668e545ed
commit e51f74a1f1
2 changed files with 9 additions and 4 deletions

View File

@@ -36,7 +36,7 @@ namespace Content.Server.GameObjects.Components.PDA
[RegisterComponent]
[ComponentReference(typeof(IActivate))]
[ComponentReference(typeof(IAccess))]
public class PDAComponent : SharedPDAComponent, IInteractUsing, IActivate, IUse, IAccess
public class PDAComponent : SharedPDAComponent, IInteractUsing, IActivate, IUse, IAccess, IMapInit
{
[Dependency] private readonly IPDAUplinkManager _uplinkManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
@@ -86,6 +86,11 @@ namespace Content.Server.GameObjects.Components.PDA
UserInterface.OnReceiveMessage += UserInterfaceOnReceiveMessage;
}
UpdatePDAAppearance();
}
public void MapInit()
{
if (!string.IsNullOrEmpty(_startingIdCard))
{
var idCard = _entityManager.SpawnEntity(_startingIdCard, Owner.Transform.Coordinates);
@@ -99,8 +104,6 @@ namespace Content.Server.GameObjects.Components.PDA
var pen = _entityManager.SpawnEntity(_startingPen, Owner.Transform.Coordinates);
_penSlot.Insert(pen);
}
UpdatePDAAppearance();
}
private void UserInterfaceOnReceiveMessage(ServerBoundUserInterfaceMessage message)
@@ -434,6 +437,7 @@ namespace Content.Server.GameObjects.Components.PDA
}
ISet<string> IAccess.Tags => _accessSet;
bool IAccess.IsReadOnly => true;
void IAccess.SetTags(IEnumerable<string> newTags)