Refactor workbench resource handling with provider component (#1522)

* Refactor workbench resource handling with provider component

Introduces CP14WorkbenchPlaceableProviderComponent and related event to abstract resource provision for workbenches. Updates system logic to use the new provider event instead of directly accessing ItemPlacerComponent, improving modularity and extensibility. Adjusts entity prototype to include the new provider component.

* map resave

* resave Frigid
This commit is contained in:
Red
2025-07-11 15:55:41 +03:00
committed by GitHub
parent 932fd47861
commit 37ece7228f
10 changed files with 4716 additions and 7251 deletions

View File

@@ -26,10 +26,10 @@ public sealed partial class CP14WorkbenchSystem
private void UpdateUIRecipes(Entity<CP14WorkbenchComponent> entity)
{
if (!TryComp<ItemPlacerComponent>(entity.Owner, out var placer))
return;
var getResource = new CP14WorkbenchGetResourcesEvent();
RaiseLocalEvent(entity, getResource);
var placedEntities = placer.PlacedEntities;
var resources = getResource.Resources;
var recipes = new List<CP14WorkbenchUiRecipesEntry>();
foreach (var recipeId in entity.Comp.Recipes)
@@ -41,7 +41,7 @@ public sealed partial class CP14WorkbenchSystem
foreach (var requirement in indexedRecipe.Requirements)
{
if (!requirement.CheckRequirement(EntityManager, _proto, placedEntities))
if (!requirement.CheckRequirement(EntityManager, _proto, resources))
{
canCraft = false;
break;