Vending Machines (#296)

* Vending Machines

* addressed review
This commit is contained in:
DamianX
2019-08-14 10:49:28 +02:00
committed by Pieter-Jan Briers
parent 3c476d2b40
commit 88920696f3
199 changed files with 1217 additions and 2 deletions

View File

@@ -0,0 +1,41 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using YamlDotNet.RepresentationModel;
namespace Content.Shared.VendingMachines
{
[Serializable, NetSerializable, Prototype("vendingMachineInventory")]
public class VendingMachineInventoryPrototype : IPrototype, IIndexedPrototype
{
private string _id;
private string _name;
private string _description;
private double _animationDuration;
private string _spriteName;
private Dictionary<string, uint> _startingInventory;
public string ID => _id;
public string Name => _name;
public string Description => _description;
public double AnimationDuration => _animationDuration;
public string SpriteName => _spriteName;
public Dictionary<string, uint> StartingInventory => _startingInventory;
public void LoadFrom(YamlMappingNode mapping)
{
var serializer = YamlObjectSerializer.NewReader(mapping);
serializer.DataField(ref _id, "id", string.Empty);
serializer.DataField(ref _name, "name", string.Empty);
serializer.DataField(ref _description, "description", string.Empty);
serializer.DataField<double>(ref _animationDuration, "animationDuration", 0);
serializer.DataField(ref _spriteName, "spriteName", string.Empty);
serializer.DataField(ref _startingInventory, "startingInventory", new Dictionary<string, uint>());
}
}
}