mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 13:37:47 +03:00
<!-- This is a semi-strict format, you can add/remove sections as needed but the order/format should be kept the same Remove these comments before submitting --> # Description <!-- Explain this PR in as much detail as applicable Some example prompts to consider: How might this affect the game? The codebase? What might be some alternatives to this? How/Who does this benefit/hurt [the game/codebase]? --> This PR fixes the issue where any corpses devoured by a space dragon dissapear upon the Dragon being gibbed or butchered. Cherry-picked from Wizden #28709 --- # TODO <!-- A list of everything you have to do before this PR is "complete" You probably won't have to complete everything before merging but it's good to leave future references --> n/a --- <!-- This is default collapsed, readers click to expand it and see all your media The PR media section can get very large at times, so this is a good way to keep it clean The title is written using HTML tags The title must be within the <summary> tags or you won't see it --> <details><summary><h1>Media</h1></summary> <p> </p> </details> --- # Changelog <!-- You can add an author after the `🆑` to change the name that appears in the changelog (ex: `🆑 Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> 🆑 zelezniciar - fix: Space dragons that get butchered or gibbed will now drop devoured corpses. Co-authored-by: Lyndomen <49795619+Lyndomen@users.noreply.github.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
62 lines
2.2 KiB
C#
62 lines
2.2 KiB
C#
using Content.Server.Body.Components;
|
|
using Content.Server.Body.Systems;
|
|
using Content.Shared.Chemistry.Components;
|
|
using Content.Shared.Devour;
|
|
using Content.Shared.Devour.Components;
|
|
using Content.Shared.Humanoid;
|
|
|
|
namespace Content.Server.Devour;
|
|
|
|
public sealed class DevourSystem : SharedDevourSystem
|
|
{
|
|
[Dependency] private readonly BloodstreamSystem _bloodstreamSystem = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<DevourerComponent, DevourDoAfterEvent>(OnDoAfter);
|
|
SubscribeLocalEvent<DevourerComponent, BeingGibbedEvent>(OnGibContents);
|
|
}
|
|
|
|
private void OnDoAfter(EntityUid uid, DevourerComponent component, DevourDoAfterEvent args)
|
|
{
|
|
if (args.Handled || args.Cancelled)
|
|
return;
|
|
|
|
var ichorInjection = new Solution(component.Chemical, component.HealRate);
|
|
|
|
if (component.FoodPreference == FoodPreference.All ||
|
|
(component.FoodPreference == FoodPreference.Humanoid && HasComp<HumanoidAppearanceComponent>(args.Args.Target)))
|
|
{
|
|
ichorInjection.ScaleSolution(0.5f);
|
|
|
|
if (component.ShouldStoreDevoured && args.Args.Target is not null)
|
|
{
|
|
ContainerSystem.Insert(args.Args.Target.Value, component.Stomach);
|
|
}
|
|
_bloodstreamSystem.TryAddToChemicals(uid, ichorInjection);
|
|
}
|
|
|
|
//TODO: Figure out a better way of removing structures via devour that still entails standing still and waiting for a DoAfter. Somehow.
|
|
//If it's not human, it must be a structure
|
|
else if (args.Args.Target != null)
|
|
{
|
|
QueueDel(args.Args.Target.Value);
|
|
}
|
|
|
|
_audioSystem.PlayPvs(component.SoundDevour, uid);
|
|
}
|
|
|
|
private void OnGibContents(EntityUid uid, DevourerComponent component, ref BeingGibbedEvent args)
|
|
{
|
|
if (!component.ShouldStoreDevoured)
|
|
return;
|
|
|
|
// For some reason we have two different systems that should handle gibbing,
|
|
// and for some another reason GibbingSystem, which should empty all containers, doesn't get involved in this process
|
|
ContainerSystem.EmptyContainer(component.Stomach);
|
|
}
|
|
}
|
|
|