Cap passive research points so people spend points more (#11606)

This commit is contained in:
Rane
2022-10-03 21:10:16 -04:00
committed by GitHub
parent 4a736f2c8f
commit 30e831163c
2 changed files with 14 additions and 1 deletions

View File

@@ -11,6 +11,12 @@ namespace Content.Server.Research.Components
[ViewVariables(VVAccess.ReadWrite)] [DataField("points")] [ViewVariables(VVAccess.ReadWrite)] [DataField("points")]
public int Points = 0; public int Points = 0;
/// <summary>
/// To encourage people to spend points,
/// will not accept passive points gain above this number for each source.
/// </summary>
[DataField("passiveLimitPerSource")]
public int PassiveLimitPerSource = 30000;
[ViewVariables(VVAccess.ReadOnly)] public int Id { get; set; } [ViewVariables(VVAccess.ReadOnly)] public int Id { get; set; }
[ViewVariables(VVAccess.ReadOnly)] [ViewVariables(VVAccess.ReadOnly)]

View File

@@ -1,4 +1,5 @@
using Content.Server.Power.EntitySystems; using Content.Server.Power.EntitySystems;
using Content.Server.Station.Systems;
using Content.Server.Research.Components; using Content.Server.Research.Components;
using Content.Shared.Research.Prototypes; using Content.Shared.Research.Prototypes;
@@ -6,6 +7,7 @@ namespace Content.Server.Research;
public sealed partial class ResearchSystem public sealed partial class ResearchSystem
{ {
[Dependency] private readonly StationSystem _stationSystem = default!;
private void InitializeServer() private void InitializeServer()
{ {
SubscribeLocalEvent<ResearchServerComponent, ComponentStartup>(OnServerStartup); SubscribeLocalEvent<ResearchServerComponent, ComponentStartup>(OnServerStartup);
@@ -35,6 +37,10 @@ public sealed partial class ResearchSystem
public bool RegisterServerClient(ResearchServerComponent component, ResearchClientComponent clientComponent) public bool RegisterServerClient(ResearchServerComponent component, ResearchClientComponent clientComponent)
{ {
// Has to be on the same station
if (_stationSystem.GetOwningStation(component.Owner) != _stationSystem.GetOwningStation(clientComponent.Owner))
return false;
// TODO: This is shit but I'm just trying to fix RND for now until it gets bulldozed // TODO: This is shit but I'm just trying to fix RND for now until it gets bulldozed
if (TryComp<ResearchPointSourceComponent>(clientComponent.Owner, out var source)) if (TryComp<ResearchPointSourceComponent>(clientComponent.Owner, out var source))
{ {
@@ -96,7 +102,8 @@ public sealed partial class ResearchSystem
{ {
var points = 0; var points = 0;
if (CanRun(component)) // Is our machine powered, and are we below our limit of passive point gain?
if (CanRun(component) && component.Points < (component.PassiveLimitPerSource * component.PointSources.Count))
{ {
foreach (var source in component.PointSources) foreach (var source in component.PointSources)
{ {