mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
Remove bleeds/breaks after 30 mins offline
This commit is contained in:
parent
1a9dc1ea2b
commit
747510e5d2
@ -535,17 +535,17 @@ export class GameController
|
|||||||
let hpRegenPerHour = 456.6;
|
let hpRegenPerHour = 456.6;
|
||||||
|
|
||||||
// Set new values, whatever is smallest
|
// Set new values, whatever is smallest
|
||||||
energyRegenPerHour += pmcProfile.Bonuses.filter((x) => x.type === BonusType.ENERGY_REGENERATION).reduce(
|
energyRegenPerHour += pmcProfile.Bonuses.filter((bonus) => bonus.type === BonusType.ENERGY_REGENERATION)
|
||||||
(sum, curr) => sum + curr.value,
|
|
||||||
0,
|
|
||||||
);
|
|
||||||
hydrationRegenPerHour += pmcProfile.Bonuses.filter((x) => x.type === BonusType.HYDRATION_REGENERATION)
|
|
||||||
.reduce((sum, curr) => sum + curr.value, 0);
|
.reduce((sum, curr) => sum + curr.value, 0);
|
||||||
hpRegenPerHour += pmcProfile.Bonuses.filter((x) => x.type === BonusType.HEALTH_REGENERATION).reduce(
|
hydrationRegenPerHour += pmcProfile.Bonuses.filter((bonus) =>
|
||||||
|
bonus.type === BonusType.HYDRATION_REGENERATION
|
||||||
|
).reduce((sum, curr) => sum + curr.value, 0);
|
||||||
|
hpRegenPerHour += pmcProfile.Bonuses.filter((bonus) => bonus.type === BonusType.HEALTH_REGENERATION).reduce(
|
||||||
(sum, curr) => sum + curr.value,
|
(sum, curr) => sum + curr.value,
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Player has energy deficit
|
||||||
if (pmcProfile.Health.Energy.Current !== pmcProfile.Health.Energy.Maximum)
|
if (pmcProfile.Health.Energy.Current !== pmcProfile.Health.Energy.Maximum)
|
||||||
{
|
{
|
||||||
// Set new value, whatever is smallest
|
// Set new value, whatever is smallest
|
||||||
@ -556,6 +556,7 @@ export class GameController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Player has energy deficit
|
||||||
if (pmcProfile.Health.Hydration.Current !== pmcProfile.Health.Hydration.Maximum)
|
if (pmcProfile.Health.Hydration.Current !== pmcProfile.Health.Hydration.Maximum)
|
||||||
{
|
{
|
||||||
pmcProfile.Health.Hydration.Current += Math.round(hydrationRegenPerHour * (diffSeconds / 3600));
|
pmcProfile.Health.Hydration.Current += Math.round(hydrationRegenPerHour * (diffSeconds / 3600));
|
||||||
@ -589,6 +590,12 @@ export class GameController
|
|||||||
// Skip effects below 1, .e.g. bleeds at -1
|
// Skip effects below 1, .e.g. bleeds at -1
|
||||||
if (bodyPart.Effects[effectKey].Time < 1)
|
if (bodyPart.Effects[effectKey].Time < 1)
|
||||||
{
|
{
|
||||||
|
// More than 30 mins has passed
|
||||||
|
if (diffSeconds > 1800)
|
||||||
|
{
|
||||||
|
delete bodyPart.Effects[effectKey];
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user