Skip to content

Commit

Permalink
Implement Charcoal. #10042 (#11024)
Browse files Browse the repository at this point in the history
* Add charcoal

Flush chemicals that are not the charcoal out of the chemical stream

* Add into EN localization to get chem dispenser to display correctly

* Remove method that wasn't needed

* Remove charcoal from dispenser

Charcoal is made by combing ash and carbon

* Place ash in elements prototype
  • Loading branch information
WPRobson authored Sep 10, 2022
1 parent d79c879 commit 7accbcb
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Content.Server/Body/Systems/BloodstreamSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,22 @@ public bool TryAddToChemicals(EntityUid uid, Solution solution, BloodstreamCompo
return _solutionContainerSystem.TryAddSolution(uid, component.ChemicalSolution, solution);
}

public bool FlushChemicals(EntityUid uid, string excludedReagentID, FixedPoint2 quantity, BloodstreamComponent? component = null) {
if (!Resolve(uid, ref component, false))
return false;

for (var i = component.ChemicalSolution.Contents.Count - 1; i >= 0; i--)
{
var (reagentId, _) = component.ChemicalSolution.Contents[i];
if (reagentId != excludedReagentID)
{
_solutionContainerSystem.TryRemoveReagent(uid, component.ChemicalSolution, reagentId, quantity);
}
}

return true;
}

public float GetBloodLevelPercentage(EntityUid uid, BloodstreamComponent? component = null)
{
if (!Resolve(uid, ref component))
Expand Down
24 changes: 24 additions & 0 deletions Content.Server/Chemistry/ReagentEffects/ChemCleanBoodstream.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Content.Shared.Chemistry.Reagent;
using JetBrains.Annotations;
using Content.Server.Body.Systems;

namespace Content.Server.Chemistry.ReactionEffects
{
/// <summary>
/// Basically smoke and foam reactions.
/// </summary>
[UsedImplicitly]
public sealed class ChemCleanBoodstream : ReagentEffect
{
[DataField("cleanseRate")]
public float CleanseRate = 3.0f;
public override void Effect(ReagentEffectArgs args)
{
if (args.Source == null)
return;

var bloodstreamSys = EntitySystem.Get<BloodstreamSystem>();
bloodstreamSys.FlushChemicals(args.SolutionEntity, args.Reagent.ID, CleanseRate);
}
}
}
6 changes: 6 additions & 0 deletions Resources/Locale/en-US/reagents/meta/elements.ftl
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
reagent-name-aluminium = aluminium
reagent-desc-aluminium = A silver, soft, non-magnetic, and ductile metal.
reagent-name-ash = ash
reagent-desc-ash = A light grey powdery residue
reagent-name-carbon = carbon
reagent-desc-carbon = A black, crystalline solid.
reagent-name-charcoal = charcoal
reagent-desc-charcoal = A black, porous solid
reagent-name-chlorine = chlorine
reagent-desc-chlorine = A yellow-green gas which is toxic to humans.
Expand Down
13 changes: 13 additions & 0 deletions Resources/Prototypes/Entities/Objects/Specific/Medical/morgue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,16 @@
- type: Tag
tags:
- Trash
- type: SolutionContainerManager
solutions:
food:
maxVol: 50
reagents:
- ReagentId: Ash
Quantity: 10
- type: SolutionSpiker
sourceSolution: food
ignoreEmpty: true
- type: DeleteOnTrigger
- type: Extractable
grindableSolutionName: food
25 changes: 25 additions & 0 deletions Resources/Prototypes/Reagents/chemicals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,28 @@
color: "#E7EA91"
boilingPoint: 55.5
meltingPoint: -50.0

- type: reagent
id: Charcoal
name: reagent-name-charcoal
desc: reagent-desc-charcoal
physicalDesc: reagent-physical-desc-porous
color: "#22282b"
boilingPoint: 4200.0
meltingPoint: 3550.0
metabolisms:
Medicine:
effects:
- !type:HealthChange
damage:
types:
Poison: -1
- !type:ChemCleanBoodstream
cleanseRate: 3

- type: reagent
id: Ash
name: reagent-name-ash
desc: reagent-desc-ash
physicalDesc: reagent-physical-desc-powder
color: white
10 changes: 10 additions & 0 deletions Resources/Prototypes/Recipes/Reactions/chemicals.yml
Original file line number Diff line number Diff line change
Expand Up @@ -339,3 +339,13 @@
amount: 1
products:
Pax: 3

- type: reaction
id: Charcoal
reactants:
Carbon:
amount: 1
Ash:
amount: 1
products:
Charcoal: 1

0 comments on commit 7accbcb

Please sign in to comment.