Technology Disks (#13077)

* clean up a bunch of R&D code

* don't store components

* brug

* speedrun some sloth review

* technology disks

* expand functionality, begin work on printer

* disk printer ui

* file

* fix the rebase

* disk console is finito

* Update DiskConsoleSystem.cs
This commit is contained in:
Nemanja
2022-12-20 17:39:57 -05:00
committed by GitHub
parent 88ed188b42
commit 050e157005
34 changed files with 659 additions and 151 deletions

View File

@@ -43,12 +43,12 @@ namespace Content.Server.Lathe
SubscribeLocalEvent<LatheComponent, LatheQueueRecipeMessage>(OnLatheQueueRecipeMessage);
SubscribeLocalEvent<LatheComponent, LatheSyncRequestMessage>(OnLatheSyncRequestMessage);
SubscribeLocalEvent<LatheComponent, LatheServerSelectionMessage>(OnLatheServerSelectionMessage);
SubscribeLocalEvent<LatheComponent, BeforeActivatableUIOpenEvent>((u,c,_) => UpdateUserInterfaceState(u,c));
SubscribeLocalEvent<LatheComponent, MaterialAmountChangedEvent>((u,c,_) => UpdateUserInterfaceState(u,c));
SubscribeLocalEvent<TechnologyDatabaseComponent, LatheGetRecipesEvent>(OnGetRecipes);
SubscribeLocalEvent<ResearchClientComponent, LatheServerSelectionMessage>(OnLatheServerSelectionMessage);
SubscribeLocalEvent<TechnologyDatabaseComponent, LatheServerSyncMessage>(OnLatheServerSyncMessage);
}
@@ -202,14 +202,7 @@ namespace Content.Server.Lathe
if (uid != args.Lathe || !TryComp<LatheComponent>(uid, out var latheComponent) || latheComponent.DynamicRecipes == null)
return;
//gets all of the techs that are unlocked and also in the DynamicRecipes list
var allTechs = (from technology in from tech in component.TechnologyIds
select _proto.Index<TechnologyPrototype>(tech)
from recipe in technology.UnlockedRecipes
where latheComponent.DynamicRecipes.Contains(recipe)
select recipe).ToList();
args.Recipes = args.Recipes.Union(allTechs).ToList();
args.Recipes = args.Recipes.Union(component.RecipeIds.Where(r => latheComponent.DynamicRecipes.Contains(r))).ToList();
}
/// <summary>
@@ -308,16 +301,13 @@ namespace Content.Server.Lathe
UpdateUserInterfaceState(uid, component);
}
private void OnLatheServerSelectionMessage(EntityUid uid, LatheComponent component, LatheServerSelectionMessage args)
private void OnLatheServerSelectionMessage(EntityUid uid, ResearchClientComponent component, LatheServerSelectionMessage args)
{
// TODO: one day, when you can open BUIs clientside, do that. Until then, picture Electro seething.
if (component.DynamicRecipes != null)
_uiSys.TryOpen(uid, ResearchClientUiKey.Key, (IPlayerSession) args.Session);
_uiSys.TryOpen(uid, ResearchClientUiKey.Key, (IPlayerSession) args.Session);
}
private void OnLatheServerSyncMessage(EntityUid uid, TechnologyDatabaseComponent component, LatheServerSyncMessage args)
{
Logger.Debug("OnLatheServerSyncMessage");
_researchSys.SyncWithServer(component);
UpdateUserInterfaceState(uid);
}