Melee Executions (#30104)

* melee executions

* fix damage bug

* cleanup

* address reviews hopefully

* resistance bypass mechanic

* component changes

* self executions (not finished yet)

* self execs part two

* ok i fixed things (still not finished)

* finish everything

* review stuff

* nuke if (kind = special)

* more review stuffs

* Make suicide system much less hardcoded and make much more use of events

* Fix a dumb bug I introduced

* self execution popups

* Integration tests

* Why did they even take 0.5 blunt damage?

* More consistent integration tests

* Destructive equals true

* Allow it to dirty-dispose

* IS THIS WHAT YOU WANT?

* FRESH AND CLEAN

* modifier to multiplier

* don't jinx the integration tests

* no file-scoped namespace

* Move the rest of execution to shared, create SuicideGhostEvent

* handled

* Get rid of unused code and add a comment

* ghost before suicide

* stop cat suicides

* popup fix + small suicide change

* make it a bit better

---------

Co-authored-by: Plykiya <58439124+Plykiya@users.noreply.github.com>
This commit is contained in:
Scribbles0
2024-08-10 20:05:54 -07:00
committed by GitHub
parent c25c5ec666
commit 220aff21eb
26 changed files with 1048 additions and 219 deletions

View File

@@ -1,48 +1,41 @@
namespace Content.Shared.Interaction.Events
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Robust.Shared.Prototypes;
namespace Content.Shared.Interaction.Events;
/// <summary>
/// Raised Directed at an entity to check whether they will handle the suicide.
/// </summary>
public sealed class SuicideEvent : HandledEntityEventArgs
{
/// <summary>
/// Raised Directed at an entity to check whether they will handle the suicide.
/// </summary>
public sealed class SuicideEvent : EntityEventArgs
public SuicideEvent(EntityUid victim)
{
public SuicideEvent(EntityUid victim)
{
Victim = victim;
}
public void SetHandled(SuicideKind kind)
{
if (Handled)
throw new InvalidOperationException("Suicide was already handled");
Kind = kind;
}
public void BlockSuicideAttempt(bool suicideAttempt)
{
if (suicideAttempt)
AttemptBlocked = suicideAttempt;
}
public SuicideKind? Kind { get; private set; }
public EntityUid Victim { get; private set; }
public bool AttemptBlocked { get; private set; }
public bool Handled => Kind != null;
Victim = victim;
}
public enum SuicideKind
{
Special, //Doesn't damage the mob, used for "weird" suicides like gibbing
//Damage type suicides
Blunt,
Slash,
Piercing,
Heat,
Shock,
Cold,
Poison,
Radiation,
Asphyxiation,
Bloodloss
}
public DamageSpecifier? DamageSpecifier;
public ProtoId<DamageTypePrototype>? DamageType;
public EntityUid Victim { get; private set; }
}
public sealed class SuicideByEnvironmentEvent : HandledEntityEventArgs
{
public SuicideByEnvironmentEvent(EntityUid victim)
{
Victim = victim;
}
public EntityUid Victim { get; set; }
}
public sealed class SuicideGhostEvent : HandledEntityEventArgs
{
public SuicideGhostEvent(EntityUid victim)
{
Victim = victim;
}
public EntityUid Victim { get; set; }
public bool CanReturnToBody;
}