fix zombie mispredicts (#11043)

This commit is contained in:
Nemanja
2022-09-06 21:59:27 -04:00
committed by GitHub
parent 3a5821f7d6
commit 47f312e90f
4 changed files with 34 additions and 11 deletions

View File

@@ -0,0 +1,8 @@
using Content.Shared.Zombies;
namespace Content.Client.Zombies;
public sealed class ZombieSystem : SharedZombieSystem
{
}

View File

@@ -13,12 +13,12 @@ using Content.Server.Inventory;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Content.Server.Speech; using Content.Server.Speech;
using Content.Server.Chat.Systems; using Content.Server.Chat.Systems;
using Content.Shared.Movement.Systems;
using Content.Shared.Damage; using Content.Shared.Damage;
using Content.Shared.Zombies;
namespace Content.Server.Zombies namespace Content.Server.Zombies
{ {
public sealed class ZombieSystem : EntitySystem public sealed class ZombieSystem : SharedZombieSystem
{ {
[Dependency] private readonly DiseaseSystem _disease = default!; [Dependency] private readonly DiseaseSystem _disease = default!;
[Dependency] private readonly BloodstreamSystem _bloodstream = default!; [Dependency] private readonly BloodstreamSystem _bloodstream = default!;
@@ -36,7 +36,7 @@ namespace Content.Server.Zombies
SubscribeLocalEvent<ZombieComponent, MeleeHitEvent>(OnMeleeHit); SubscribeLocalEvent<ZombieComponent, MeleeHitEvent>(OnMeleeHit);
SubscribeLocalEvent<ZombieComponent, MobStateChangedEvent>(OnMobState); SubscribeLocalEvent<ZombieComponent, MobStateChangedEvent>(OnMobState);
SubscribeLocalEvent<ActiveZombieComponent, DamageChangedEvent>(OnDamage); SubscribeLocalEvent<ActiveZombieComponent, DamageChangedEvent>(OnDamage);
SubscribeLocalEvent<ZombieComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshSpeed);
} }
private void OnMobState(EntityUid uid, ZombieComponent component, MobStateChangedEvent args) private void OnMobState(EntityUid uid, ZombieComponent component, MobStateChangedEvent args)
@@ -53,12 +53,6 @@ namespace Content.Server.Zombies
DoGroan(uid, component); DoGroan(uid, component);
} }
private void OnRefreshSpeed(EntityUid uid, ZombieComponent component, RefreshMovementSpeedModifiersEvent args)
{
var mod = component.ZombieMovementSpeedDebuff;
args.ModifySpeed(mod, mod);
}
private float GetZombieInfectionChance(EntityUid uid, ZombieComponent component) private float GetZombieInfectionChance(EntityUid uid, ZombieComponent component)
{ {
var baseChance = component.MaxZombieInfectionChance; var baseChance = component.MaxZombieInfectionChance;

View File

@@ -0,0 +1,20 @@
using Content.Shared.Movement.Systems;
namespace Content.Shared.Zombies;
public abstract class SharedZombieSystem : EntitySystem
{
/// <inheritdoc/>
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<ZombieComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshSpeed);
}
private void OnRefreshSpeed(EntityUid uid, ZombieComponent component, RefreshMovementSpeedModifiersEvent args)
{
var mod = component.ZombieMovementSpeedDebuff;
args.ModifySpeed(mod, mod);
}
}

View File

@@ -1,10 +1,11 @@
using Content.Shared.Roles; using Content.Shared.Roles;
using Content.Shared.Weapons.Melee; using Content.Shared.Weapons.Melee;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Server.Zombies namespace Content.Shared.Zombies
{ {
[RegisterComponent] [RegisterComponent, NetworkedComponent]
public sealed class ZombieComponent : Component public sealed class ZombieComponent : Component
{ {
/// <summary> /// <summary>