2022-06-28 22:54:08 +10:00
|
|
|
using Content.Server.Power.EntitySystems;
|
|
|
|
|
using Content.Server.Research.Components;
|
2022-12-25 16:22:23 -05:00
|
|
|
using Content.Shared.Research.Components;
|
2022-06-28 22:54:08 +10:00
|
|
|
|
2022-12-19 16:14:02 -05:00
|
|
|
namespace Content.Server.Research.Systems;
|
2022-06-28 22:54:08 +10:00
|
|
|
|
|
|
|
|
public sealed partial class ResearchSystem
|
|
|
|
|
{
|
2022-12-19 16:14:02 -05:00
|
|
|
private void InitializeSource()
|
|
|
|
|
{
|
|
|
|
|
SubscribeLocalEvent<ResearchPointSourceComponent, ResearchServerGetPointsPerSecondEvent>(OnGetPointsPerSecond);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnGetPointsPerSecond(EntityUid uid, ResearchPointSourceComponent component, ref ResearchServerGetPointsPerSecondEvent args)
|
|
|
|
|
{
|
|
|
|
|
if (CanProduce(component))
|
|
|
|
|
args.Points += component.PointsPerSecond;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-28 22:54:08 +10:00
|
|
|
public bool CanProduce(ResearchPointSourceComponent component)
|
|
|
|
|
{
|
|
|
|
|
return component.Active && this.IsPowered(component.Owner, EntityManager);
|
|
|
|
|
}
|
|
|
|
|
}
|