Recipe fix
This commit is contained in:
@@ -29,6 +29,14 @@ public class CraftingHandler
|
||||
}
|
||||
|
||||
public async Task InitializeAsync()
|
||||
{
|
||||
await RefreshRecipeCacheAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Refresh the recipe cache from database. Call this after recipes are modified in admin.
|
||||
/// </summary>
|
||||
public async Task RefreshRecipeCacheAsync()
|
||||
{
|
||||
using var scope = _scopeFactory.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<GameDbContext>();
|
||||
@@ -40,6 +48,9 @@ public class CraftingHandler
|
||||
|
||||
_recipes = recipes.ToDictionary(r => r.Id);
|
||||
|
||||
// Clear old hash lookup and rebuild
|
||||
_ingredientHashToRecipeId.Clear();
|
||||
|
||||
// Build ingredient hash lookup for recipe discovery
|
||||
foreach (var recipe in recipes)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user