Zombie Fixes and Tweaks (#9940)

This commit is contained in:
Nemanja
2022-07-26 20:35:34 -04:00
committed by GitHub
parent e795e5b5e1
commit 6276bda4f4
7 changed files with 47 additions and 19 deletions

View File

@@ -12,7 +12,7 @@ namespace Content.Server.Zombies
/// attacks another zombie. longe name
/// </summary>
[ViewVariables]
public float OtherZombieDamageCoefficient = 0.5f;
public float OtherZombieDamageCoefficient = 0.25f;
/// <summary>
/// The baseline infection chance you have if you are completely nude
@@ -27,6 +27,9 @@ namespace Content.Server.Zombies
[ViewVariables]
public float MinZombieInfectionChance = 0.1f;
[ViewVariables(VVAccess.ReadWrite)]
public float ZombieMovementSpeedDebuff = 0.75f;
/// <summary>
/// The skin color of the zombie
/// </summary>

View File

@@ -8,15 +8,16 @@ using Content.Shared.Chemistry.Components;
using Content.Shared.MobState.Components;
using Content.Server.Disease;
using Content.Shared.Inventory;
using Content.Server.Popups;
using Robust.Shared.Player;
using Content.Server.Inventory;
using Robust.Shared.Prototypes;
using Content.Shared.Movement.Systems;
using Content.Shared.Damage;
namespace Content.Server.Zombies
{
public sealed class ZombieSystem : EntitySystem
{
[Dependency] private readonly DamageableSystem _damage = default!;
[Dependency] private readonly DiseaseSystem _disease = default!;
[Dependency] private readonly BloodstreamSystem _bloodstream = default!;
[Dependency] private readonly ZombifyOnDeathSystem _zombify = default!;
@@ -29,6 +30,13 @@ namespace Content.Server.Zombies
base.Initialize();
SubscribeLocalEvent<ZombieComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<ZombieComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshSpeed);
}
private void OnRefreshSpeed(EntityUid uid, ZombieComponent component, RefreshMovementSpeedModifiersEvent args)
{
var mod = component.ZombieMovementSpeedDebuff;
args.ModifySpeed(mod, mod);
}
private float GetZombieInfectionChance(EntityUid uid, ZombieComponent component)

View File

@@ -30,6 +30,7 @@ using Content.Shared.Zombies;
using Content.Shared.Popups;
using Content.Server.Atmos.Miasma;
using Content.Server.IdentityManagement;
using Content.Shared.Movement.Systems;
namespace Content.Server.Zombies
{
@@ -48,6 +49,7 @@ namespace Content.Server.Zombies
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly SharedHumanoidAppearanceSystem _sharedHuApp = default!;
[Dependency] private readonly IdentitySystem _identity = default!;
[Dependency] private readonly MovementSpeedModifierSystem _movementSpeedModifier = default!;
[Dependency] private readonly IChatManager _chatMan = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
@@ -63,8 +65,8 @@ namespace Content.Server.Zombies
/// </summary>
private void OnDamageChanged(EntityUid uid, ZombifyOnDeathComponent component, MobStateChangedEvent args)
{
if (args.CurrentMobState.IsDead() ||
args.CurrentMobState.IsCritical())
if (args.CurrentMobState == DamageState.Dead ||
args.CurrentMobState == DamageState.Critical)
{
ZombifyEntity(uid);
}
@@ -101,7 +103,8 @@ namespace Content.Server.Zombies
//funny voice
EnsureComp<ReplacementAccentComponent>(target).Accent = "zombie";
EnsureComp<RottingComponent>(target);
var rotting = EnsureComp<RottingComponent>(target);
rotting.DealDamage = false;
///This is needed for stupid entities that fuck up combat mode component
///in an attempt to make an entity not attack. This is the easiest way to do it.
@@ -129,6 +132,7 @@ namespace Content.Server.Zombies
DamageSpecifier dspec = new();
dspec.DamageDict.Add("Slash", 13);
dspec.DamageDict.Add("Piercing", 7);
dspec.DamageDict.Add("Structural", 10);
melee.Damage = dspec;
}
@@ -194,6 +198,8 @@ namespace Content.Server.Zombies
//zombie gamemode stuff
RaiseLocalEvent(new EntityZombifiedEvent(target));
//zombies get slowdown once they convert
_movementSpeedModifier.RefreshMovementSpeedModifiers(target);
}
}
}