diff --git a/Content.Server/Research/Disk/ResearchDiskComponent.cs b/Content.Server/Research/Disk/ResearchDiskComponent.cs index 48f96af2e3..1d4beee1ab 100644 --- a/Content.Server/Research/Disk/ResearchDiskComponent.cs +++ b/Content.Server/Research/Disk/ResearchDiskComponent.cs @@ -3,7 +3,17 @@ namespace Content.Server.Research.Disk [RegisterComponent] public sealed class ResearchDiskComponent : Component { - [DataField("points")] + [DataField("points"), ViewVariables(VVAccess.ReadWrite)] public int Points = 1000; + + /// + /// If true, the value of this disk will be set to the sum + /// of all the technologies in the game. + /// + /// + /// This is for debug purposes only. + /// + [DataField("unlockAllTech")] + public bool UnlockAllTech = false; } } diff --git a/Content.Server/Research/Disk/ResearchDiskSystem.cs b/Content.Server/Research/Disk/ResearchDiskSystem.cs index ef55acdee7..c1a5a12bee 100644 --- a/Content.Server/Research/Disk/ResearchDiskSystem.cs +++ b/Content.Server/Research/Disk/ResearchDiskSystem.cs @@ -1,19 +1,24 @@ +using System.Linq; using Content.Shared.Interaction; using Content.Server.Research.Components; using Content.Server.Popups; +using Content.Shared.Research.Prototypes; using Content.Server.Research.Systems; using Robust.Shared.Player; +using Robust.Shared.Prototypes; namespace Content.Server.Research.Disk { public sealed class ResearchDiskSystem : EntitySystem { + [Dependency] private readonly IPrototypeManager _prototype = default!; [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly ResearchSystem _research = default!; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnAfterInteract); + SubscribeLocalEvent(OnMapInit); } private void OnAfterInteract(EntityUid uid, ResearchDiskComponent component, AfterInteractEvent args) @@ -28,5 +33,14 @@ namespace Content.Server.Research.Disk _popupSystem.PopupEntity(Loc.GetString("research-disk-inserted", ("points", component.Points)), args.Target.Value, args.User); EntityManager.QueueDeleteEntity(uid); } + + private void OnMapInit(EntityUid uid, ResearchDiskComponent component, MapInitEvent args) + { + if (!component.UnlockAllTech) + return; + + component.Points = _prototype.EnumeratePrototypes() + .Sum(tech => tech.RequiredPoints); + } } } diff --git a/Resources/Prototypes/Entities/Objects/Specific/Research/disk.yml b/Resources/Prototypes/Entities/Objects/Specific/Research/disk.yml index eb35884cba..f1464aba79 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Research/disk.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Research/disk.yml @@ -26,3 +26,13 @@ components: - type: ResearchDisk points: 10000 + +- type: entity + parent: ResearchDisk + id: ResearchDiskDebug + name: research point disk + suffix: DEBUG, DO NOT MAP + description: A disk for the R&D server containing all the points you could ever need. + components: + - type: ResearchDisk + unlockAllTech: true