clean up infinite researchsystem shitcode (#13136)

* clean up infinite researchsystem shitcode

* fml some more shit

* make syncing work logically

* naming naming naming
This commit is contained in:
Nemanja
2022-12-25 16:22:23 -05:00
committed by GitHub
parent 9afbdf6a17
commit 4eee1ee9b2
23 changed files with 497 additions and 293 deletions

View File

@@ -5,8 +5,6 @@ using Content.Server.Lathe.Components;
using Content.Server.Materials;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Server.Research.Components;
using Content.Server.Research.Systems;
using Content.Server.UserInterface;
using Content.Shared.Lathe;
using Content.Shared.Materials;
@@ -14,7 +12,6 @@ using Content.Shared.Research.Components;
using Content.Shared.Research.Prototypes;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Server.Player;
using Robust.Shared.Prototypes;
using Robust.Shared.Timing;
@@ -28,7 +25,6 @@ namespace Content.Server.Lathe
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly UserInterfaceSystem _uiSys = default!;
[Dependency] private readonly ResearchSystem _researchSys = default!;
[Dependency] private readonly MaterialStorageSystem _materialStorage = default!;
public override void Initialize()
@@ -40,6 +36,7 @@ namespace Content.Server.Lathe
SubscribeLocalEvent<LatheComponent, PowerChangedEvent>(OnPowerChanged);
SubscribeLocalEvent<LatheComponent, RefreshPartsEvent>(OnPartsRefresh);
SubscribeLocalEvent<LatheComponent, UpgradeExamineEvent>(OnUpgradeExamine);
SubscribeLocalEvent<LatheComponent, TechnologyDatabaseModifiedEvent>(OnDatabaseModified);
SubscribeLocalEvent<LatheComponent, LatheQueueRecipeMessage>(OnLatheQueueRecipeMessage);
SubscribeLocalEvent<LatheComponent, LatheSyncRequestMessage>(OnLatheSyncRequestMessage);
@@ -48,8 +45,6 @@ namespace Content.Server.Lathe
SubscribeLocalEvent<LatheComponent, MaterialAmountChangedEvent>((u,c,_) => UpdateUserInterfaceState(u,c));
SubscribeLocalEvent<TechnologyDatabaseComponent, LatheGetRecipesEvent>(OnGetRecipes);
SubscribeLocalEvent<ResearchClientComponent, LatheServerSelectionMessage>(OnLatheServerSelectionMessage);
SubscribeLocalEvent<TechnologyDatabaseComponent, LatheServerSyncMessage>(OnLatheServerSyncMessage);
}
public override void Update(float frameTime)
@@ -276,6 +271,11 @@ namespace Content.Server.Lathe
args.AddPercentageUpgrade("lathe-component-upgrade-material-use", component.MaterialUseMultiplier);
}
private void OnDatabaseModified(EntityUid uid, LatheComponent component, ref TechnologyDatabaseModifiedEvent args)
{
UpdateUserInterfaceState(uid, component);
}
protected override bool HasRecipe(EntityUid uid, LatheRecipePrototype recipe, LatheComponent component)
{
return GetAvailableRecipes(component).Contains(recipe.ID);
@@ -300,18 +300,6 @@ namespace Content.Server.Lathe
{
UpdateUserInterfaceState(uid, component);
}
private void OnLatheServerSelectionMessage(EntityUid uid, ResearchClientComponent component, LatheServerSelectionMessage args)
{
_uiSys.TryOpen(uid, ResearchClientUiKey.Key, (IPlayerSession) args.Session);
}
private void OnLatheServerSyncMessage(EntityUid uid, TechnologyDatabaseComponent component, LatheServerSyncMessage args)
{
_researchSys.SyncWithServer(component);
UpdateUserInterfaceState(uid);
}
#endregion
}
}