Skip to content

Commit

Permalink
Blood Bag IV The Voyage Home
Browse files Browse the repository at this point in the history
Adds the first steps for a blood extraction and filtration system.

Again.
  • Loading branch information
dustylens committed Feb 19, 2025
1 parent e2b1089 commit 1a93ef4
Show file tree
Hide file tree
Showing 23 changed files with 201 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Robust.Shared.Prototypes;

namespace Content.Server.Nutrition.EntitySystems;

[RegisterComponent]
public sealed partial class ReplaceEntityOnSolutionEmptyComponent : Component
{
/// <summary>
/// The solution to check for entity replacement.
/// </summary>
[DataField]
public string Solution = "solution";

/// <summary>
/// The entity to replace the existing one.
/// </summary>
[DataField(required: true)]
public EntProtoId ReplacementEntity;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Content.Server.Nutrition.EntitySystems;
using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.EntitySystems;
using Robust.Server.Containers;
using Robust.Server.GameObjects;

namespace Content.Server._NF.Chemistry.Systems;

public sealed class ReplaceEntityOnSolutionEmptySystem : EntitySystem
{
[Dependency] private readonly SharedSolutionContainerSystem _solution = default!;
[Dependency] private readonly TransformSystem _transform = default!;
[Dependency] private readonly ContainerSystem _container = default!;

public override void Initialize()
{
base.Initialize();

SubscribeLocalEvent<ReplaceEntityOnSolutionEmptyComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<ReplaceEntityOnSolutionEmptyComponent, SolutionContainerChangedEvent>(OnSolutionChange);
}

public void OnMapInit(Entity<ReplaceEntityOnSolutionEmptyComponent> entity, ref MapInitEvent args)
{
CheckSolutions(entity);
}

public void OnSolutionChange(Entity<ReplaceEntityOnSolutionEmptyComponent> entity, ref SolutionContainerChangedEvent args)
{
CheckSolutions(entity);
}

public void CheckSolutions(Entity<ReplaceEntityOnSolutionEmptyComponent> entity)
{
if (!EntityManager.HasComponent<SolutionContainerManagerComponent>(entity))
return;

if (_solution.TryGetSolution(entity.Owner, entity.Comp.Solution, out _, out var solution) && solution.Volume <= 0)
ReplaceEntity(entity);
}

public void ReplaceEntity(Entity<ReplaceEntityOnSolutionEmptyComponent> entity)
{
var position = _transform.GetMapCoordinates(entity);
var inContainer = _container.TryGetContainingContainer((entity, null), out var container);
var replacementEntity = entity.Comp.ReplacementEntity;

Del(entity);

if (inContainer && container != null)
SpawnInContainerOrDrop(replacementEntity, container.Owner, container.ID);
else
Spawn(replacementEntity, position);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,7 @@
- BlankMediPen # Frontier
- MedicalAppraisalTool # Frontier
- HandheldCrewMonitor # Frontier
- NFReagentBag # Frontier
dynamicRecipes:
- ChemicalPayload
- CryostasisBeaker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

- type: entity
name: empty medipen
parent: BaseItem
parent: [BaseItem, RecyclableItemPlasticSmall]
description: A empty medipen with endless potential. Does not allow for deviation from Nanotrasen recipes.
id: BlankMediPen
components:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,45 @@
- type: StaticPrice
vendPrice: 0

#Reagent Bag

- type: entity
name: reagent bag
parent: BaseSyringe
description: A bag meant to contain fluids. Maybe your fluids. Has a small injection port to be filled via syringe.
id: NFReagentBag
components:
- type: Sprite
sprite: _NF/Objects/Specific/Medical/medical.rsi
layers:
- state: reagentbag-base-1
map: ["enum.SolutionContainerLayers.Fill"]
visible: false
- state: reagentbag-base
map: ["enum.SolutionContainerLayers.Base"]
- type: Icon
sprite: _NF/Objects/Specific/Medical/medical.rsi
state: "reagentbag-base"
- type: Item
size: Tiny
sprite: _NF/Objects/Specific/Medical/medical.rsi
- type: SolutionContainerManager
solutions:
injector:
maxVol: 50
- type: Injector
injectOnly: true
toggleState: Inject
minTransferAmount: 1
maxTransferAmount: 5
- type: InjectableSolution
solution: injector
- type: SolutionContainerVisuals
maxFillLevels: 6
fillBaseName: reagentbag-base-
inHandsMaxFillLevels: 3
inHandsFillBaseName: -fill-

#Reinforced Jug chem fills.

- type: entity
Expand Down
15 changes: 14 additions & 1 deletion Resources/Prototypes/_NF/Reagents/medicine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,17 @@
Cellular: 1
groups:
Brute: 3


- type: reagent
id: UniversalBlood
name: reagent-name-universalblood
group: Medicine
desc: reagent-desc-universalblood
physicalDesc: reagent-physical-desc-viscous
flavor: metallic
color: "#7b4689"
metabolisms:
Medicine:
effects:
- !type:ModifyBloodLevel
amount: 6
7 changes: 7 additions & 0 deletions Resources/Prototypes/_NF/Recipes/Lathes/chemistry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,10 @@
Plastic: 400
Steel: 100
Silver: 25

- type: latheRecipe
id: NFReagentBag
result: NFReagentBag
completetime: 1
materials:
Plastic: 25
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from cev-eris at https://github.com/discordia-space/CEV-Eris/commit/740ff31a81313086cf16761f3677cf1e2ab46c93 and Taken from tgstation at https://github.com/tgstation/tgstation/blob/623290915c2292b56da11048deb62d758e1e3fb4/icons/obj/bloodpack.dmi, Blood pack redone by Ubaser, edited by dustylens(github)",
"size":
{
"x": 32,
"y": 32
},
"states": [
{
"name": "inhand-left",
"directions": 4
},
{
"name": "inhand-left-fill-1",
"directions": 4
},
{
"name": "inhand-left-fill-2",
"directions": 4
},
{
"name": "inhand-left-fill-3",
"directions": 4
},
{
"name": "inhand-right",
"directions": 4
},
{
"name": "inhand-right-fill-1",
"directions": 4
},
{
"name": "inhand-right-fill-2",
"directions": 4
},
{
"name": "inhand-right-fill-3",
"directions": 4
},
{
"name": "reagentbag-base"
},
{
"name": "reagentbag-base-1"
},
{
"name": "reagentbag-base-2"
},
{
"name": "reagentbag-base-3"
},
{
"name": "reagentbag-base-4"
},
{
"name": "reagentbag-base-5"
},
{
"name": "reagentbag-base-6"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1a93ef4

Please sign in to comment.