Construction Cache Reload (#44243)

ConstructionReload
This commit is contained in:
Zekins
2026-06-05 18:06:30 +03:00
committed by GitHub
parent 043c1d6b60
commit d7d72c1db8
@@ -45,6 +45,7 @@ namespace Content.Client.Construction
WarmupRecipesCache();
UpdatesOutsidePrediction = true;
SubscribeLocalEvent<PrototypesReloadedEventArgs>(OnPrototypeReload);
SubscribeLocalEvent<LocalPlayerAttachedEvent>(HandlePlayerAttached);
SubscribeNetworkEvent<AckStructureConstructionMessage>(HandleAckStructure);
SubscribeNetworkEvent<ResponseConstructionGuide>(OnConstructionGuideReceived);
@@ -76,8 +77,16 @@ namespace Content.Client.Construction
return false;
}
private void OnPrototypeReload(PrototypesReloadedEventArgs obj)
{
if (obj.WasModified<ConstructionPrototype>())
WarmupRecipesCache();
}
private void WarmupRecipesCache()
{
_recipesMetadataCache.Clear();
foreach (var constructionProto in PrototypeManager.EnumeratePrototypes<ConstructionPrototype>())
{
if (!PrototypeManager.Resolve(constructionProto.Graph, out var graphProto))