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

@@ -9,6 +9,7 @@ using Content.Shared.Actions;
using Content.Shared.Actions.ActionTypes;
using Content.Shared.Damage;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Mobs.Systems;
using Content.Shared.Polymorph;
using Robust.Server.Containers;
using Robust.Shared.Containers;
@@ -29,6 +30,7 @@ namespace Content.Server.Polymorph.Systems
[Dependency] private readonly ServerInventorySystem _inventory = default!;
[Dependency] private readonly SharedHandsSystem _sharedHands = default!;
[Dependency] private readonly DamageableSystem _damageable = default!;
[Dependency] private readonly MobThresholdSystem _mobThresholdSystem = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly HumanoidSystem _humanoid = default!;
[Dependency] private readonly ContainerSystem _container = default!;
@@ -114,7 +116,7 @@ namespace Content.Server.Polymorph.Systems
//Transfers all damage from the original to the new one
if (proto.TransferDamage &&
TryComp<DamageableComponent>(child, out var damageParent) &&
_damageable.GetScaledDamage(target, child, out var damage) &&
_mobThresholdSystem.GetScaledDamage(target, child, out var damage) &&
damage != null)
{
_damageable.SetDamage(damageParent, damage);