research disk debug stuff (#13063)

* research disk tweaks

* save a single blessed line of yaml
This commit is contained in:
Nemanja
2022-12-19 22:36:08 -05:00
committed by GitHub
parent 39b8b61bc6
commit 077ebb06ae
3 changed files with 35 additions and 1 deletions

View File

@@ -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<ResearchDiskComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<ResearchDiskComponent, MapInitEvent>(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<TechnologyPrototype>()
.Sum(tech => tech.RequiredPoints);
}
}
}