From e7ebdab3f02f452cc55e9274a0c34550ac2227a0 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 24 Oct 2024 14:28:48 +0100 Subject: [PATCH] Improved offraidHeal to not show unnecessary warnings --- project/src/controllers/HealthController.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/project/src/controllers/HealthController.ts b/project/src/controllers/HealthController.ts index ce28605b..8345ad12 100644 --- a/project/src/controllers/HealthController.ts +++ b/project/src/controllers/HealthController.ts @@ -81,7 +81,7 @@ export class HealthController { const healItemEffectDetails = healingItemDbDetails[1]._props.effects_damage; const bodyPartToHeal: IBodyPartHealth = pmcData.Health.BodyParts[request.part]; if (!bodyPartToHeal) { - this.logger.warning(`Tried to heal a non-existent body part: ${request.part}`); + this.logger.warning(`Player: ${sessionID} Tried to heal a non-existent body part: ${request.part}`); return output; } @@ -91,16 +91,11 @@ export class HealthController { // Check if healing item removes negative effects const itemRemovesEffects = Object.keys(healingItemDbDetails[1]._props.effects_damage).length > 0; - if (itemRemovesEffects) { - // Check body parts effects against what the healing item can remove - if (!bodyPartToHeal.Effects) { - this.logger.warning(`Tried to remove effects from body part: ${request.part} without effects`); - - return output; - } + if (itemRemovesEffects && bodyPartToHeal.Effects) { + // Can remove effects and limb has effects to remove const effectsOnBodyPart = Object.keys(bodyPartToHeal.Effects); - for (const effectKey of effectsOnBodyPart) { + // Check if healing item removes the effect on limb const matchingEffectFromHealingItem = healItemEffectDetails[effectKey]; if (!matchingEffectFromHealingItem) { // Healing item doesnt have matching effect, it doesnt remove the effect