forked from space-syndicate/space-station-14
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
298 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,77 @@ | ||
using Content.Server.Body.Systems; | ||
using Content.Shared.Chemistry.Components; | ||
using Content.Server.Body.Components; //A-13 Dragon fix full | ||
using Content.Shared.Damage.Components; //A-13 Dragon fix full | ||
using Content.Shared.Devour; | ||
using Content.Shared.Devour.Components; | ||
using Content.Shared.Humanoid; | ||
using Content.Shared.Mobs.Components; //A-13 Dragon fix full | ||
|
||
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>(OnBeingGibbed); //A-13 Dragon fix full | ||
SubscribeLocalEvent<DevourerComponent, ComponentRemove>(OnRemoved); //A-13 Dragon fix full | ||
} | ||
|
||
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))) | ||
//A-13 Dragon fix full start | ||
if (component.ShouldStoreDevoured && HasComp<MobStateComponent>(args.Args.Target)) | ||
{ | ||
ichorInjection.ScaleSolution(0.5f); | ||
ContainerSystem.Insert(args.Args.Target.Value, component.Stomach); | ||
|
||
if (component.ShouldStoreDevoured && args.Args.Target is not null) | ||
EnsureComp<DevouredComponent>(args.Args.Target.Value); | ||
|
||
var ev = new DevouredEvent(uid); | ||
RaiseLocalEvent(args.Args.Target.Value, ref ev); | ||
} | ||
|
||
if (component.FoodPreference == FoodPreference.All || component.FoodPreference == FoodPreference.Humanoid && HasComp<HumanoidAppearanceComponent>(args.Args.Target)) | ||
{ | ||
if (TryComp<PassiveDamageComponent>(uid, out var passiveHealing)) | ||
{ | ||
ContainerSystem.Insert(args.Args.Target.Value, component.Stomach); | ||
if (component.PassiveDevourHealing != null) | ||
{ | ||
passiveHealing.Damage += component.PassiveDevourHealing; | ||
} | ||
} | ||
_bloodstreamSystem.TryAddToChemicals(uid, ichorInjection); | ||
} | ||
//A-13 Dragon fix full end | ||
|
||
//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 | ||
//If it does not have a mobState, it must be a structure | ||
else if (args.Args.Target != null) | ||
{ | ||
QueueDel(args.Args.Target.Value); | ||
} | ||
|
||
_audioSystem.PlayPvs(component.SoundDevour, uid); | ||
AudioSystem.PlayPvs(component.SoundDevour, uid); //A-13 Dragon fix full | ||
} | ||
//A-13 Dragon fix full start | ||
public void EmptyStomach(EntityUid uid, DevourerComponent component) | ||
{ | ||
foreach (var entity in component.Stomach.ContainedEntities) | ||
{ | ||
RemComp<DevouredComponent>(entity); | ||
} | ||
ContainerSystem.EmptyContainer(component.Stomach); | ||
} | ||
} | ||
|
||
private void OnBeingGibbed(EntityUid uid, DevourerComponent component, BeingGibbedEvent args) | ||
{ | ||
EmptyStomach(uid, component); | ||
} | ||
private void OnRemoved(EntityUid uid, DevourerComponent component, ComponentRemove args) | ||
{ | ||
EmptyStomach(uid, component); | ||
} | ||
//A-13 Dragon fix full end | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using Content.Shared.Damage; | ||
using Content.Shared.FixedPoint; | ||
using Content.Shared.Mobs; | ||
using Robust.Shared.GameStates; | ||
|
||
namespace Content.Shared.Devour.Components; | ||
|
||
[RegisterComponent, NetworkedComponent] | ||
[Access(typeof(DevouredSystem))] | ||
public sealed partial class DevouredComponent : Component | ||
{ | ||
/// <summary> | ||
/// Stores the original MobStates the entity was allowed to be healed in. | ||
/// This is so it can be returned to it's original state when the component is removed. | ||
/// </summary> | ||
[DataField] | ||
public List<MobState>? OriginalAllowedMobStates; | ||
|
||
/// <summary> | ||
/// Stores the stomach damage so it can be deducted from the devoured entity when the damage is altered. | ||
/// </summary> | ||
[DataField] | ||
public DamageSpecifier? StomachDamage; | ||
|
||
/// <summary> | ||
/// How much extra damage can be done to the entity after it has died. | ||
/// </summary> | ||
[DataField] | ||
public FixedPoint2 DamageCap = 100; | ||
|
||
/// <summary> | ||
/// Stores the current damage modifier. | ||
/// This is to make sure the correct amount of damage is changed. | ||
/// </summary> | ||
[DataField] | ||
public FixedPoint2 CurrentModifier; | ||
|
||
/// <summary> | ||
/// Damage multiplier if the devoured entity is alive. | ||
/// </summary> | ||
[DataField] | ||
public FixedPoint2 AliveMultiplier = 5; | ||
|
||
/// <summary> | ||
/// Damage multiplier if the devoured entity is critical. | ||
/// </summary> | ||
[DataField] | ||
public FixedPoint2 CritMultiplier = 1; | ||
|
||
/// <summary> | ||
/// Damage multiplier if the devoured entity is dead. | ||
/// </summary> | ||
[DataField] | ||
public FixedPoint2 DeadMultiplier = 0.25; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.