Content PR for YAML hot reloading (#3319)
* Content PR for YAML hot reloading * Add CanAdminReloadPrototypes (host permission) * IndexedPrototype fixes
This commit is contained in:
@@ -9,7 +9,7 @@ using YamlDotNet.RepresentationModel;
|
||||
namespace Content.Shared.Prototypes.Cargo
|
||||
{
|
||||
[NetSerializable, Serializable, Prototype("cargoProduct")]
|
||||
public class CargoProductPrototype : IPrototype, IIndexedPrototype
|
||||
public class CargoProductPrototype : IPrototype
|
||||
{
|
||||
private string _id;
|
||||
private string _name;
|
||||
|
||||
@@ -6,7 +6,7 @@ using YamlDotNet.RepresentationModel;
|
||||
namespace Content.Shared.Prototypes
|
||||
{
|
||||
[Prototype("dataset")]
|
||||
public class DatasetPrototype : IPrototype, IIndexedPrototype
|
||||
public class DatasetPrototype : IPrototype
|
||||
{
|
||||
private string _id;
|
||||
public string ID => _id;
|
||||
|
||||
@@ -9,20 +9,17 @@ namespace Content.Shared.Prototypes.Kitchen
|
||||
/// <summary>
|
||||
/// A recipe for space microwaves.
|
||||
/// </summary>
|
||||
|
||||
[Prototype("microwaveMealRecipe")]
|
||||
|
||||
public class FoodRecipePrototype : IPrototype, IIndexedPrototype
|
||||
public class FoodRecipePrototype : IPrototype
|
||||
{
|
||||
|
||||
private string _id;
|
||||
private string _name;
|
||||
private string _result;
|
||||
private int _cookTime;
|
||||
|
||||
|
||||
private Dictionary<string, int> _ingsReagents;
|
||||
private Dictionary<string, int> _ingsSolids;
|
||||
|
||||
|
||||
public string Name => Loc.GetString(_name);
|
||||
public string ID => _id;
|
||||
public string Result => _result;
|
||||
@@ -30,7 +27,6 @@ namespace Content.Shared.Prototypes.Kitchen
|
||||
public IReadOnlyDictionary<string, int> IngredientsReagents => _ingsReagents;
|
||||
public IReadOnlyDictionary<string, int> IngredientsSolids => _ingsSolids;
|
||||
|
||||
|
||||
public void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
var serializer = YamlObjectSerializer.NewReader(mapping);
|
||||
@@ -42,6 +38,5 @@ namespace Content.Shared.Prototypes.Kitchen
|
||||
serializer.DataField(ref _ingsSolids, "solids", new Dictionary<string, int>());
|
||||
serializer.DataField(ref _cookTime, "time", 5);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,8 @@ using YamlDotNet.RepresentationModel;
|
||||
namespace Content.Shared.Prototypes.PDA
|
||||
{
|
||||
[Prototype("uplinkListing")]
|
||||
public class UplinkStoreListingPrototype : IPrototype, IIndexedPrototype
|
||||
public class UplinkStoreListingPrototype : IPrototype
|
||||
{
|
||||
|
||||
private string _id;
|
||||
private string _itemId;
|
||||
private int _price;
|
||||
@@ -23,6 +22,7 @@ namespace Content.Shared.Prototypes.PDA
|
||||
public UplinkCategory Category => _category;
|
||||
public string Description => _desc;
|
||||
public string ListingName => _name;
|
||||
|
||||
public void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
var serializer = YamlObjectSerializer.NewReader(mapping);
|
||||
@@ -32,7 +32,6 @@ namespace Content.Shared.Prototypes.PDA
|
||||
serializer.DataField(ref _category, "category", UplinkCategory.Utility);
|
||||
serializer.DataField(ref _desc, "description", string.Empty);
|
||||
serializer.DataField(ref _name, "listingName", string.Empty);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Content.Shared.Prototypes.Tag
|
||||
/// gets saved in TagComponent.
|
||||
/// </summary>
|
||||
[Prototype("Tag")]
|
||||
public class TagPrototype : IPrototype, IIndexedPrototype
|
||||
public class TagPrototype : IPrototype
|
||||
{
|
||||
public string ID { get; [UsedImplicitly] private set; } = default!;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user