* fuck all * clean up * remove knowledge books * Update base.yml * cl * fix #991 * fix * Update subgamemodes.yml * manual migration + recipes fix * Update comoss.yml * setup data * setup skills systems * more blacksmithing skills * Update base.yml * Create CP14SkillEffectAction.cs * skill button returns * base graph UI window * skill tree drawing * UI improve * pyro setup * skill trees selection, dragging control * refactor skill system: rename Skills to LearnedSkills, add experience tracking and learning logic * Create available.png * skill description generation setup * auto parsing skill names and descriptions * Hydrosophistry * water light fire and metamagic ported to skill tre * ice dagger spell returns * Update ice_dagger.yml * delete old files * Update modular_garde.yml * ice arrow spell * link graph with parallax * show experience counter * polish * puf * p * pipap * finally ready to merg? * fix * fix 2
56 lines
1.7 KiB
C#
56 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, indexedRecipe))
|
|
{
|
|
canCraft = false;
|
|
hidden = requirement.HideRecipe;
|
|
}
|
|
}
|
|
|
|
if (hidden)
|
|
continue;
|
|
|
|
var entry = new CP14WorkbenchUiRecipesEntry(recipeId, canCraft);
|
|
|
|
recipes.Add(entry);
|
|
}
|
|
|
|
_userInterface.SetUiState(entity.Owner, CP14WorkbenchUiKey.Key, new CP14WorkbenchUiRecipesState(recipes));
|
|
}
|
|
}
|