Workbench and crystals (#1502)
* solutionResource * fuck research system + QoL workbench update * colorful quartz returns * Refactor workbench skill requirements handling Replaces the SkillRequired requirement with a direct RequiredSkills field on CP14WorkbenchRecipePrototype. Updates client and server logic to check skills directly, simplifying recipe skill checks and related UI logic. * Initial commit Add initial project files and setup.
This commit is contained in:
@@ -3,12 +3,16 @@
|
||||
* https://github.com/space-wizards/space-station-14/blob/master/LICENSE.TXT
|
||||
*/
|
||||
|
||||
using Content.Shared._CP14.Skill;
|
||||
using Content.Shared._CP14.Workbench;
|
||||
using Content.Shared.Placeable;
|
||||
|
||||
namespace Content.Server._CP14.Workbench;
|
||||
|
||||
public sealed partial class CP14WorkbenchSystem
|
||||
{
|
||||
[Dependency] private readonly CP14SharedSkillSystem _skill = default!;
|
||||
|
||||
private void OnCraft(Entity<CP14WorkbenchComponent> entity, ref CP14WorkbenchUiCraftMessage args)
|
||||
{
|
||||
if (!entity.Comp.Recipes.Contains(args.Recipe))
|
||||
@@ -20,9 +24,12 @@ public sealed partial class CP14WorkbenchSystem
|
||||
StartCraft(entity, args.Actor, prototype);
|
||||
}
|
||||
|
||||
private void UpdateUIRecipes(Entity<CP14WorkbenchComponent> entity, EntityUid user)
|
||||
private void UpdateUIRecipes(Entity<CP14WorkbenchComponent> entity)
|
||||
{
|
||||
var placedEntities = _lookup.GetEntitiesInRange(Transform(entity).Coordinates, entity.Comp.WorkbenchRadius);
|
||||
if (!TryComp<ItemPlacerComponent>(entity.Owner, out var placer))
|
||||
return;
|
||||
|
||||
var placedEntities = placer.PlacedEntities;
|
||||
|
||||
var recipes = new List<CP14WorkbenchUiRecipesEntry>();
|
||||
foreach (var recipeId in entity.Comp.Recipes)
|
||||
@@ -31,21 +38,16 @@ public sealed partial class CP14WorkbenchSystem
|
||||
continue;
|
||||
|
||||
var canCraft = true;
|
||||
var hidden = false;
|
||||
|
||||
foreach (var requirement in indexedRecipe.Requirements)
|
||||
{
|
||||
if (!requirement.CheckRequirement(EntityManager, _proto, placedEntities, user))
|
||||
if (!requirement.CheckRequirement(EntityManager, _proto, placedEntities))
|
||||
{
|
||||
canCraft = false;
|
||||
if (requirement.HideRecipe)
|
||||
hidden = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hidden)
|
||||
continue;
|
||||
|
||||
var entry = new CP14WorkbenchUiRecipesEntry(recipeId, canCraft);
|
||||
|
||||
recipes.Add(entry);
|
||||
|
||||
Reference in New Issue
Block a user