diff --git a/Content.Server/Vampire/VampireSystem.Objectives.cs b/Content.Server/Vampire/VampireSystem.Objectives.cs index 3e94fb6494c..630114e5e34 100644 --- a/Content.Server/Vampire/VampireSystem.Objectives.cs +++ b/Content.Server/Vampire/VampireSystem.Objectives.cs @@ -12,15 +12,21 @@ public sealed partial class VampireSystem private void InitializeObjectives() { - SubscribeLocalEvent(OnBloodDrainGetProgress); } private void OnBloodDrainGetProgress(EntityUid uid, BloodDrainConditionComponent comp, ref ObjectiveGetProgressEvent args) { var target = _number.GetTarget(uid); - if (target != 0) - args.Progress = MathF.Min(comp.BloodDranked / target, 1f); - else args.Progress = 1f; + + if (target > 0) + { + args.Progress = Math.Clamp(comp.BloodDranked / target, 0f, 1f); + } + else + { + Logger.Warning($"Target for blood drain objective is 0 or invalid for entity {uid}. Setting progress to 1."); + args.Progress = 1f; + } } } \ No newline at end of file diff --git a/Resources/Prototypes/Reagents/toxins.yml b/Resources/Prototypes/Reagents/toxins.yml index 5f8d98decee..15f80a171a2 100644 --- a/Resources/Prototypes/Reagents/toxins.yml +++ b/Resources/Prototypes/Reagents/toxins.yml @@ -491,11 +491,17 @@ - !type:OrganType type: Animal shouldHave: false + - !type:OrganType + type: Vampire + shouldHave: false - !type:HealthChange conditions: - !type:OrganType type: Animal shouldHave: false + - !type:OrganType + type: Vampire + shouldHave: false damage: types: Poison: 1 @@ -504,6 +510,9 @@ - !type:OrganType type: Animal shouldHave: true + - !type:OrganType + type: Vampire + shouldHave: true reagent: Protein amount: 0.5