Zombie Rework & Polymorph Expansion (#8413)
Co-authored-by: Kara <lunarautomaton6@gmail.com> Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
@@ -84,7 +84,7 @@ namespace Content.Server.Weapon.Melee
|
||||
if (args.Target is {Valid: true} target)
|
||||
{
|
||||
// Raise event before doing damage so we can cancel damage if the event is handled
|
||||
var hitEvent = new MeleeHitEvent(new List<EntityUid>() { target }, args.User);
|
||||
var hitEvent = new MeleeHitEvent(new List<EntityUid>() { target }, args.User, comp.Damage);
|
||||
RaiseLocalEvent(owner, hitEvent, false);
|
||||
|
||||
if (!hitEvent.Handled)
|
||||
@@ -152,7 +152,7 @@ namespace Content.Server.Weapon.Melee
|
||||
}
|
||||
|
||||
// Raise event before doing damage so we can cancel damage if handled
|
||||
var hitEvent = new MeleeHitEvent(hitEntities, args.User);
|
||||
var hitEvent = new MeleeHitEvent(hitEntities, args.User, comp.Damage);
|
||||
RaiseLocalEvent(owner, hitEvent, false);
|
||||
SendAnimation(comp.Arc, angle, args.User, owner, hitEntities);
|
||||
|
||||
@@ -352,6 +352,11 @@ namespace Content.Server.Weapon.Melee
|
||||
/// </summary>
|
||||
public sealed class MeleeHitEvent : HandledEntityEventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The base amount of damage dealt by the melee hit.
|
||||
/// </summary>
|
||||
public readonly DamageSpecifier BaseDamage = new();
|
||||
|
||||
/// <summary>
|
||||
/// Modifier sets to apply to the hit event when it's all said and done.
|
||||
/// This should be modified by adding a new entry to the list.
|
||||
@@ -382,10 +387,11 @@ namespace Content.Server.Weapon.Melee
|
||||
/// </summary>
|
||||
public EntityUid User { get; }
|
||||
|
||||
public MeleeHitEvent(List<EntityUid> hitEntities, EntityUid user)
|
||||
public MeleeHitEvent(List<EntityUid> hitEntities, EntityUid user, DamageSpecifier baseDamage)
|
||||
{
|
||||
HitEntities = hitEntities;
|
||||
User = user;
|
||||
BaseDamage = baseDamage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
namespace Content.Server.Weapons.Melee.ZombieTransfer.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class ZombieTransferComponent : Component
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
using System.Linq;
|
||||
using Robust.Shared.Random;
|
||||
using Content.Server.Body.Systems;
|
||||
using Content.Server.Disease.Components;
|
||||
using Content.Server.Disease.Zombie.Components;
|
||||
using Content.Server.Drone.Components;
|
||||
using Content.Server.Weapon.Melee;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Server.Disease;
|
||||
using Content.Server.Weapons.Melee.ZombieTransfer.Components;
|
||||
|
||||
namespace Content.Server.Weapons.Melee.ZombieTransfer
|
||||
{
|
||||
public sealed class ZombieTransferSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly DiseaseSystem _disease = default!;
|
||||
[Dependency] private readonly BloodstreamSystem _bloodstream = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<ZombieTransferComponent, MeleeHitEvent>(OnMeleeHit);
|
||||
}
|
||||
|
||||
private void OnMeleeHit(EntityUid uid, ZombieTransferComponent component, MeleeHitEvent args)
|
||||
{
|
||||
if (!EntityManager.TryGetComponent<DiseaseZombieComponent>(args.User, out var diseaseZombieComp))
|
||||
return;
|
||||
|
||||
if (!args.HitEntities.Any())
|
||||
return;
|
||||
|
||||
foreach (EntityUid entity in args.HitEntities)
|
||||
{
|
||||
if (args.User == entity)
|
||||
continue;
|
||||
|
||||
if (!HasComp<MobStateComponent>(entity) || HasComp<DroneComponent>(entity))
|
||||
continue;
|
||||
|
||||
if (_robustRandom.Prob(diseaseZombieComp.Probability) && HasComp<DiseaseCarrierComponent>(entity))
|
||||
{
|
||||
_disease.TryAddDisease(entity, "ZombieInfection");
|
||||
}
|
||||
|
||||
EntityManager.EnsureComponent<MobStateComponent>(entity, out var mobState);
|
||||
if ((mobState.IsDead() || mobState.IsCritical()) && !HasComp<DiseaseZombieComponent>(entity)) //dead entities are eautomatically infected. MAYBE: have activated infect ability?
|
||||
{
|
||||
EntityManager.AddComponent<DiseaseZombieComponent>(entity);
|
||||
var dspec = new DamageSpecifier();
|
||||
//these damages match the zombie claw
|
||||
dspec.DamageDict.TryAdd("Slash", -12);
|
||||
dspec.DamageDict.TryAdd("Piercing", -7);
|
||||
args.BonusDamage += dspec;
|
||||
}
|
||||
else if (mobState.IsAlive()) //heals when zombies bite live entities
|
||||
{
|
||||
var healingSolution = new Solution();
|
||||
healingSolution.AddReagent("Bicaridine", 1.00); //if OP, reduce/change chem
|
||||
_bloodstream.TryAddToChemicals(args.User, healingSolution);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user