Fix multiple research consoles exploit (#34334)
This commit is contained in:
@@ -21,6 +21,7 @@ public sealed partial class ResearchSystem
|
|||||||
SubscribeLocalEvent<ResearchConsoleComponent, ResearchServerPointsChangedEvent>(OnPointsChanged);
|
SubscribeLocalEvent<ResearchConsoleComponent, ResearchServerPointsChangedEvent>(OnPointsChanged);
|
||||||
SubscribeLocalEvent<ResearchConsoleComponent, ResearchRegistrationChangedEvent>(OnConsoleRegistrationChanged);
|
SubscribeLocalEvent<ResearchConsoleComponent, ResearchRegistrationChangedEvent>(OnConsoleRegistrationChanged);
|
||||||
SubscribeLocalEvent<ResearchConsoleComponent, TechnologyDatabaseModifiedEvent>(OnConsoleDatabaseModified);
|
SubscribeLocalEvent<ResearchConsoleComponent, TechnologyDatabaseModifiedEvent>(OnConsoleDatabaseModified);
|
||||||
|
SubscribeLocalEvent<ResearchConsoleComponent, TechnologyDatabaseSynchronizedEvent>(OnConsoleDatabaseSynchronized);
|
||||||
SubscribeLocalEvent<ResearchConsoleComponent, GotEmaggedEvent>(OnEmagged);
|
SubscribeLocalEvent<ResearchConsoleComponent, GotEmaggedEvent>(OnEmagged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,6 +101,12 @@ public sealed partial class ResearchSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void OnConsoleDatabaseModified(EntityUid uid, ResearchConsoleComponent component, ref TechnologyDatabaseModifiedEvent args)
|
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);
|
UpdateConsoleInterface(uid, component);
|
||||||
}
|
}
|
||||||
@@ -114,5 +121,4 @@ public sealed partial class ResearchSystem
|
|||||||
|
|
||||||
args.Handled = true;
|
args.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public sealed partial class ResearchSystem
|
|||||||
|
|
||||||
Dirty(primaryUid, primaryDb);
|
Dirty(primaryUid, primaryDb);
|
||||||
|
|
||||||
var ev = new TechnologyDatabaseModifiedEvent();
|
var ev = new TechnologyDatabaseSynchronizedEvent();
|
||||||
RaiseLocalEvent(primaryUid, ref ev);
|
RaiseLocalEvent(primaryUid, ref ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,3 +55,10 @@ public sealed partial class TechnologyDatabaseComponent : Component
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
[ByRefEvent]
|
[ByRefEvent]
|
||||||
public readonly record struct TechnologyDatabaseModifiedEvent;
|
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;
|
||||||
|
|||||||
@@ -227,6 +227,9 @@ public abstract class SharedResearchSystem : EntitySystem
|
|||||||
return;
|
return;
|
||||||
component.MainDiscipline = prototype.Discipline;
|
component.MainDiscipline = prototype.Discipline;
|
||||||
Dirty(uid, component);
|
Dirty(uid, component);
|
||||||
|
|
||||||
|
var ev = new TechnologyDatabaseModifiedEvent();
|
||||||
|
RaiseLocalEvent(uid, ref ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user