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

@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Content.Server.GameObjects;
using Content.Server.GameObjects.Components.Mobs;
@@ -31,7 +29,7 @@ namespace Content.Server.PDA
foreach (var item in _prototypeManager.EnumeratePrototypes<UplinkStoreListingPrototype>())
{
var newListing = new UplinkListingData(item.ListingName, item.ItemId, item.Price, item.Category,
item.Description, item.DisplayColor);
item.Description);
RegisterUplinkListing(newListing);
}
@@ -94,11 +92,15 @@ namespace Content.Server.PDA
return false;
}
if (!ChangeBalance(acc, -listing.Price))
{
return false;
}
var player = _entityManager.GetEntity(acc.AccountHolder);
var hands = player.GetComponent<HandsComponent>();
hands.PutInHandOrDrop(_entityManager.SpawnEntity(listing.ItemId,
player.Transform.GridPosition).GetComponent<ItemComponent>());
return ChangeBalance(acc, -listing.Price);
return true;
}