Fix multiple research consoles exploit (#34334)

This commit is contained in:
themias
2025-02-10 21:52:26 -05:00
committed by GitHub
parent a8715dc6a7
commit d351f32230
4 changed files with 18 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ public sealed partial class ResearchSystem
SubscribeLocalEvent<ResearchConsoleComponent, ResearchServerPointsChangedEvent>(OnPointsChanged);
SubscribeLocalEvent<ResearchConsoleComponent, ResearchRegistrationChangedEvent>(OnConsoleRegistrationChanged);
SubscribeLocalEvent<ResearchConsoleComponent, TechnologyDatabaseModifiedEvent>(OnConsoleDatabaseModified);
SubscribeLocalEvent<ResearchConsoleComponent, TechnologyDatabaseSynchronizedEvent>(OnConsoleDatabaseSynchronized);
SubscribeLocalEvent<ResearchConsoleComponent, GotEmaggedEvent>(OnEmagged);
}
@@ -100,6 +101,12 @@ public sealed partial class ResearchSystem
}
private void OnConsoleDatabaseModified(EntityUid uid, ResearchConsoleComponent component, ref TechnologyDatabaseModifiedEvent args)
{
SyncClientWithServer(uid);
UpdateConsoleInterface(uid, component);
}
private void OnConsoleDatabaseSynchronized(EntityUid uid, ResearchConsoleComponent component, ref TechnologyDatabaseSynchronizedEvent args)
{
UpdateConsoleInterface(uid, component);
}
@@ -114,5 +121,4 @@ public sealed partial class ResearchSystem
args.Handled = true;
}
}

View File

@@ -23,7 +23,7 @@ public sealed partial class ResearchSystem
Dirty(primaryUid, primaryDb);
var ev = new TechnologyDatabaseModifiedEvent();
var ev = new TechnologyDatabaseSynchronizedEvent();
RaiseLocalEvent(primaryUid, ref ev);
}

View File

@@ -55,3 +55,10 @@ public sealed partial class TechnologyDatabaseComponent : Component
/// </remarks>
[ByRefEvent]
public readonly record struct TechnologyDatabaseModifiedEvent;
/// <summary>
/// Event raised on a database after being synchronized
/// with the values from another database.
/// </summary>
[ByRefEvent]
public readonly record struct TechnologyDatabaseSynchronizedEvent;

View File

@@ -227,6 +227,9 @@ public abstract class SharedResearchSystem : EntitySystem
return;
component.MainDiscipline = prototype.Discipline;
Dirty(uid, component);
var ev = new TechnologyDatabaseModifiedEvent();
RaiseLocalEvent(uid, ref ev);
}
/// <summary>