Fix anomaly vessels not generating points (#14137)
This commit is contained in:
@@ -88,10 +88,7 @@ public sealed partial class AnomalySystem
|
|||||||
private void OnVesselGetPointsPerSecond(EntityUid uid, AnomalyVesselComponent component, ref ResearchServerGetPointsPerSecondEvent args)
|
private void OnVesselGetPointsPerSecond(EntityUid uid, AnomalyVesselComponent component, ref ResearchServerGetPointsPerSecondEvent args)
|
||||||
{
|
{
|
||||||
if (!this.IsPowered(uid, EntityManager) || component.Anomaly is not {} anomaly)
|
if (!this.IsPowered(uid, EntityManager) || component.Anomaly is not {} anomaly)
|
||||||
{
|
|
||||||
args.Points = 0;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
args.Points += (int) (GetAnomalyPointValue(anomaly) * component.PointMultiplier);
|
args.Points += (int) (GetAnomalyPointValue(anomaly) * component.PointMultiplier);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public sealed partial class ResearchSystem
|
|||||||
{
|
{
|
||||||
private void InitializeClient()
|
private void InitializeClient()
|
||||||
{
|
{
|
||||||
SubscribeLocalEvent<ResearchClientComponent, ComponentStartup>(OnClientStartup);
|
SubscribeLocalEvent<ResearchClientComponent, MapInitEvent>(OnClientMapInit);
|
||||||
SubscribeLocalEvent<ResearchClientComponent, ComponentShutdown>(OnClientShutdown);
|
SubscribeLocalEvent<ResearchClientComponent, ComponentShutdown>(OnClientShutdown);
|
||||||
SubscribeLocalEvent<ResearchClientComponent, BoundUIOpenedEvent>(OnClientUIOpen);
|
SubscribeLocalEvent<ResearchClientComponent, BoundUIOpenedEvent>(OnClientUIOpen);
|
||||||
SubscribeLocalEvent<ResearchClientComponent, ConsoleServerSyncMessage>(OnConsoleSync);
|
SubscribeLocalEvent<ResearchClientComponent, ConsoleServerSyncMessage>(OnConsoleSync);
|
||||||
@@ -26,12 +26,11 @@ public sealed partial class ResearchSystem
|
|||||||
|
|
||||||
private void OnClientSelected(EntityUid uid, ResearchClientComponent component, ResearchClientServerSelectedMessage args)
|
private void OnClientSelected(EntityUid uid, ResearchClientComponent component, ResearchClientServerSelectedMessage args)
|
||||||
{
|
{
|
||||||
var server = GetServerById(args.ServerId);
|
if (!TryGetServerById(args.ServerId, out var serveruid, out var serverComponent))
|
||||||
if (server == null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UnregisterClient(uid, clientComponent: component);
|
UnregisterClient(uid, component);
|
||||||
RegisterClient(uid, server.Owner, component, server);
|
RegisterClient(uid, serveruid.Value, component, serverComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClientDeselected(EntityUid uid, ResearchClientComponent component, ResearchClientServerDeselectedMessage args)
|
private void OnClientDeselected(EntityUid uid, ResearchClientComponent component, ResearchClientServerDeselectedMessage args)
|
||||||
@@ -66,7 +65,7 @@ public sealed partial class ResearchSystem
|
|||||||
UpdateClientInterface(uid, component);
|
UpdateClientInterface(uid, component);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnClientStartup(EntityUid uid, ResearchClientComponent component, ComponentStartup args)
|
private void OnClientMapInit(EntityUid uid, ResearchClientComponent component, MapInitEvent args)
|
||||||
{
|
{
|
||||||
var allServers = EntityQuery<ResearchServerComponent>(true).ToArray();
|
var allServers = EntityQuery<ResearchServerComponent>(true).ToArray();
|
||||||
if (allServers.Length > 0)
|
if (allServers.Length > 0)
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public sealed partial class ResearchSystem
|
|||||||
if (!CanRun(uid))
|
if (!CanRun(uid))
|
||||||
return points;
|
return points;
|
||||||
|
|
||||||
var ev = new ResearchServerGetPointsPerSecondEvent(component.Owner, points);
|
var ev = new ResearchServerGetPointsPerSecondEvent(uid, points);
|
||||||
foreach (var client in component.Clients)
|
foreach (var client in component.Clients)
|
||||||
{
|
{
|
||||||
RaiseLocalEvent(client, ref ev);
|
RaiseLocalEvent(client, ref ev);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Shared.Research.Components;
|
using Content.Shared.Research.Components;
|
||||||
using Content.Shared.Research.Systems;
|
using Content.Shared.Research.Systems;
|
||||||
@@ -28,16 +29,22 @@ namespace Content.Server.Research.Systems
|
|||||||
/// Gets a server based on it's unique numeric id.
|
/// Gets a server based on it's unique numeric id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
|
/// <param name="serverUid"></param>
|
||||||
|
/// <param name="serverComponent"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public ResearchServerComponent? GetServerById(int id)
|
public bool TryGetServerById(int id, [NotNullWhen(true)] out EntityUid? serverUid, [NotNullWhen(true)] out ResearchServerComponent? serverComponent)
|
||||||
{
|
{
|
||||||
|
serverUid = null;
|
||||||
|
serverComponent = null;
|
||||||
foreach (var server in EntityQuery<ResearchServerComponent>())
|
foreach (var server in EntityQuery<ResearchServerComponent>())
|
||||||
{
|
{
|
||||||
if (server.Id == id)
|
if (server.Id != id)
|
||||||
return server;
|
continue;
|
||||||
|
serverUid = server.Owner;
|
||||||
|
serverComponent = server;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user