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

@@ -3,12 +3,12 @@ using System.Linq;
using Content.Server.GameTicking.Presets;
using Content.Server.GameTicking.Rules;
using Content.Server.Ghost.Components;
using Content.Server.MobState;
using Content.Shared.CCVar;
using Content.Shared.Damage;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Database;
using Content.Shared.MobState.Components;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Robust.Server.Player;
namespace Content.Server.GameTicking
@@ -17,6 +17,8 @@ namespace Content.Server.GameTicking
{
public const float PresetFailedCooldownIncrease = 30f;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
public GamePresetPrototype? Preset { get; private set; }
private bool StartPreset(IPlayerSession[] origReadyPlayers, bool force)
@@ -193,7 +195,7 @@ namespace Content.Server.GameTicking
if (canReturnGlobal && TryComp(playerEntity, out MobStateComponent? mobState))
{
if (_mobState.IsCritical(playerEntity.Value, mobState))
if (_mobStateSystem.IsCritical(playerEntity.Value, mobState))
{
canReturn = true;