Healthy Hat bug

I noticed that if I wore the healthy hat, took a health pickup and then removed the healthy hat I had more HP than the max HP (220/200). I don’t know if it is addressed later and I’m not sure that this is the best way since I haven’t comprehended the Inventory system, but this is how I fixed it in Health.cs:

        Equipment equipment;

        private void Awake()
        {
            healthPoints = new LazyValue<float>(GetInitialHealth);
            equipment = GetComponent<Equipment>();
            if (equipment)
            {
                equipment.equipmentUpdated += UpdateHealth;
            }
        }

        private void UpdateHealth()
        {
            if (healthPoints.value > GetMaxHealthPoints())
            {
                healthPoints.value = GetMaxHealthPoints();
            }
        }
1 Like

You’re quite right, we don’t address this one directly. That’s pretty much what I do as well.

1 Like

I see, thanks :slightly_smiling_face:

Privacy & Terms