Mobstate Refactor (#13389)

Refactors mobstate and moves mob health thresholds to their own component

Co-authored-by: DrSmugleaf <drsmugleaf@gmail.com>
This commit is contained in:
Jezithyr
2023-01-13 16:57:10 -08:00
committed by GitHub
parent 97e4c477bd
commit eeb5b17b34
148 changed files with 1517 additions and 1290 deletions

View File

@@ -13,8 +13,8 @@ using Content.Shared.Bed.Sleep;
using Content.Shared.Damage;
using Content.Shared.Disease.Events;
using Content.Shared.Inventory;
using Content.Shared.MobState;
using Content.Shared.MobState.Components;
using Content.Shared.Mobs;
using Content.Shared.Mobs.Components;
using Content.Shared.Weapons.Melee.Events;
using Content.Shared.Zombies;
using Robust.Shared.Prototypes;
@@ -52,7 +52,7 @@ namespace Content.Server.Zombies
private void OnMobState(EntityUid uid, ZombieComponent component, MobStateChangedEvent args)
{
if (args.CurrentMobState == DamageState.Alive)
if (args.NewMobState == MobState.Alive)
EnsureComp<ActiveZombieComponent>(uid);
else
RemComp<ActiveZombieComponent>(uid);
@@ -126,13 +126,13 @@ namespace Content.Server.Zombies
if (HasComp<ZombieComponent>(entity))
args.BonusDamage = -args.BaseDamage * zombieComp.OtherZombieDamageCoefficient;
if ((mobState.CurrentState == DamageState.Dead || mobState.CurrentState == DamageState.Critical)
if ((mobState.CurrentState == MobState.Dead || mobState.CurrentState == MobState.Critical)
&& !HasComp<ZombieComponent>(entity))
{
_zombify.ZombifyEntity(entity);
args.BonusDamage = -args.BaseDamage;
}
else if (mobState.CurrentState == DamageState.Alive) //heals when zombies bite live entities
else if (mobState.CurrentState == MobState.Alive) //heals when zombies bite live entities
{
var healingSolution = new Solution();
healingSolution.AddReagent("Bicaridine", 1.00); //if OP, reduce/change chem