pda improvements (#1072)

Co-authored-by: FL-OZ <anotherscuffed@gmail.com>
This commit is contained in:
FL-OZ
2020-06-05 11:44:25 -05:00
committed by GitHub
parent 19c9e3e4f9
commit fa9169e346
10 changed files with 188 additions and 62 deletions

View File

@@ -11,8 +11,10 @@ using Content.Shared.GameObjects.Components.PDA;
using Robust.Server.GameObjects;
using Robust.Server.GameObjects.Components.Container;
using Robust.Server.GameObjects.Components.UserInterface;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Server.Interfaces.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Systems;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
@@ -69,7 +71,8 @@ namespace Content.Server.GameObjects.Components.PDA
_interface.OnReceiveMessage += UserInterfaceOnReceiveMessage;
var idCard = _entityManager.SpawnEntity(_startingIdCard, Owner.Transform.GridPosition);
var idCardComponent = idCard.GetComponent<IdCardComponent>();
InsertIdCard(idCardComponent);
_idSlot.Insert(idCardComponent.Owner);
ContainedID = idCardComponent;
UpdatePDAAppearance();
}
@@ -98,9 +101,11 @@ namespace Content.Server.GameObjects.Components.PDA
{
if (!_uplinkManager.TryPurchaseItem(_syndicateUplinkAccount, buyMsg.ListingToBuy))
{
//TODO: Send a message that tells the buyer they are too poor or something.
SendNetworkMessage(new PDAUplinkInsufficientFundsMessage(), message.Session.ConnectedClient);
break;
}
SendNetworkMessage(new PDAUplinkBuySuccessMessage(), message.Session.ConnectedClient);
break;
}
}
@@ -186,12 +191,14 @@ namespace Content.Server.GameObjects.Components.PDA
OwnerMob = mob;
UpdatePDAUserInterface();
}
private void InsertIdCard(IdCardComponent card)
{
_idSlot.Insert(card.Owner);
ContainedID = card;
EntitySystem.Get<AudioSystem>().Play("/Audio/Guns/MagIn/batrifle_magin.ogg", Owner);
}
/// <summary>
@@ -215,6 +222,7 @@ namespace Content.Server.GameObjects.Components.PDA
{
_lightOn = !_lightOn;
_pdaLight.Enabled = _lightOn;
EntitySystem.Get<AudioSystem>().Play("/Audio/items/flashlight_toggle.ogg", Owner);
UpdatePDAUserInterface();
}
@@ -232,6 +240,8 @@ namespace Content.Server.GameObjects.Components.PDA
var cardItemComponent = cardEntity.GetComponent<ItemComponent>();
hands.PutInHandOrDrop(cardItemComponent);
ContainedID = null;
EntitySystem.Get<AudioSystem>().Play("/Audio/machines/machine_switch.ogg", Owner);
UpdatePDAUserInterface();
}