Add logs for research (#18388)
* Add logs for research * Update Content.Server/Research/Systems/ResearchSystem.Technology.cs Co-authored-by: Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com> * dumb but ok * wacka wacka * Update LogType.cs --------- Co-authored-by: Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com>
This commit is contained in:
@@ -31,7 +31,7 @@ public sealed partial class ResearchSystem
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!UnlockTechnology(uid, args.Id))
|
if (!UnlockTechnology(uid, args.Id, ent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SyncClientWithServer(uid);
|
SyncClientWithServer(uid);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Shared.Database;
|
||||||
using Content.Shared.Research.Components;
|
using Content.Shared.Research.Components;
|
||||||
using Content.Shared.Research.Prototypes;
|
using Content.Shared.Research.Prototypes;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
@@ -47,13 +48,16 @@ public sealed partial class ResearchSystem
|
|||||||
/// Tries to add a technology to a database, checking if it is able to
|
/// Tries to add a technology to a database, checking if it is able to
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>If the technology was successfully added</returns>
|
/// <returns>If the technology was successfully added</returns>
|
||||||
public bool UnlockTechnology(EntityUid client, string prototypeid, ResearchClientComponent? component = null,
|
public bool UnlockTechnology(EntityUid client,
|
||||||
|
string prototypeid,
|
||||||
|
EntityUid user,
|
||||||
|
ResearchClientComponent? component = null,
|
||||||
TechnologyDatabaseComponent? clientDatabase = null)
|
TechnologyDatabaseComponent? clientDatabase = null)
|
||||||
{
|
{
|
||||||
if (!PrototypeManager.TryIndex<TechnologyPrototype>(prototypeid, out var prototype))
|
if (!PrototypeManager.TryIndex<TechnologyPrototype>(prototypeid, out var prototype))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return UnlockTechnology(client, prototype, component, clientDatabase);
|
return UnlockTechnology(client, prototype, user, component, clientDatabase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -62,6 +66,7 @@ public sealed partial class ResearchSystem
|
|||||||
/// <returns>If the technology was successfully added</returns>
|
/// <returns>If the technology was successfully added</returns>
|
||||||
public bool UnlockTechnology(EntityUid client,
|
public bool UnlockTechnology(EntityUid client,
|
||||||
TechnologyPrototype prototype,
|
TechnologyPrototype prototype,
|
||||||
|
EntityUid user,
|
||||||
ResearchClientComponent? component = null,
|
ResearchClientComponent? component = null,
|
||||||
TechnologyDatabaseComponent? clientDatabase = null)
|
TechnologyDatabaseComponent? clientDatabase = null)
|
||||||
{
|
{
|
||||||
@@ -78,6 +83,9 @@ public sealed partial class ResearchSystem
|
|||||||
TrySetMainDiscipline(prototype, serverEnt.Value);
|
TrySetMainDiscipline(prototype, serverEnt.Value);
|
||||||
ModifyServerPoints(serverEnt.Value, -prototype.Cost);
|
ModifyServerPoints(serverEnt.Value, -prototype.Cost);
|
||||||
UpdateTechnologyCards(serverEnt.Value);
|
UpdateTechnologyCards(serverEnt.Value);
|
||||||
|
|
||||||
|
_adminLog.Add(LogType.Action, LogImpact.Medium,
|
||||||
|
$"{ToPrettyString(user):player} unlocked {prototype.ID} (discipline: {prototype.Discipline}, tier: {prototype.Tier}) at {ToPrettyString(client)}, for server {ToPrettyString(serverEnt.Value)}.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Content.Server.Administration.Logs;
|
||||||
using Content.Shared.Access.Systems;
|
using Content.Shared.Access.Systems;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Research.Components;
|
using Content.Shared.Research.Components;
|
||||||
@@ -13,6 +14,7 @@ namespace Content.Server.Research.Systems
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed partial class ResearchSystem : SharedResearchSystem
|
public sealed partial class ResearchSystem : SharedResearchSystem
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IAdminLogManager _adminLog = default!;
|
||||||
[Dependency] private readonly IGameTiming _timing = default!;
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
|
[Dependency] private readonly AccessReaderSystem _accessReader = default!;
|
||||||
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
[Dependency] private readonly UserInterfaceSystem _uiSystem = default!;
|
||||||
|
|||||||
Reference in New Issue
Block a user