diff --git a/Content.Server/Chemistry/EntitySystems/HypospraySystem.cs b/Content.Server/Chemistry/EntitySystems/HypospraySystem.cs index dfbe45c035b7e4..e0f4cf2477d89e 100644 --- a/Content.Server/Chemistry/EntitySystems/HypospraySystem.cs +++ b/Content.Server/Chemistry/EntitySystems/HypospraySystem.cs @@ -18,6 +18,7 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using Robust.Server.Audio; +using Content.Shared.Chemistry; namespace Content.Server.Chemistry.EntitySystems; @@ -144,6 +145,10 @@ public bool TryDoInject(Entity entity, EntityUid target, Ent var ev = new TransferDnaEvent { Donor = target, Recipient = uid }; RaiseLocalEvent(target, ref ev); + //220 autoinjector update begin + var hypoev = new AfterHypoEvent(entity, target, user); + RaiseLocalEvent(entity, ref hypoev); + //220 autoinjector update end // same LogType as syringes... _adminLogger.Add(LogType.ForceFeed, $"{EntityManager.ToPrettyString(user):user} injected {EntityManager.ToPrettyString(target):target} with a solution {SolutionContainerSystem.ToPrettyString(removedSolution):removedSolution} using a {EntityManager.ToPrettyString(uid):using}"); diff --git a/Content.Server/SS220/Autoinjector/AutoinjectorComponent.cs b/Content.Server/SS220/Autoinjector/AutoinjectorComponent.cs new file mode 100644 index 00000000000000..396757ad2b6dcd --- /dev/null +++ b/Content.Server/SS220/Autoinjector/AutoinjectorComponent.cs @@ -0,0 +1,13 @@ +namespace Content.Server.Chemistry.Components +{ + [RegisterComponent] + public sealed partial class AutoinjectorComponent : Component + { + [DataField] + public string OnUseMessage = "loc-autoinjector-after-use"; + [DataField] + public string OnExaminedMessage = "loc-autoinjector-examined-message"; + [DataField, ViewVariables(VVAccess.ReadOnly)] + public bool Used = false; + } +} diff --git a/Content.Server/SS220/Autoinjector/AutoinjectorSystem.cs b/Content.Server/SS220/Autoinjector/AutoinjectorSystem.cs new file mode 100644 index 00000000000000..8f4a4db911d9d5 --- /dev/null +++ b/Content.Server/SS220/Autoinjector/AutoinjectorSystem.cs @@ -0,0 +1,40 @@ +using Content.Server.Chemistry.Components; +using Content.Server.Chemistry.Containers.EntitySystems; +using Content.Shared.Chemistry; +using Content.Shared.Chemistry.Components; +using Content.Server.Popups; +using Content.Shared.Examine; + +namespace Content.Server.SS220.Autoinjector +{ + public sealed partial class AutoinjectorSystem : EntitySystem + { + [Dependency] private readonly SolutionContainerSystem _solutionContainerSystem = default!; + [Dependency] private readonly PopupSystem _popup = default!; + public override void Initialize() + { + SubscribeLocalEvent(OnAfterHypo); + SubscribeLocalEvent(OnExamined); + } + + private void OnExamined(Entity entity, ref ExaminedEvent ev) + { + if (entity.Comp.Used) + ev.PushMarkup(Loc.GetString(entity.Comp.OnExaminedMessage)); + } + + private void OnAfterHypo(Entity entity, ref AfterHypoEvent ev) + { + if (!TryComp(entity, out var hypoComp) + || !_solutionContainerSystem.TryGetSolution(entity.Owner, hypoComp.SolutionName, out _, out _)) + return; + + RemComp(entity); + entity.Comp.Used = true; + + var message = Loc.GetString(entity.Comp.OnUseMessage); + _popup.PopupEntity(message, ev.Target, ev.User); + } + } +} + diff --git a/Content.Shared/Chemistry/SharedAfterHypoEvent.cs b/Content.Shared/Chemistry/SharedAfterHypoEvent.cs new file mode 100644 index 00000000000000..101b1e6be8bd42 --- /dev/null +++ b/Content.Shared/Chemistry/SharedAfterHypoEvent.cs @@ -0,0 +1,17 @@ +namespace Content.Shared.Chemistry +{ + [ByRefEvent] + public readonly struct AfterHypoEvent + { + public readonly EntityUid Hypo; + public readonly EntityUid Target; + public readonly EntityUid User; + + public AfterHypoEvent(EntityUid hypo, EntityUid target, EntityUid user) + { + Hypo = hypo; + Target = target; + User = user; + } + } +} diff --git a/Resources/Locale/ru-RU/ss220/autoinjector/autoinjector.ftl b/Resources/Locale/ru-RU/ss220/autoinjector/autoinjector.ftl new file mode 100644 index 00000000000000..125485a192d2a8 --- /dev/null +++ b/Resources/Locale/ru-RU/ss220/autoinjector/autoinjector.ftl @@ -0,0 +1,2 @@ +loc-autoinjector-after-use = Вы использовали одноразовый автоинъектор +loc-autoinjector-examined-message = [color=#C41E3A] Инъектор уже был использован. [/color] diff --git a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml index 1cdd8147cba92b..6b393da276ac6c 100644 --- a/Resources/Prototypes/Entities/Structures/Machines/lathe.yml +++ b/Resources/Prototypes/Entities/Structures/Machines/lathe.yml @@ -887,6 +887,7 @@ - Saw - Hemostat - ClothingEyesGlassesChemical + - MedAutoinjector #ss220 Autoinjecors update dynamicRecipes: - ChemicalPayload - CryostasisBeaker diff --git a/Resources/Prototypes/Recipes/Lathes/medical.yml b/Resources/Prototypes/Recipes/Lathes/medical.yml index b649b7e9c46fe8..2561c078d9c3ed 100644 --- a/Resources/Prototypes/Recipes/Lathes/medical.yml +++ b/Resources/Prototypes/Recipes/Lathes/medical.yml @@ -226,3 +226,12 @@ Steel: 600 Plastic: 300 +- type: latheRecipe # ss220 autoinjectors update + id: MedAutoinjector + result: MedAutoinjector + completetime: 2 + materials: + Glass: 100 + Plastic: 200 + Steel: 25 + diff --git a/Resources/Prototypes/SS220/Chemistry/autoinjectors.yml b/Resources/Prototypes/SS220/Chemistry/autoinjectors.yml new file mode 100644 index 00000000000000..a7592a8aed53b0 --- /dev/null +++ b/Resources/Prototypes/SS220/Chemistry/autoinjectors.yml @@ -0,0 +1,46 @@ +- type: entity + name: Автоинжектор + parent: BaseItem + description: уээээ + id: BaseAutoinjectorss220 + abstract: true + components: + - type: Sprite + sprite: SS220/Objects/Misc/autoinjectors.rsi + state: autoinjector + - type: Item + sprite: SS220/Objects/Misc/autoinjectors.rsi + size: Tiny + - type: SolutionContainerManager + solutions: + pen: + maxVol: 15 + - type: ExaminableSolution + solution: pen + - type: Hypospray + solutionName: pen + onlyAffectsMobs: false + injectOnly: true + transferAmount: 15 + - type: RefillableSolution + solution: pen + - type: Autoinjector + +- type: entity + name: Медицинский автоинжектор + parent: BaseAutoinjectorss220 + description: Одноразовый медицинский автоинжектор, предназначеный для быстрой доставки веществ в организм. Внимание! После первого использование повторно пополнить инжектор будет невозможно. Использовать с умом. + id: MedAutoinjector + components: + - type: SolutionContainerManager + solutions: + pen: + maxVol: 10 + - type: ExaminableSolution + solution: pen + - type: Hypospray + solutionName: pen + onlyAffectsMobs: false + injectOnly: true + transferAmount: 10 + - type: Autoinjector diff --git a/Resources/Textures/SS220/Objects/Misc/autoinjectors.rsi/autoinjector.png b/Resources/Textures/SS220/Objects/Misc/autoinjectors.rsi/autoinjector.png new file mode 100644 index 00000000000000..c28653e2be8b9f Binary files /dev/null and b/Resources/Textures/SS220/Objects/Misc/autoinjectors.rsi/autoinjector.png differ diff --git a/Resources/Textures/SS220/Objects/Misc/autoinjectors.rsi/meta.json b/Resources/Textures/SS220/Objects/Misc/autoinjectors.rsi/meta.json new file mode 100644 index 00000000000000..2c4752033a1eba --- /dev/null +++ b/Resources/Textures/SS220/Objects/Misc/autoinjectors.rsi/meta.json @@ -0,0 +1,15 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Sprites made by okroshka59 for SS220.", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "autoinjector" + } +] + +}