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:
@@ -216,7 +216,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
if (!Resolve(uid, ref component, false))
|
||||
return new DamageSpecifier();
|
||||
|
||||
var ev = new GetMeleeDamageEvent(uid, new (component.Damage), new(), user);
|
||||
var ev = new GetMeleeDamageEvent(uid, new(component.Damage), new(), user, component.ResistanceBypass);
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
|
||||
return DamageSpecifier.ApplyModifierSets(ev.Damage, ev.Modifiers);
|
||||
@@ -244,6 +244,17 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
return ev.DamageModifier * ev.Multipliers;
|
||||
}
|
||||
|
||||
public bool GetResistanceBypass(EntityUid uid, EntityUid user, MeleeWeaponComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
return false;
|
||||
|
||||
var ev = new GetMeleeDamageEvent(uid, new(component.Damage), new(), user, component.ResistanceBypass);
|
||||
RaiseLocalEvent(uid, ref ev);
|
||||
|
||||
return ev.ResistanceBypass;
|
||||
}
|
||||
|
||||
public bool TryGetWeapon(EntityUid entity, out EntityUid weaponUid, [NotNullWhen(true)] out MeleeWeaponComponent? melee)
|
||||
{
|
||||
weaponUid = default;
|
||||
@@ -441,6 +452,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
// If I do not come back later to fix Light Attacks being Heavy Attacks you can throw me in the spider pit -Errant
|
||||
var damage = GetDamage(meleeUid, user, component) * GetHeavyDamageModifier(meleeUid, user, component);
|
||||
var target = GetEntity(ev.Target);
|
||||
var resistanceBypass = GetResistanceBypass(meleeUid, user, component);
|
||||
|
||||
// For consistency with wide attacks stuff needs damageable.
|
||||
if (Deleted(target) ||
|
||||
@@ -497,7 +509,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
||||
RaiseLocalEvent(target.Value, attackedEvent);
|
||||
|
||||
var modifiedDamage = DamageSpecifier.ApplyModifierSets(damage + hitEvent.BonusDamage + attackedEvent.BonusDamage, hitEvent.ModifiersList);
|
||||
var damageResult = Damageable.TryChangeDamage(target, modifiedDamage, origin:user);
|
||||
var damageResult = Damageable.TryChangeDamage(target, modifiedDamage, origin:user, ignoreResistances:resistanceBypass);
|
||||
|
||||
if (damageResult is {Empty: false})
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user