2019-11-17 11:18:39 -05:00
|
|
|
using System.Collections.Generic;
|
2021-03-05 01:08:38 +01:00
|
|
|
using Content.Shared.Preferences;
|
2019-11-17 11:18:39 -05:00
|
|
|
using Robust.Shared.Prototypes;
|
2021-03-05 01:08:38 +01:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2021-09-30 13:35:35 +02:00
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
2019-11-17 11:18:39 -05:00
|
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
|
|
2020-08-13 14:40:27 +02:00
|
|
|
namespace Content.Shared.Roles
|
2019-11-17 11:18:39 -05:00
|
|
|
{
|
|
|
|
|
[Prototype("startingGear")]
|
2021-02-20 00:05:24 +01:00
|
|
|
public class StartingGearPrototype : IPrototype
|
2019-11-17 11:18:39 -05:00
|
|
|
{
|
2021-09-30 13:35:35 +02:00
|
|
|
// TODO: Custom TypeSerializer for dictionary value prototype IDs
|
2021-12-30 22:56:10 +01:00
|
|
|
[DataField("equipment")] private Dictionary<string, string> _equipment = new();
|
2020-12-24 13:42:40 +00:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// if empty, there is no skirt override - instead the uniform provided in equipment is added.
|
|
|
|
|
/// </summary>
|
2021-09-30 13:35:35 +02:00
|
|
|
[DataField("innerclothingskirt", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
|
|
|
|
|
private string _innerClothingSkirt = string.Empty;
|
2021-03-05 01:08:38 +01:00
|
|
|
|
2021-09-30 13:35:35 +02:00
|
|
|
[DataField("satchel", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
|
2021-03-05 01:08:38 +01:00
|
|
|
private string _satchel = string.Empty;
|
|
|
|
|
|
2021-09-30 13:35:35 +02:00
|
|
|
[DataField("duffelbag", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
|
2021-03-05 01:08:38 +01:00
|
|
|
private string _duffelbag = string.Empty;
|
2019-11-17 11:18:39 -05:00
|
|
|
|
2020-06-22 06:37:03 +10:00
|
|
|
public IReadOnlyDictionary<string, string> Inhand => _inHand;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// hand index, item prototype
|
|
|
|
|
/// </summary>
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataField("inhand")]
|
|
|
|
|
private Dictionary<string, string> _inHand = new(0);
|
2020-01-20 09:20:36 +01:00
|
|
|
|
2021-03-05 01:08:38 +01:00
|
|
|
[ViewVariables]
|
2021-05-04 15:37:16 +02:00
|
|
|
[DataField("id", required: true)]
|
2021-09-30 13:35:35 +02:00
|
|
|
public string ID { get; } = string.Empty;
|
2020-12-24 13:42:40 +00:00
|
|
|
|
2021-12-30 22:56:10 +01:00
|
|
|
public string GetGear(string slot, HumanoidCharacterProfile? profile)
|
2020-12-24 13:42:40 +00:00
|
|
|
{
|
|
|
|
|
if (profile != null)
|
|
|
|
|
{
|
2021-12-30 22:56:10 +01:00
|
|
|
if (slot == "jumpsuit" && profile.Clothing == ClothingPreference.Jumpskirt && !string.IsNullOrEmpty(_innerClothingSkirt))
|
2020-12-24 13:42:40 +00:00
|
|
|
return _innerClothingSkirt;
|
2021-12-30 22:56:10 +01:00
|
|
|
if (slot == "back" && profile.Backpack == BackpackPreference.Satchel && !string.IsNullOrEmpty(_satchel))
|
2021-01-03 15:22:14 +00:00
|
|
|
return _satchel;
|
2021-12-30 22:56:10 +01:00
|
|
|
if (slot == "back" && profile.Backpack == BackpackPreference.Duffelbag && !string.IsNullOrEmpty(_duffelbag))
|
2021-01-03 15:22:14 +00:00
|
|
|
return _duffelbag;
|
2020-12-24 13:42:40 +00:00
|
|
|
}
|
|
|
|
|
|
2021-12-30 22:56:10 +01:00
|
|
|
return _equipment.TryGetValue(slot, out var equipment) ? equipment : string.Empty;
|
2019-11-17 11:18:39 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|