Fixed issue with water bottles having no upd object in rare cases killing client

This commit is contained in:
Dev 2024-04-28 22:39:17 +01:00
parent ddd5d69eda
commit b9973e609f

View File

@ -127,6 +127,11 @@ export class HealthController
const consumedItemMaxResource = this.itemHelper.getItem(itemToConsume._tpl)[1]._props.MaxResource;
if (consumedItemMaxResource > 1)
{
if (!itemToConsume.upd)
{
itemToConsume.upd = {};
}
if (itemToConsume.upd.FoodDrink === undefined)
{
itemToConsume.upd.FoodDrink = { HpPercent: consumedItemMaxResource - request.count };