Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinary1 committed Nov 2, 2024
1 parent 3ca580c commit 7531709
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Content.Server/Vampire/VampireSystem.Objectives.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,21 @@ public sealed partial class VampireSystem

private void InitializeObjectives()
{

SubscribeLocalEvent<BloodDrainConditionComponent, ObjectiveGetProgressEvent>(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;
}
}
}
9 changes: 9 additions & 0 deletions Resources/Prototypes/Reagents/toxins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -504,6 +510,9 @@
- !type:OrganType
type: Animal
shouldHave: true
- !type:OrganType
type: Vampire
shouldHave: true
reagent: Protein
amount: 0.5

Expand Down

0 comments on commit 7531709

Please sign in to comment.