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);
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-19 12:34:31 -07:00
|
|
|
private void OnGetPointsPerSecond(Entity<ResearchPointSourceComponent> source, ref ResearchServerGetPointsPerSecondEvent args)
|
2022-12-19 16:14:02 -05:00
|
|
|
{
|
2023-10-19 12:34:31 -07:00
|
|
|
if (CanProduce(source))
|
|
|
|
|
args.Points += source.Comp.PointsPerSecond;
|
2022-12-19 16:14:02 -05:00
|
|
|
}
|
|
|
|
|
|
2023-10-19 12:34:31 -07:00
|
|
|
public bool CanProduce(Entity<ResearchPointSourceComponent> source)
|
2022-06-28 22:54:08 +10:00
|
|
|
{
|
2023-10-19 12:34:31 -07:00
|
|
|
return source.Comp.Active && this.IsPowered(source, EntityManager);
|
2022-06-28 22:54:08 +10:00
|
|
|
}
|
|
|
|
|
}
|