2 new Lobby image, some bugfix (#468)

* +2 lobby screens

* Update goblin.yml

* workbench recipes remove nesting

* tips update

* Update sewing_table.yml
This commit is contained in:
Ed
2024-09-28 01:29:02 +03:00
committed by GitHub
parent 560c7acc52
commit dca61c009d
24 changed files with 121 additions and 251 deletions

View File

@@ -4,6 +4,7 @@
*/
using Content.Shared._CP14.Workbench.Prototypes;
using Content.Shared.Tag;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
@@ -22,12 +23,21 @@ public sealed partial class CP14WorkbenchComponent : Component
[DataField]
public float CraftSpeed = 1f;
[DataField]
public float WorkbenchRadius = 0.5f;
/// <summary>
/// List of recipes available for crafting on this type of workbench
/// </summary>
[DataField]
public List<ProtoId<CP14WorkbenchRecipePrototype>> Recipes = new();
/// <summary>
/// Auto recipe list fill based on tags
/// </summary>
[DataField]
public List<ProtoId<TagPrototype>> RecipeTags = new();
/// <summary>
/// Played during crafting. Can be overwritten by the crafting sound of a specific recipe.
/// </summary>

View File

@@ -22,7 +22,7 @@ public sealed partial class CP14WorkbenchSystem
private void UpdateUIRecipes(Entity<CP14WorkbenchComponent> entity)
{
var placedEntities = _lookup.GetEntitiesInRange(Transform(entity).Coordinates, WorkbenchRadius);
var placedEntities = _lookup.GetEntitiesInRange(Transform(entity).Coordinates, entity.Comp.WorkbenchRadius);
var recipes = new List<CP14WorkbenchUiRecipesEntry>();
foreach (var recipeId in entity.Comp.Recipes)

View File

@@ -3,12 +3,12 @@
* https://github.com/space-wizards/space-station-14/blob/master/LICENSE.TXT
*/
using Content.Server.Chemistry.Containers.EntitySystems;
using Content.Server.DoAfter;
using Content.Server.Popups;
using Content.Server.Stack;
using Content.Shared._CP14.Workbench;
using Content.Shared._CP14.Workbench.Prototypes;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.DoAfter;
using Content.Shared.Stacks;
using Content.Shared.UserInterface;
@@ -27,16 +27,13 @@ public sealed partial class CP14WorkbenchSystem : SharedCP14WorkbenchSystem
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly PopupSystem _popup = default!;
[Dependency] private readonly UserInterfaceSystem _userInterface = default!;
[Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
[Dependency] private readonly SharedTransformSystem _transform = default!;
private EntityQuery<MetaDataComponent> _metaQuery;
private EntityQuery<StackComponent> _stackQuery;
// Why not in component? Why?
private const float WorkbenchRadius = 0.5f;
public override void Initialize()
{
base.Initialize();
@@ -44,12 +41,28 @@ public sealed partial class CP14WorkbenchSystem : SharedCP14WorkbenchSystem
_metaQuery = GetEntityQuery<MetaDataComponent>();
_stackQuery = GetEntityQuery<StackComponent>();
SubscribeLocalEvent<CP14WorkbenchComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<CP14WorkbenchComponent, BeforeActivatableUIOpenEvent>(OnBeforeUIOpen);
SubscribeLocalEvent<CP14WorkbenchComponent, CP14WorkbenchUiCraftMessage>(OnCraft);
SubscribeLocalEvent<CP14WorkbenchComponent, CP14CraftDoAfterEvent>(OnCraftFinished);
}
private void OnMapInit(Entity<CP14WorkbenchComponent> ent, ref MapInitEvent args)
{
foreach (var recipe in _proto.EnumeratePrototypes<CP14WorkbenchRecipePrototype>())
{
if (ent.Comp.Recipes.Contains(recipe))
continue;
if (!ent.Comp.RecipeTags.Contains(recipe.Tag))
continue;
ent.Comp.Recipes.Add(recipe);
}
}
private void OnBeforeUIOpen(Entity<CP14WorkbenchComponent> ent, ref BeforeActivatableUIOpenEvent args)
{
UpdateUIRecipes(ent);
@@ -64,7 +77,7 @@ public sealed partial class CP14WorkbenchSystem : SharedCP14WorkbenchSystem
if (!_proto.TryIndex(args.Recipe, out var recipe))
return;
var placedEntities = _lookup.GetEntitiesInRange(Transform(ent).Coordinates, WorkbenchRadius, LookupFlags.Uncontained);
var placedEntities = _lookup.GetEntitiesInRange(Transform(ent).Coordinates, ent.Comp.WorkbenchRadius, LookupFlags.Uncontained);
if (!CanCraftRecipe(recipe, placedEntities))
{