Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/wizards/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Resources/Textures/Clothing/Uniforms/Jumpskirt/security.rsi/equipped-INNERCLOTHING.png
#	Resources/Textures/Clothing/Uniforms/Jumpsuit/security.rsi/equipped-INNERCLOTHING.png
  • Loading branch information
VigersRay committed Aug 30, 2024
2 parents d329efd + 37b7354 commit 7b0ca8a
Show file tree
Hide file tree
Showing 16 changed files with 474 additions and 296 deletions.
9 changes: 3 additions & 6 deletions Content.IntegrationTests/Tests/MaterialArbitrageTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public async Task NoMaterialArbitrage()
var pricing = entManager.System<PricingSystem>();
var stackSys = entManager.System<StackSystem>();
var mapSystem = server.System<SharedMapSystem>();
var latheSys = server.System<SharedLatheSystem>();
var compFact = server.ResolveDependency<IComponentFactory>();

Assert.That(mapSystem.IsInitialized(testMap.MapId));
Expand All @@ -53,12 +54,8 @@ public async Task NoMaterialArbitrage()
var materialName = compFact.GetComponentName(typeof(MaterialComponent));
var destructibleName = compFact.GetComponentName(typeof(DestructibleComponent));

// construct inverted lathe recipe dictionary
Dictionary<string, List<LatheRecipePrototype>> latheRecipes = new();
foreach (var proto in protoManager.EnumeratePrototypes<LatheRecipePrototype>())
{
latheRecipes.GetOrNew(proto.Result).Add(proto);
}
// get the inverted lathe recipe dictionary
var latheRecipes = latheSys.InverseRecipes;

// Lets assume the possible lathe for resource multipliers:
// TODO: each recipe can technically have its own cost multiplier associated with it, so this test needs redone to factor that in.
Expand Down
14 changes: 7 additions & 7 deletions Content.Shared/Lathe/SharedLatheSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public abstract class SharedLatheSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly SharedMaterialStorageSystem _materialStorage = default!;

private readonly Dictionary<string, List<LatheRecipePrototype>> _inverseRecipeDictionary = new();
public readonly Dictionary<string, List<LatheRecipePrototype>> InverseRecipes = new();

public override void Initialize()
{
Expand Down Expand Up @@ -83,20 +83,20 @@ private void OnPrototypesReloaded(PrototypesReloadedEventArgs obj)

private void BuildInverseRecipeDictionary()
{
_inverseRecipeDictionary.Clear();
InverseRecipes.Clear();
foreach (var latheRecipe in _proto.EnumeratePrototypes<LatheRecipePrototype>())
{
if (latheRecipe.Result == null)
if (latheRecipe.Result is not {} result)
continue;

_inverseRecipeDictionary.GetOrNew(latheRecipe.Result).Add(latheRecipe);
InverseRecipes.GetOrNew(result).Add(latheRecipe);
}
}

public bool TryGetRecipesFromEntity(string prototype, [NotNullWhen(true)] out List<LatheRecipePrototype>? recipes)
{
recipes = new();
if (_inverseRecipeDictionary.TryGetValue(prototype, out var r))
if (InverseRecipes.TryGetValue(prototype, out var r))
recipes.AddRange(r);
return recipes.Count != 0;
}
Expand All @@ -111,7 +111,7 @@ public string GetRecipeName(LatheRecipePrototype proto)
if (!string.IsNullOrWhiteSpace(proto.Name))
return Loc.GetString(proto.Name);

if (proto.Result is { } result)
if (proto.Result is {} result)
{
return _proto.Index(result).Name;
}
Expand All @@ -137,7 +137,7 @@ public string GetRecipeDescription(LatheRecipePrototype proto)
if (!string.IsNullOrWhiteSpace(proto.Description))
return Loc.GetString(proto.Description);

if (proto.Result is { } result)
if (proto.Result is {} result)
{
return _proto.Index(result).Description;
}
Expand Down
12 changes: 11 additions & 1 deletion Content.Shared/Research/Prototypes/LatheRecipePrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,27 @@
using Content.Shared.Materials;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;
using Robust.Shared.Utility;

namespace Content.Shared.Research.Prototypes
{
[NetSerializable, Serializable, Prototype]
public sealed partial class LatheRecipePrototype : IPrototype
public sealed partial class LatheRecipePrototype : IPrototype, IInheritingPrototype
{
[ViewVariables]
[IdDataField]
public string ID { get; private set; } = default!;

/// <inheritdoc/>
[ParentDataField(typeof(AbstractPrototypeIdArraySerializer<LatheRecipePrototype>))]
public string[]? Parents { get; }

/// <inheritdoc />
[NeverPushInheritance]
[AbstractDataField]
public bool Abstract { get; }

/// <summary>
/// Name displayed in the lathe GUI.
/// </summary>
Expand Down
45 changes: 22 additions & 23 deletions Resources/Changelog/Changelog.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,4 @@
Entries:
- author: ShadowCommander
changes:
- message: Added a red light to firelocks when their warning lights are active.
type: Add
- message: Firelocks no longer require power to show warning lights.
type: Tweak
id: 6747
time: '2024-06-15T15:17:16.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/29024
- author: Ian321
changes:
- message: Donk co. microwaves now have their own machine board.
type: Fix
id: 6748
time: '2024-06-15T15:44:56.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/29037
- author: BombasterDS
changes:
- message: Added craftable mannequin that you can hang clothing on!
type: Add
id: 6749
time: '2024-06-15T17:50:55.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/29004
- author: notafet
changes:
- message: The TEG must now be operated at higher temperatures to generate power.
Expand Down Expand Up @@ -3844,3 +3821,25 @@
id: 7246
time: '2024-08-29T03:23:37.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/31616
- author: MisterMecky
changes:
- message: Changed strange pill possible reagents. They are no longer mostly composed
of amatoxin and space mirage.
type: Tweak
id: 7247
time: '2024-08-29T13:21:06.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/30524
- author: slarticodefast
changes:
- message: Fixed energy shield visuals.
type: Fix
id: 7248
time: '2024-08-30T01:43:34.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/31619
- author: DieselMohawk
changes:
- message: Added Armband to back of Security Jumpsuit
type: Fix
id: 7249
time: '2024-08-30T01:46:46.0000000+00:00'
url: https://github.com/space-wizards/space-station-14/pull/31635
Loading

0 comments on commit 7b0ca8a

Please sign in to comment.