forked from SerbiaStrong-220/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autoinjectors220 (SerbiaStrong-220#881)
* хуйхухйхуйхухйхуй * 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 66da1a8. * Revert "cultcultmybeloved" This reverts commit ba303e7. * some :gagaga: * (hope)done * well well well * quickfix --------- Co-authored-by: Malutka Gnomeev <[email protected]>
- Loading branch information
Showing
10 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
Content.Server/SS220/Autoinjector/AutoinjectorComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<AutoinjectorComponent, AfterHypoEvent>(OnAfterHypo); | ||
SubscribeLocalEvent<AutoinjectorComponent, ExaminedEvent>(OnExamined); | ||
} | ||
|
||
private void OnExamined(Entity<AutoinjectorComponent> entity, ref ExaminedEvent ev) | ||
{ | ||
if (entity.Comp.Used) | ||
ev.PushMarkup(Loc.GetString(entity.Comp.OnExaminedMessage)); | ||
} | ||
|
||
private void OnAfterHypo(Entity<AutoinjectorComponent> entity, ref AfterHypoEvent ev) | ||
{ | ||
if (!TryComp<HyposprayComponent>(entity, out var hypoComp) | ||
|| !_solutionContainerSystem.TryGetSolution(entity.Owner, hypoComp.SolutionName, out _, out _)) | ||
return; | ||
|
||
RemComp<RefillableSolutionComponent>(entity); | ||
entity.Comp.Used = true; | ||
|
||
var message = Loc.GetString(entity.Comp.OnUseMessage); | ||
_popup.PopupEntity(message, ev.Target, ev.User); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
loc-autoinjector-after-use = Вы использовали одноразовый автоинъектор | ||
loc-autoinjector-examined-message = [color=#C41E3A] Инъектор уже был использован. [/color] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Binary file added
BIN
+2.28 KB
Resources/Textures/SS220/Objects/Misc/autoinjectors.rsi/autoinjector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions
15
Resources/Textures/SS220/Objects/Misc/autoinjectors.rsi/meta.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
] | ||
|
||
} |