From c553b5af3a49ba169a931d59059e0c7148866e33 Mon Sep 17 00:00:00 2001 From: Gnomeev <137652177+Gnomeev@users.noreply.github.com> Date: Wed, 15 May 2024 21:36:52 +0300 Subject: [PATCH] Autoinjectors220 (#881) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * хуйхухйхуйхухйхуй * le mew * oopsfix * lefix * lefix * cultcultmybeloved * NUKETIMEEEEE * Merge branch 'Codemew' of https://github.com/Gnomeev/space-station-14 into Codemew * Revert "NUKETIMEEEEE" This reverts commit 66da1a8b352f87eb52f38d5159c884c8e2ab48a6. * Revert "cultcultmybeloved" This reverts commit ba303e71510c9a533b169dc32d7146c7a150ac0b. * some :gagaga: * (hope)done * well well well * quickfix --------- Co-authored-by: Malutka Gnomeev --- .../EntitySystems/HypospraySystem.cs | 5 ++ .../Autoinjector/AutoinjectorComponent.cs | 13 +++++ .../SS220/Autoinjector/AutoinjectorSystem.cs | 40 +++++++++++++++ .../Chemistry/SharedAfterHypoEvent.cs | 17 +++++++ .../ru-RU/ss220/autoinjector/autoinjector.ftl | 2 + .../Entities/Structures/Machines/lathe.yml | 1 + .../Prototypes/Recipes/Lathes/medical.yml | 9 ++++ .../SS220/Chemistry/autoinjectors.yml | 46 ++++++++++++++++++ .../Misc/autoinjectors.rsi/autoinjector.png | Bin 0 -> 2332 bytes .../Objects/Misc/autoinjectors.rsi/meta.json | 15 ++++++ 10 files changed, 148 insertions(+) create mode 100644 Content.Server/SS220/Autoinjector/AutoinjectorComponent.cs create mode 100644 Content.Server/SS220/Autoinjector/AutoinjectorSystem.cs create mode 100644 Content.Shared/Chemistry/SharedAfterHypoEvent.cs create mode 100644 Resources/Locale/ru-RU/ss220/autoinjector/autoinjector.ftl create mode 100644 Resources/Prototypes/SS220/Chemistry/autoinjectors.yml create mode 100644 Resources/Textures/SS220/Objects/Misc/autoinjectors.rsi/autoinjector.png create mode 100644 Resources/Textures/SS220/Objects/Misc/autoinjectors.rsi/meta.json 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 0000000000000000000000000000000000000000..c28653e2be8b9f086b048d01d7db1e4835e7cd16 GIT binary patch literal 2332 zcmb_ed2AF_9G=QmP(+0w0^&HR0cGxEX9kuYyM->Wb+fFYpoG4idD9)cyR*zp>9#~r zBM_oNOaTdEI1JUI!Fb`(7!&`X8t?$D9F0)Ie;PtUAVdN2&0e&o95HS(J8$NF@B4kf z>%CbYshc}`)WlI3hK&x@2BYYXdsq2z^zXE_T|~E$ncBq;hTT2ZyUMU_+b3Yyh`1T6 zck9CoRLx3JK)2$M%BC_1jbXDYvKgQ?K^Kq1Ml7{)t*uE@bfRK5J}avtf)sQCo=qjwj+*roIbIcwz1K8>=OAvApQ!Q-;`QMO9UMP?Q-s$FMTZ$TZ87tfUHz%5iw%M<8pqZm7}VoPsU%x;VH{*q*+B#XojOXjzkF3X-&HzOQxNvMTQ`BG~3L$rj^D$Mi94}T|a@8=3Pi- zO0;RG5GE8bItwy1OEI2HIbbGXxt5c#ZUQe&4_KsYCGt$Ooy;lLH5w*i3Z`8LVcC)a z6xwjO1RqpODpf)|Zp{khMj;@BqMcZ42GUXJSk1NuYgQnOQ$24oYQToTwd|N>C5wrQ z6y3u)o)YnCi_ElcwK&uJEr3DbLO;PVoIo-n$@pR{t8$9U3QsY-$}o9o7}bFeTrd#K z@-dE8d0yq20bolvjn>;jOTkqGR?@P=mX37r1b*XvC=iI)mSHB*gcF@xjfZLi601lO z$x$qU>zZmPBSuXYcumq2lG6>DmneL3!EZ}h6H`WEZXZR zM1ki=d0P6`_H%Wv)|#H4)`E(KaCu1&o-1t?XkN?u3C*ijs1t?P<{;U+qqr2-wO1#C;O4 zfuidJrRO^e?VG$(?5I1E9te2*uF}85^Xs$(NH;=s1kl8P_vg+UCvR{te+KLj|EoW_ zQq9*H{qGXY&GkDdiuH_6A8%MX_RvG=;Dl)uDjOY(mwIQ;!LYK1P_QaizvkR#w&~l- zaowwrjbF-bs(!p7v)6St#`i2FCzOBj=dj7!=U)jeIr-VM$G#d_z2?Z_L)3m_{_e=Q zLtCaF+m&tj^p{TRa!2>|ue+|FpVIyI#^}cfkN0+V4gVRNSUDtt_4R$Yw(i|`E*PJD z8U5q(m4h+t0eR^7OKmSSVQ>8X+AH_fPB%aAo##xRdtmtj>dmtqm-k*=*?sEdcl*zY z^l|2;So;S(&kwDte81nUA$-V+DEaUYF_Oc^Lp>mv3trkwQptaS--n{!~P+)>n7a0 zZrrG057pd{?Knz5<38wYUWVC literal 0 HcmV?d00001 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" + } +] + +}