RND Rework [Death to Techweb] (#16370)

* Techweb rework

* more ui work

* finishing ui

* Finish all the C# logic

* the techs + lathes

* remove old-tech

* mirror-review
This commit is contained in:
Nemanja
2023-05-15 16:17:30 -04:00
committed by GitHub
parent a71d9c8eff
commit 9efc727fe1
51 changed files with 1732 additions and 1401 deletions

View File

@@ -0,0 +1,48 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Shared.Research.Prototypes;
/// <summary>
/// This is a prototype for a research discipline, a category
/// that governs how <see cref="TechnologyPrototype"/>s are unlocked.
/// </summary>
[Prototype("techDiscipline")]
public sealed class TechDisciplinePrototype : IPrototype
{
/// <inheritdoc/>
[IdDataField]
public string ID { get; } = default!;
/// <summary>
/// Player-facing name.
/// Supports locale strings.
/// </summary>
[DataField("name", required: true)]
public readonly string Name = string.Empty;
/// <summary>
/// A color used for UI
/// </summary>
[DataField("color", required: true)]
public readonly Color Color;
/// <summary>
/// An icon used to visually represent the discipline in UI.
/// </summary>
[DataField("icon")]
public readonly SpriteSpecifier Icon = default!;
/// <summary>
/// For each tier a discipline supports, what percentage
/// of the previous tier must be unlocked for it to become available
/// </summary>
[DataField("tierPrerequisites", required: true)]
public readonly Dictionary<int, float> TierPrerequisites = new();
/// <summary>
/// Purchasing this tier of technology causes a server to become "locked" to this discipline.
/// </summary>
[DataField("lockoutTier")]
public readonly int LockoutTier = 3;
}

View File

@@ -1,54 +1,92 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.Utility;
namespace Content.Shared.Research.Prototypes
namespace Content.Shared.Research.Prototypes;
/// <summary>
/// This is a prototype for a technology that can be unlocked.
/// </summary>
[Prototype("technology")]
public sealed class TechnologyPrototype : IPrototype
{
[NetSerializable, Serializable, Prototype("technology")]
public sealed class TechnologyPrototype : IPrototype
{
/// <summary>
/// The ID of this technology prototype.
/// </summary>
[ViewVariables]
[IdDataField]
public string ID { get; } = default!;
/// <inheritdoc/>
[IdDataField]
public string ID { get; } = default!;
/// <summary>
/// The name this technology will have on user interfaces.
/// </summary>
[DataField("name")]
public string? Name { get; private set; }
/// <summary>
/// The name of the technology.
/// Supports locale strings
/// </summary>
[DataField("name", required: true)]
public readonly string Name = string.Empty;
/// <summary>
/// An icon that represent this technology.
/// </summary>
[DataField("icon")]
public SpriteSpecifier Icon { get; } = SpriteSpecifier.Invalid;
/// <summary>
/// An icon used to visually represent the technology in UI.
/// </summary>
[DataField("icon", required: true)]
public readonly SpriteSpecifier Icon = default!;
/// <summary>
/// A short description of the technology.
/// </summary>
[DataField("description")]
public string Description { get; private set; } = "";
/// <summary>
/// What research discipline this technology belongs to.
/// </summary>
[DataField("discipline", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<TechDisciplinePrototype>))]
public readonly string Discipline = default!;
/// <summary>
/// The required research points to unlock this technology.
/// </summary>
[DataField("requiredPoints")]
public int RequiredPoints { get; }
/// <summary>
/// What tier research is this?
/// The tier governs how much lower-tier technology
/// needs to be unlocked before this one.
/// </summary>
[DataField("tier", required: true)]
public readonly int Tier;
/// <summary>
/// A list of technology IDs required to unlock this technology.
/// </summary>
[DataField("requiredTechnologies", customTypeSerializer: typeof(PrototypeIdListSerializer<TechnologyPrototype>))]
public List<string> RequiredTechnologies { get; } = new();
/// <summary>
/// Hidden tech is not ever available at the research console.
/// </summary>
[DataField("hidden")]
public readonly bool Hidden;
/// <summary>
/// A list of recipe IDs this technology unlocks.
/// </summary>
[DataField("unlockedRecipes", customTypeSerializer:typeof(PrototypeIdListSerializer<LatheRecipePrototype>))]
public List<string> UnlockedRecipes { get; } = new();
}
/// <summary>
/// How much research is needed to unlock.
/// </summary>
[DataField("cost")]
public readonly int Cost = 10000;
/// <summary>
/// A list of <see cref="TechnologyPrototype"/>s that need to be unlocked in order to unlock this technology.
/// </summary>
[DataField("technologyPrerequisites", customTypeSerializer: typeof(PrototypeIdListSerializer<TechnologyPrototype>))]
public readonly IReadOnlyList<string> TechnologyPrerequisites = new List<string>();
/// <summary>
/// A list of <see cref="LatheRecipePrototype"/>s that are unlocked by this technology
/// </summary>
[DataField("recipeUnlocks", customTypeSerializer: typeof(PrototypeIdListSerializer<LatheRecipePrototype>))]
public readonly IReadOnlyList<string> RecipeUnlocks = new List<string>();
/// <summary>
/// A list of non-standard effects that are done when this technology is unlocked.
/// </summary>
[DataField("genericUnlocks")]
public readonly IReadOnlyList<GenericUnlock> GenericUnlocks = new List<GenericUnlock>();
}
[DataDefinition]
public record struct GenericUnlock()
{
/// <summary>
/// What event is raised when this is unlocked?
/// Used for doing non-standard logic.
/// </summary>
[DataField("purchaseEvent")]
public readonly object? PurchaseEvent = null;
/// <summary>
/// A player facing tooltip for what the unlock does.
/// Supports locale strings.
/// </summary>
[DataField("unlockDescription")]
public readonly string UnlockDescription = string.Empty;
}