Port vomit from Nyano (#8349)

This commit is contained in:
Rane
2022-05-23 19:03:27 -04:00
committed by GitHub
parent 80a68b3867
commit b210df0d03
16 changed files with 249 additions and 7 deletions

View File

@@ -0,0 +1,27 @@
using Content.Shared.Chemistry.Reagent;
using Content.Server.Medical;
using JetBrains.Annotations;
namespace Content.Server.Chemistry.ReagentEffects
{
/// <summary>
/// Forces you to vomit.
/// </summary>
[UsedImplicitly]
public sealed class ChemVomit : ReagentEffect
{
/// How many units of thirst to add each time we vomit
[DataField("thirstAmount")]
public float ThirstAmount = -40f;
/// How many units of hunger to add each time we vomit
[DataField("hungerAmount")]
public float HungerAmount = -40f;
public override void Effect(ReagentEffectArgs args)
{
var vomitSys = args.EntityManager.EntitySysManager.GetEntitySystem<VomitSystem>();
vomitSys.Vomit(args.SolutionEntity, ThirstAmount, HungerAmount);
}
}
}

View File

@@ -0,0 +1,27 @@
using JetBrains.Annotations;
using Content.Shared.Disease;
using Content.Server.Medical;
namespace Content.Server.Disease.Effects
{
/// <summary>
/// Forces you to vomit.
/// </summary>
[UsedImplicitly]
public sealed class DiseaseVomit : DiseaseEffect
{
/// How many units of thirst to add each time we vomit
[DataField("thirstAmount")]
public float ThirstAmount = -40f;
/// How many units of hunger to add each time we vomit
[DataField("hungerAmount")]
public float HungerAmount = -40f;
public override void Effect(DiseaseEffectArgs args)
{
var vomitSys = args.EntityManager.EntitySysManager.GetEntitySystem<VomitSystem>();
vomitSys.Vomit(args.DiseasedEntity, ThirstAmount, HungerAmount);
}
}
}

View File

@@ -0,0 +1,73 @@
using Content.Server.Nutrition.Components;
using Content.Server.Stunnable;
using Content.Server.Nutrition.EntitySystems;
using Content.Server.Body.Components;
using Content.Server.Fluids.Components;
using Content.Server.Chemistry.EntitySystems;
using Content.Server.Popups;
using Content.Server.Body.Systems;
using Content.Shared.StatusEffect;
using Content.Shared.Audio;
using Robust.Shared.Audio;
using Robust.Shared.Player;
namespace Content.Server.Medical
{
public sealed class VomitSystem : EntitySystem
{
[Dependency] private readonly StunSystem _stunSystem = default!;
[Dependency] private readonly SolutionContainerSystem _solutionSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly BodySystem _bodySystem = default!;
[Dependency] private readonly ThirstSystem _thirstSystem = default!;
/// <summary>
/// Make an entity vomit, if they have a stomach.
/// </summary>
public void Vomit(EntityUid uid, float thirstAdded = -40f, float hungerAdded = -40f)
{
/// Main requirement: You have a stomach
var stomachList = _bodySystem.GetComponentsOnMechanisms<StomachComponent>(uid);
if (stomachList.Count == 0)
{
return;
}
/// Vomiting makes you hungrier and thirstier
if (TryComp<HungerComponent>(uid, out var hunger))
hunger.UpdateFood(hungerAdded);
if (TryComp<ThirstComponent>(uid, out var thirst))
_thirstSystem.UpdateThirst(thirst, thirstAdded);
// It fully empties the stomach, this amount from the chem stream is relatively small
float solutionSize = (Math.Abs(thirstAdded) + Math.Abs(hungerAdded)) / 6;
// Apply a bit of slowdown
if (TryComp<StatusEffectsComponent>(uid, out var status))
_stunSystem.TrySlowdown(uid, TimeSpan.FromSeconds(solutionSize), true, 0.5f, 0.5f, status);
var puddle = EntityManager.SpawnEntity("PuddleVomit", Transform(uid).Coordinates);
var puddleComp = Comp<PuddleComponent>(puddle);
SoundSystem.Play(Filter.Pvs(uid), "/Audio/Effects/Diseases/vomiting.ogg", uid, AudioHelpers.WithVariation(0.2f).WithVolume(-4f));
_popupSystem.PopupEntity(Loc.GetString("disease-vomit", ("person", uid)), uid, Filter.Pvs(uid));
// Get the solution of the puddle we spawned
if (!_solutionSystem.TryGetSolution(puddle, puddleComp.SolutionName, out var puddleSolution))
return;
// Empty the stomach out into it
foreach (var stomach in stomachList)
{
if (_solutionSystem.TryGetSolution(stomach.Comp.Owner, StomachSystem.DefaultSolutionName, out var sol))
_solutionSystem.TryAddSolution(puddle, puddleSolution, sol);
}
// And the small bit of the chem stream from earlier
if (TryComp<BloodstreamComponent>(uid, out var bloodStream))
{
var temp = bloodStream.ChemicalSolution.SplitSolution(solutionSize);
_solutionSystem.TryAddSolution(puddle, puddleSolution, temp);
}
}
}
}

View File

@@ -27,7 +27,9 @@ public sealed class DiseaseOutbreak : StationEvent
"SpaceCold",
"VanAusdallsRobovirus",
"VentCough",
"AMIV"
"AMIV",
"SpaceFlu",
"BirdFlew"
};
public override string Name => "DiseaseOutbreak";
public override float Weight => WeightNormal;

View File

@@ -5,3 +5,4 @@ beepboop.ogg taken from https://freesound.org/people/Fidjo20/sounds/503526/
monkey1.ogg taken from https://freesound.org/people/TRAVELcandies/sounds/423396/
monkey2.ogg taken from https://freesound.org/people/Archeos/sounds/325549/
sneeze2.ogg taken from https://freesound.org/people/InspectorJ/sounds/352177/
vomiting.ogg taken from https://freesound.org/people/vikuserro/sounds/246308/

Binary file not shown.

View File

@@ -9,3 +9,4 @@ disease-beep= {CAPITALIZE($person)} beeps.
disease-eaten-inside = You feel like you're being eaten from the inside.
disease-banana-compulsion = You really want to eat some bananas.
disease-beat-chest-compulsion = {CAPITALIZE(THE($person))} beats {POSS-ADJ($person)} chest.
disease-vomit = {CAPITALIZE(THE($person))} vomits.

View File

@@ -52,6 +52,8 @@
contents:
- id: SyringeSpaceacillin
amount: 1
- id: SyringeIpecac
amount: 1
- id: PillDylovene
amount: 3

View File

@@ -48,6 +48,51 @@
- !type:DiseaseReagentCure
reagent: SpaceCleaner
- type: disease
id: SpaceFlu
name: space flu
cureResist: 0.08
effects:
- !type:DiseaseVomit
probability: 0.01
- !type:DiseasePopUp
probability: 0.025
- !type:DiseaseSnough
probability: 0.025
snoughSound:
collection: Sneezes
- !type:DiseaseHealthChange
probability: 0.015
damage:
types:
Heat: 1
cures:
- !type:DiseaseBedrestCure
maxLength: 100
- type: disease
id: Bird Flew
name: bird flew
cureResist: 0.08
effects:
- !type:DiseaseVomit
probability: 0.015
- !type:DiseasePopUp
probability: 0.025
- !type:DiseaseSnough
probability: 0.025
snoughMessage: disease-cough
snoughSound:
collection: Coughs
- !type:DiseaseHealthChange
probability: 0.05
damage:
groups:
Caustic: 1
cures:
- !type:DiseaseBedrestCure
maxLength: 120
- type: disease
id: VanAusdallsRobovirus
name: Van Ausdall's Robovirus

View File

@@ -5,10 +5,12 @@
cureResist: 0.15
effects:
- !type:DiseaseHealthChange
probability: 0.35
probability: 0.3
damage:
types:
Cellular: 1
- !type:DiseaseVomit
probability: 0.01
- !type:DiseasePopUp
probability: 0.03
cures:

View File

@@ -118,10 +118,24 @@
- type: entity
name: vomit
id: PuddleVomit
parent: PuddleBase
id: PuddleVomit # No parent because we don't want the visualizer
description: Gross.
components:
- type: Transform
anchored: true
- type: Clickable
- type: Evaporation
- type: Physics
- type: Fixtures
fixtures:
- shape:
!type:PhysShapeAabb
bounds: "-0.4,-0.4,0.4,0.4"
mask:
- ItemMask
layer:
- SlipLayer
hard: false
- type: Sprite
sprite: Fluids/vomit.rsi
state: vomit-0
@@ -135,9 +149,6 @@
Quantity: 5
- ReagentId: Water
Quantity: 5
- type: Appearance
visuals:
- type: PuddleVisualizer
- type: Slippery
launchForwardsMultiplier: 2.0
- type: StepTrigger

View File

@@ -268,6 +268,19 @@
- ReagentId: Spaceacillin
Quantity: 15
- type: entity
name: ipecac syringe
parent: Syringe
id: SyringeIpecac
components:
- type: SolutionContainerManager
solutions:
injector:
maxVol: 15
reagents:
- ReagentId: Ipecac
Quantity: 15
#this is where all the syringes are so i didn't know where to put it
- type: entity
name: corpium syringe

View File

@@ -108,6 +108,12 @@
damage:
groups:
Caustic: 1
- !type:ChemVomit
probability: 0.04
conditions:
- !type:ReagentThreshold
reagent: Ethanol
min: 3
- type: reagent
id: Gin

View File

@@ -249,6 +249,19 @@
types:
Radiation: -1
- type: reagent
id: Ipecac
name: ipecac
group: Medicine
desc: Induces vomiting. Useful for stopping a poisoning that isn't done metabolizing.
physicalDesc: inky
color: "#422912"
metabolisms:
Medicine:
effects:
- !type:ChemVomit
probability: 0.3
- type: reagent
id: Inaprovaline
name: reagent-name-inaprovaline
@@ -366,6 +379,8 @@
types:
Cellular: -1
Radiation: 1
- !type:ChemVomit
probability: 0.05
- type: reagent
id: Romerol

View File

@@ -254,6 +254,13 @@
damage:
types:
Poison: 4
- !type:ChemVomit
probability: 0.025
conditions:
- !type:ReagentThreshold
min: 3
- !type:OrganType
type: Animal
- type: reagent
id: Amatoxin

View File

@@ -142,6 +142,16 @@
products:
Inaprovaline: 3
- type: reaction
id: Ipecac
reactants:
Dylovene:
amount: 1
Ammonia:
amount: 1
products:
Ipecac: 2
- type: reaction
id: TranexamicAcid
reactants: