research disk debug stuff (#13063)
* research disk tweaks * save a single blessed line of yaml
This commit is contained in:
@@ -3,7 +3,17 @@ namespace Content.Server.Research.Disk
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public sealed class ResearchDiskComponent : Component
|
public sealed class ResearchDiskComponent : Component
|
||||||
{
|
{
|
||||||
[DataField("points")]
|
[DataField("points"), ViewVariables(VVAccess.ReadWrite)]
|
||||||
public int Points = 1000;
|
public int Points = 1000;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// If true, the value of this disk will be set to the sum
|
||||||
|
/// of all the technologies in the game.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This is for debug purposes only.
|
||||||
|
/// </remarks>
|
||||||
|
[DataField("unlockAllTech")]
|
||||||
|
public bool UnlockAllTech = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,24 @@
|
|||||||
|
using System.Linq;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Server.Research.Components;
|
using Content.Server.Research.Components;
|
||||||
using Content.Server.Popups;
|
using Content.Server.Popups;
|
||||||
|
using Content.Shared.Research.Prototypes;
|
||||||
using Content.Server.Research.Systems;
|
using Content.Server.Research.Systems;
|
||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Server.Research.Disk
|
namespace Content.Server.Research.Disk
|
||||||
{
|
{
|
||||||
public sealed class ResearchDiskSystem : EntitySystem
|
public sealed class ResearchDiskSystem : EntitySystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||||
[Dependency] private readonly ResearchSystem _research = default!;
|
[Dependency] private readonly ResearchSystem _research = default!;
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
SubscribeLocalEvent<ResearchDiskComponent, AfterInteractEvent>(OnAfterInteract);
|
SubscribeLocalEvent<ResearchDiskComponent, AfterInteractEvent>(OnAfterInteract);
|
||||||
|
SubscribeLocalEvent<ResearchDiskComponent, MapInitEvent>(OnMapInit);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnAfterInteract(EntityUid uid, ResearchDiskComponent component, AfterInteractEvent args)
|
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);
|
_popupSystem.PopupEntity(Loc.GetString("research-disk-inserted", ("points", component.Points)), args.Target.Value, args.User);
|
||||||
EntityManager.QueueDeleteEntity(uid);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,3 +26,13 @@
|
|||||||
components:
|
components:
|
||||||
- type: ResearchDisk
|
- type: ResearchDisk
|
||||||
points: 10000
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user