Files
crystall-punk-14/Content.Server/_CP14/Workbench/CP14WorkbenchSystem.UI.cs
Ed be495f274c Skill progression system (#1263)
* delete skill trees

* Revert "delete skill trees"

This reverts commit 9d7fae73c4.

* learning refactor

* UI tweaks

* sword mastery skill

* telegraphy

* rapier mastery

* research table ui

* finish studing

* polish UI researching

* pyrokinetic

* more skill tree working

* heat adapt

* alchemist and metamagic update

* skill multiple effects support + metamagic bugg manapool

* impossible 😢

* skimitar gaming

* skimidi

* blacksmithing branch

* remove research restrictions

* remove species magic buff

* fix loc

* Update thaumaturgy.yml

* pip

* Delete skill_tree.yml
2025-05-14 12:43:43 +03:00

57 lines
1.7 KiB
C#

/*
* This file is sublicensed under MIT License
* https://github.com/space-wizards/space-station-14/blob/master/LICENSE.TXT
*/
using Content.Shared._CP14.Workbench;
namespace Content.Server._CP14.Workbench;
public sealed partial class CP14WorkbenchSystem
{
private void OnCraft(Entity<CP14WorkbenchComponent> entity, ref CP14WorkbenchUiCraftMessage args)
{
if (!entity.Comp.Recipes.Contains(args.Recipe))
return;
if (!_proto.TryIndex(args.Recipe, out var prototype))
return;
StartCraft(entity, args.Actor, prototype);
}
private void UpdateUIRecipes(Entity<CP14WorkbenchComponent> entity, EntityUid user)
{
var placedEntities = _lookup.GetEntitiesInRange(Transform(entity).Coordinates, entity.Comp.WorkbenchRadius);
var recipes = new List<CP14WorkbenchUiRecipesEntry>();
foreach (var recipeId in entity.Comp.Recipes)
{
if (!_proto.TryIndex(recipeId, out var indexedRecipe))
continue;
var canCraft = true;
var hidden = false;
foreach (var requirement in indexedRecipe.Requirements)
{
if (!requirement.CheckRequirement(EntityManager, _proto, placedEntities, user))
{
canCraft = false;
if (requirement.HideRecipe)
hidden = true;
}
}
if (hidden)
continue;
var entry = new CP14WorkbenchUiRecipesEntry(recipeId, canCraft);
recipes.Add(entry);
}
_userInterface.SetUiState(entity.Owner, CP14WorkbenchUiKey.Key, new CP14WorkbenchUiRecipesState(recipes));
}
}