diff --git a/Content.Server/Lathe/LatheSystem.cs b/Content.Server/Lathe/LatheSystem.cs index dd5910cb0d..85a25179f1 100644 --- a/Content.Server/Lathe/LatheSystem.cs +++ b/Content.Server/Lathe/LatheSystem.cs @@ -29,6 +29,8 @@ using Robust.Server.GameObjects; using Robust.Shared.Audio.Systems; using Robust.Shared.Prototypes; using Robust.Shared.Timing; +using Content.Server.Chat.Systems; +using Content.Shared.Chat; namespace Content.Server.Lathe { @@ -50,6 +52,7 @@ namespace Content.Server.Lathe [Dependency] private readonly SharedSolutionContainerSystem _solution = default!; [Dependency] private readonly StackSystem _stack = default!; [Dependency] private readonly TransformSystem _transform = default!; + [Dependency] private readonly ChatSystem _chatSystem = default!; // Goobstation - New recipes message /// /// Per-tick cache @@ -354,6 +357,15 @@ namespace Content.Server.Lathe private void OnDatabaseModified(EntityUid uid, LatheComponent component, ref TechnologyDatabaseModifiedEvent args) { UpdateUserInterfaceState(uid, component); + + // Goobstation - Lathe message on recipes update - Start + if (args.UnlockedRecipes == null || args.UnlockedRecipes.Count == 0) + return; + + var recipesCount = args.UnlockedRecipes.Count(recipe => component.DynamicRecipes.Contains(recipe)); + if (recipesCount > 0) + _chatSystem.TrySendInGameICMessage(uid, Loc.GetString("lathe-technology-recipes-update-message", ("count", recipesCount)), InGameICChatType.Speak, hideChat: true); + // Goobstation - Lathe message on recipes update - End } private void OnResearchRegistrationChanged(EntityUid uid, LatheComponent component, ref ResearchRegistrationChangedEvent args) diff --git a/Content.Server/Research/Systems/ResearchSystem.Technology.cs b/Content.Server/Research/Systems/ResearchSystem.Technology.cs index 3ff9dd4dd4..973223da0d 100644 --- a/Content.Server/Research/Systems/ResearchSystem.Technology.cs +++ b/Content.Server/Research/Systems/ResearchSystem.Technology.cs @@ -132,7 +132,7 @@ public sealed partial class ResearchSystem } Dirty(uid, component); - var ev = new TechnologyDatabaseModifiedEvent(); + var ev = new TechnologyDatabaseModifiedEvent(technology.RecipeUnlocks); // Goobstation - Lathe message on recipes update RaiseLocalEvent(uid, ref ev); } diff --git a/Content.Shared/Research/Components/TechnologyDatabaseComponent.cs b/Content.Shared/Research/Components/TechnologyDatabaseComponent.cs index 7126fad0d7..ba0044330d 100644 --- a/Content.Shared/Research/Components/TechnologyDatabaseComponent.cs +++ b/Content.Shared/Research/Components/TechnologyDatabaseComponent.cs @@ -2,6 +2,7 @@ using Content.Shared.Lathe; using Content.Shared.Research.Prototypes; using Content.Shared.Research.Systems; using Robust.Shared.GameStates; +using Robust.Shared.Prototypes; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List; @@ -57,4 +58,12 @@ public sealed partial class TechnologyDatabaseComponent : Component /// server to all of it's clients. /// [ByRefEvent] -public readonly record struct TechnologyDatabaseModifiedEvent; +public readonly record struct TechnologyDatabaseModifiedEvent // Goobstation - Lathe message on recipes update +{ + public readonly List> UnlockedRecipes; + + public TechnologyDatabaseModifiedEvent(List>? unlockedRecipes = null) + { + UnlockedRecipes = unlockedRecipes ?? new(); + } +}; diff --git a/Resources/Locale/en-US/_Goobstation/lathe/lathe-component.ftl b/Resources/Locale/en-US/_Goobstation/lathe/lathe-component.ftl new file mode 100644 index 0000000000..17a4ce1924 --- /dev/null +++ b/Resources/Locale/en-US/_Goobstation/lathe/lathe-component.ftl @@ -0,0 +1 @@ +lathe-technology-recipes-update-message = Lathe database has been updated with {$count} new recipes diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 84aeed1642..116aa67186 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -49,6 +49,8 @@ price: 800 - type: ResearchClient - type: TechnologyDatabase + - type: Speech # Goobstation - Lathe message on recipes update + speechSounds: Lathe # a lathe that can be sped up with space lube / slowed down with glue - type: entity diff --git a/Resources/Prototypes/_Goobstation/Voice/speech_verbs.yml b/Resources/Prototypes/_Goobstation/Voice/speech_verbs.yml new file mode 100644 index 0000000000..52a8d0d40e --- /dev/null +++ b/Resources/Prototypes/_Goobstation/Voice/speech_verbs.yml @@ -0,0 +1,8 @@ +- type: speechSounds + id: Lathe + saySound: + path: /Audio/Machines/beep.ogg + askSound: + path: /Audio/Machines/beep.ogg + exclaimSound: + path: /Audio/Machines/beep.ogg