mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-04 05:17:28 +00:00
* Nubody (#42419) * Nubody * fix test fails * gibbing * lung test returns * doc comment * hand organ test * giblet test * yaml formatting * returning * relocate * trimming * re-smite * oops thusd tweak * arachnids have slower metabolism i guess * never mind the old behaviour is bad actually * rider whyyy * style changes and allat * fix collision --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> * C# files done * Visual nubody (humanoid appearance refactor) (#42476) * initial visual nubody * oops overlay * im so pheeming rn * conversion... * tests * comeback of the underwear * oops eyes * blabbl * zeds * yaml linted * search and visible count constraints * reordering * preserve previously selected markings colors * fix test * some ui niceties * ordering * make DB changes backwards-compatible/downgrade-friendly * fix things again * fix migration * vulpkanin markings limit increase * wrapping * code cleanup and more code cleanup and more code cleanup and more code cleanup and * fix slop ports * better sampling API * make filter work + use the method i made for its intended purpose * fix test fails real quick * magic mirror cleanup, remove TODO * don't 0-init the organ profile data * remove deltastates --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> * Let vox eat trash again (#42503) * C# complete port * Getting closer * Harpy Nubody Port * Port Feroxi, Kitsune. Fix some yml typos and remove ipcs stuff * Port Oni * Port Rest, except Motorkind * Port Motorkind * Remove more surgery, restore too much deleted stuff * Fix Typos and change some organ names. Need to split eyes next * Harpy HAve Wings again * Some fixes, More Surgeyr Removal, Copying of eye organs * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Use correct Body imports * Markings Refactoring, Harpy Layering * Motorkind doesn't crash anymore. Some layer remappings. * Allow Organs to have Markings Displacements again. (#43604) * first shtep * readd markings support --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> * Fix STalk eyes and several layerings * Fix sexed organs (#42554) * Fix markings for several species, fit them for sexed organs and rename some files to fit them for it * Additional IPC-related removals * Vulpkanin eyes are now correct again * Fix Subtle Cultist Marks on species * Fix Asakim Sprites (sexed) and make CD imports work * Migration, error fixes, and Height * Fix humanoid profile voice being broken (#42550) Fix humanoid appearance voice being broken * Change Kitsune SexChanged Event to with ref * Fix asakim issue, Respirator fix * Simplify hands UI code (#42534) * Simplify hands UI code * i remembered about SortedHands in the component * minor cleanup --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> * Set size of Analyzer back to 350, Kitsune can't gib themselves no more. Migration * yml linter errors and an rudimentary onAdd Organ Functionality * Fixing it trying to remove nothing * midpoint migration * Why do you put so many organs everywhere * More missing prototypes * Migration of more organs * Forgot lungs * Move character preview handling into a specialized control (#41252) * Move character preview handling into a specialized control Co-authored-by: Quantum-cross <7065792+Quantum-cross@users.noreply.github.com> * Restore job name that I accidentally removed from character picker buttons * Just resolve dependencies the standard way --------- Co-authored-by: Quantum-cross <7065792+Quantum-cross@users.noreply.github.com> Co-authored-by: Janet Blackquill <uhhadd@gmail.com> * Drop ICharacterProfile/ICharacterAppearance interfaces (#42661) * Ensure profile loading only returns valid species (#42842) (Stable merge) (#42865) Co-authored-by: pathetic meowmeow <uhhadd@gmail.com> * Changes to make it work for us. * No more bald Harpy * OperatingTables instead of null * Adding Delta V Comments, commenting out instead of deleting * Fix broken Height Scale. * Remove HumanoidSilicon Mention * Did an error. Readded, uncommented. * Clean up Marking data structure, add tests for Zombie transformation (#42756) * Clean up Marking data structure, add tests for Zombie transformation * empty * AAAAAAAAAAAAAAAA --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> * Fix markings colour setting (#42771) * Fix: Markings Color For Downstream * Comment out A Leg. Remove Todo * Revert to original hidden species code --------- Co-authored-by: pathetic meowmeow <uhhadd@gmail.com> Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Princess Cheeseballs <66055347+Princess-Cheeseballs@users.noreply.github.com> Co-authored-by: Absotively <jen@jenpollock.ca> Co-authored-by: Quantum-cross <7065792+Quantum-cross@users.noreply.github.com> Co-authored-by: Myra <vasilis@pikachu.systems>
132 lines
5.4 KiB
C#
132 lines
5.4 KiB
C#
using Content.Shared.Body;
|
|
using Content.Shared.Body.Components;
|
|
using Content.Shared.Body.Systems;
|
|
using Content.Shared.Chemistry.Components;
|
|
using Content.Shared.Chemistry.EntitySystems;
|
|
using Content.Shared.Chemistry.Reagent;
|
|
using Content.Shared.Fluids;
|
|
using Content.Shared.Forensics.Systems;
|
|
using Content.Shared.IdentityManagement;
|
|
using Content.Shared.Mobs.Systems;
|
|
using Content.Shared.Movement.Systems;
|
|
using Content.Shared.Nutrition.Components;
|
|
using Content.Shared.Nutrition.EntitySystems;
|
|
using Content.Shared.Popups;
|
|
using Robust.Shared.Audio;
|
|
using Robust.Shared.Audio.Systems;
|
|
using Robust.Shared.Network;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Shared.Medical;
|
|
|
|
public sealed class VomitSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly INetManager _netManager = default!;
|
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
|
[Dependency] private readonly HungerSystem _hunger = default!;
|
|
[Dependency] private readonly MobStateSystem _mobState = default!;
|
|
[Dependency] private readonly MovementModStatusSystem _movementMod = default!;
|
|
[Dependency] private readonly ThirstSystem _thirst = default!;
|
|
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
|
[Dependency] private readonly SharedBloodstreamSystem _bloodstream = default!;
|
|
[Dependency] private readonly SharedForensicsSystem _forensics = default!;
|
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
|
[Dependency] private readonly SharedPuddleSystem _puddle = default!;
|
|
[Dependency] private readonly SharedSolutionContainerSystem _solutionContainer = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<StomachComponent, BodyRelayedEvent<TryVomitEvent>>(TryVomitSolution);
|
|
}
|
|
|
|
private const float ChemMultiplier = 0.1f;
|
|
|
|
private static readonly ProtoId<SoundCollectionPrototype> VomitCollection = "Vomit";
|
|
|
|
private static readonly ProtoId<ReagentPrototype> VomitPrototype = "Vomit"; // TODO: Dehardcode vomit prototype
|
|
|
|
private readonly SoundSpecifier _vomitSound = new SoundCollectionSpecifier(VomitCollection,
|
|
AudioParams.Default.WithVariation(0.2f).WithVolume(-4f));
|
|
|
|
private void TryVomitSolution(Entity<StomachComponent> ent, ref BodyRelayedEvent<TryVomitEvent> args)
|
|
{
|
|
if (_solutionContainer.ResolveSolution(ent.Owner, StomachSystem.DefaultSolutionName, ref ent.Comp.Solution, out var sol))
|
|
_solutionContainer.TryTransferSolution(ent.Comp.Solution.Value, args.Args.Sol, sol.AvailableVolume);
|
|
|
|
args.Args = args.Args with { Handled = true };
|
|
}
|
|
|
|
/// <summary>
|
|
/// Make an entity vomit, if they have a stomach.
|
|
/// </summary>
|
|
public void Vomit(EntityUid uid, float thirstAdded = -40f, float hungerAdded = -40f, bool force = false)
|
|
{
|
|
// Vomit only if entity is alive
|
|
// Ignore condition if force was set to true
|
|
if (!force && _mobState.IsDead(uid))
|
|
return;
|
|
|
|
// TODO: Need decals
|
|
var solution = new Solution();
|
|
|
|
var ev = new TryVomitEvent(solution, force);
|
|
RaiseLocalEvent(uid, ref ev);
|
|
|
|
if (!ev.Handled)
|
|
return;
|
|
|
|
// Vomiting makes you hungrier and thirstier
|
|
if (TryComp<HungerComponent>(uid, out var hunger))
|
|
_hunger.ModifyHunger(uid, hungerAdded, hunger);
|
|
|
|
if (TryComp<ThirstComponent>(uid, out var thirst))
|
|
_thirst.ModifyThirst(uid, thirst, thirstAdded);
|
|
|
|
// It fully empties the stomach, this amount from the chem stream is relatively small
|
|
var solutionSize = (MathF.Abs(thirstAdded) + MathF.Abs(hungerAdded)) / 6;
|
|
|
|
// Apply a bit of slowdown
|
|
_movementMod.TryUpdateMovementSpeedModDuration(uid, MovementModStatusSystem.VomitingSlowdown, TimeSpan.FromSeconds(solutionSize), 0.5f);
|
|
|
|
// Adds a tiny amount of the chem stream from earlier along with vomit
|
|
if (TryComp<BloodstreamComponent>(uid, out var bloodStream))
|
|
{
|
|
var vomitAmount = solutionSize;
|
|
|
|
// Flushes small portion of the chemicals removed from the bloodstream stream
|
|
if (_solutionContainer.ResolveSolution(uid, bloodStream.BloodSolutionName, ref bloodStream.BloodSolution))
|
|
{
|
|
var vomitChemstreamAmount = _bloodstream.FlushChemicals((uid, bloodStream), vomitAmount);
|
|
|
|
if (vomitChemstreamAmount != null)
|
|
{
|
|
vomitChemstreamAmount.ScaleSolution(ChemMultiplier);
|
|
solution.AddSolution(vomitChemstreamAmount, _proto);
|
|
vomitAmount -= (float)vomitChemstreamAmount.Volume;
|
|
}
|
|
}
|
|
|
|
// Makes a vomit solution the size of 90% of the chemicals removed from the chemstream
|
|
solution.AddReagent(new ReagentId(VomitPrototype, _bloodstream.GetEntityBloodData((uid, bloodStream))), vomitAmount);
|
|
}
|
|
|
|
if (_puddle.TrySpillAt(uid, solution, out var puddle, false))
|
|
{
|
|
_forensics.TransferDna(puddle, uid, false);
|
|
}
|
|
|
|
|
|
if (!_netManager.IsServer)
|
|
return;
|
|
|
|
// Force sound to play as spill doesn't work if solution is empty.
|
|
_audio.PlayPvs(_vomitSound, uid);
|
|
_popup.PopupEntity(Loc.GetString("disease-vomit", ("person", Identity.Entity(uid, EntityManager))), uid);
|
|
}
|
|
}
|
|
|
|
[ByRefEvent]
|
|
public record struct TryVomitEvent(Solution Sol, bool Forced = false, bool Handled = false);
|