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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user