Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix HealthContest Crash #954

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Content.Shared/Contests/ContestsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Content.Shared.CCVar;
using Content.Shared.Damage;
using Content.Shared.Damage.Components;
using Content.Shared.Mobs.Components;
using Content.Shared.Mobs.Systems;
using Content.Shared.Mood;
using Robust.Shared.Configuration;
Expand Down Expand Up @@ -226,7 +227,8 @@ public float HealthContest(EntityUid performer, bool bypassClamp = false, float
if (!_cfg.GetCVar(CCVars.DoContestsSystem)
|| !_cfg.GetCVar(CCVars.DoHealthContests)
|| !TryComp<DamageableComponent>(performer, out var damage)
|| !_mobThreshold.TryGetThresholdForState(performer, Mobs.MobState.Critical, out var threshold))
|| !TryComp<MobThresholdsComponent>(performer, out var thresholdsComponent)
|| !_mobThreshold.TryGetThresholdForState(performer, Mobs.MobState.Critical, out var threshold, thresholdsComponent))
return 1f;

return ContestClamp(ContestClampOverride(bypassClamp)
Expand All @@ -247,8 +249,10 @@ public float HealthContest(EntityUid performer, EntityUid target, bool bypassCla
|| !_cfg.GetCVar(CCVars.DoHealthContests)
|| !TryComp<DamageableComponent>(performer, out var perfDamage)
|| !TryComp<DamageableComponent>(target, out var targetDamage)
|| !_mobThreshold.TryGetThresholdForState(performer, Mobs.MobState.Critical, out var perfThreshold)
|| !_mobThreshold.TryGetThresholdForState(target, Mobs.MobState.Critical, out var targetThreshold))
|| !TryComp<MobThresholdsComponent>(performer, out var perfThresholdComp)
|| !TryComp<MobThresholdsComponent>(target, out var targetThresholdComp)
|| !_mobThreshold.TryGetThresholdForState(performer, Mobs.MobState.Critical, out var perfThreshold, perfThresholdComp)
|| !_mobThreshold.TryGetThresholdForState(target, Mobs.MobState.Critical, out var targetThreshold, targetThresholdComp))
return 1f;

return ContestClamp(ContestClampOverride(bypassClamp)
Expand Down
Loading