Re-organize all projects (#4166)
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Prototypes.Cargo
|
||||
{
|
||||
[NetSerializable, Serializable]
|
||||
public class CargoOrderData
|
||||
{
|
||||
public int OrderNumber;
|
||||
public string Requester;
|
||||
// public String RequesterRank; // TODO Figure out how to get Character ID card data
|
||||
// public int RequesterId;
|
||||
public string Reason;
|
||||
public string ProductId;
|
||||
public int Amount;
|
||||
public int PayingAccountId;
|
||||
public bool Approved;
|
||||
|
||||
public CargoOrderData(int orderNumber, string requester, string reason, string productId, int amount, int payingAccountId)
|
||||
{
|
||||
OrderNumber = orderNumber;
|
||||
Requester = requester;
|
||||
Reason = reason;
|
||||
ProductId = productId;
|
||||
Amount = amount;
|
||||
PayingAccountId = payingAccountId;
|
||||
Approved = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Shared.Prototypes.Cargo
|
||||
{
|
||||
[NetSerializable, Serializable, Prototype("cargoProduct")]
|
||||
public class CargoProductPrototype : IPrototype
|
||||
{
|
||||
[DataField("name")] private string _name = string.Empty;
|
||||
|
||||
[DataField("description")] private string _description = string.Empty;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("id", required: true)]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Product name.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_name.Trim().Length != 0)
|
||||
return _name;
|
||||
|
||||
if (IoCManager.Resolve<IPrototypeManager>().TryIndex(Product, out EntityPrototype? prototype))
|
||||
{
|
||||
_name = prototype.Name;
|
||||
}
|
||||
|
||||
return _name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Short description of the product.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_description.Trim().Length != 0)
|
||||
return _description;
|
||||
|
||||
if (IoCManager.Resolve<IPrototypeManager>().TryIndex(Product, out EntityPrototype? prototype))
|
||||
{
|
||||
_description = prototype.Description;
|
||||
}
|
||||
|
||||
return _description;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Texture path used in the CargoConsole GUI.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("icon")]
|
||||
public SpriteSpecifier Icon { get; } = SpriteSpecifier.Invalid;
|
||||
|
||||
/// <summary>
|
||||
/// The prototype name of the product.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("product")]
|
||||
public string Product { get; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The point cost of the product.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("cost")]
|
||||
public int PointCost { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The prototype category of the product. (e.g. Engineering, Medical)
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("category")]
|
||||
public string Category { get; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The prototype group of the product. (e.g. Contraband)
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("group")]
|
||||
public string Group { get; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Shared.Prototypes
|
||||
{
|
||||
[Prototype("dataset")]
|
||||
public class DatasetPrototype : IPrototype
|
||||
{
|
||||
[ViewVariables]
|
||||
[DataField("id", required: true)]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
[DataField("values")] public IReadOnlyList<string> Values { get; } = new List<string>();
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Shared.Prototypes.EntityList
|
||||
{
|
||||
[Prototype("entityList")]
|
||||
public class EntityListPrototype : IPrototype
|
||||
{
|
||||
[ViewVariables]
|
||||
[DataField("id", required: true)]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("entities", customTypeSerializer: typeof(PrototypeIdListSerializer<EntityPrototype>))]
|
||||
public ImmutableList<string> EntityIds { get; } = ImmutableList<string>.Empty;
|
||||
|
||||
public IEnumerable<EntityPrototype> Entities(IPrototypeManager? prototypeManager = null)
|
||||
{
|
||||
prototypeManager ??= IoCManager.Resolve<IPrototypeManager>();
|
||||
|
||||
foreach (var entityId in EntityIds)
|
||||
{
|
||||
yield return prototypeManager.Index<EntityPrototype>(entityId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
Content.Shared/Prototypes/EntityPrototypeHelpers.cs
Normal file
39
Content.Shared/Prototypes/EntityPrototypeHelpers.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Shared.Prototypes
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public static class EntityPrototypeHelpers
|
||||
{
|
||||
public static bool HasComponent<T>(this EntityPrototype prototype, IComponentFactory? componentFactory = null) where T : IComponent
|
||||
{
|
||||
return prototype.HasComponent(typeof(T), componentFactory);
|
||||
}
|
||||
|
||||
public static bool HasComponent(this EntityPrototype prototype, Type component, IComponentFactory? componentFactory = null)
|
||||
{
|
||||
componentFactory ??= IoCManager.Resolve<IComponentFactory>();
|
||||
|
||||
var registration = componentFactory.GetRegistration(component);
|
||||
|
||||
return prototype.Components.ContainsKey(registration.Name);
|
||||
}
|
||||
|
||||
public static bool HasComponent<T>(string prototype, IPrototypeManager? prototypeManager = null, IComponentFactory? componentFactory = null) where T : IComponent
|
||||
{
|
||||
return HasComponent(prototype, typeof(T), prototypeManager, componentFactory);
|
||||
}
|
||||
|
||||
public static bool HasComponent(string prototype, Type component, IPrototypeManager? prototypeManager = null, IComponentFactory? componentFactory = null)
|
||||
{
|
||||
prototypeManager ??= IoCManager.Resolve<IPrototypeManager>();
|
||||
|
||||
return prototypeManager.TryIndex(prototype, out EntityPrototype? proto) && proto!.HasComponent(component, componentFactory);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Shared.Prototypes.HUD
|
||||
{
|
||||
[Prototype("hudTheme")]
|
||||
public class HudThemePrototype : IPrototype
|
||||
{
|
||||
[DataField("name", required: true)]
|
||||
public string Name { get; } = string.Empty;
|
||||
|
||||
[DataField("id", required: true)]
|
||||
public string ID { get; } = string.Empty;
|
||||
|
||||
[DataField("path", required: true)]
|
||||
public string Path { get; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Shared.Prototypes.Kitchen
|
||||
{
|
||||
/// <summary>
|
||||
/// A recipe for space microwaves.
|
||||
/// </summary>
|
||||
[Prototype("microwaveMealRecipe")]
|
||||
public class FoodRecipePrototype : IPrototype
|
||||
{
|
||||
[ViewVariables]
|
||||
[DataField("id", required: true)]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
[DataField("name")]
|
||||
private string _name = string.Empty;
|
||||
|
||||
[DataField("reagents")]
|
||||
private readonly Dictionary<string, int> _ingsReagents = new();
|
||||
|
||||
[DataField("solids")]
|
||||
private readonly Dictionary<string, int> _ingsSolids = new ();
|
||||
|
||||
[DataField("result")]
|
||||
public string Result { get; } = string.Empty;
|
||||
|
||||
[DataField("time")]
|
||||
public int CookTime { get; } = 5;
|
||||
|
||||
public string Name => Loc.GetString(_name);
|
||||
|
||||
public IReadOnlyDictionary<string, int> IngredientsReagents => _ingsReagents;
|
||||
public IReadOnlyDictionary<string, int> IngredientsSolids => _ingsSolids;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
#nullable enable
|
||||
using Content.Shared.GameObjects.Components.PDA;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Shared.Prototypes.PDA
|
||||
{
|
||||
[Prototype("uplinkListing")]
|
||||
public class UplinkStoreListingPrototype : IPrototype
|
||||
{
|
||||
[ViewVariables]
|
||||
[DataField("id", required: true)]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
[DataField("itemId")]
|
||||
public string ItemId { get; } = string.Empty;
|
||||
|
||||
[DataField("price")]
|
||||
public int Price { get; } = 5;
|
||||
|
||||
[DataField("category")]
|
||||
public UplinkCategory Category { get; } = UplinkCategory.Utility;
|
||||
|
||||
[DataField("description")]
|
||||
public string Description { get; } = string.Empty;
|
||||
|
||||
[DataField("listingName")]
|
||||
public string ListingName { get; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Shared.Prototypes.Tag
|
||||
{
|
||||
/// <summary>
|
||||
/// Prototype representing a tag in YAML.
|
||||
/// Meant to only have an ID property, as that is the only thing that
|
||||
/// gets saved in TagComponent.
|
||||
/// </summary>
|
||||
[Prototype("Tag")]
|
||||
public class TagPrototype : IPrototype
|
||||
{
|
||||
[ViewVariables]
|
||||
[DataField("id", required: true)]
|
||||
public string ID { get; } = default!;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user