Jump to content

Can't restore hunger while invincible


Bumber64
  • Pending

The "hunger" component skips all hunger deltas if "ignore_invincible" is false and the inst is invincible.

This creates a problem if someone mods a creature to be invincible (extra-adorable lavae in my case,) and the creature had low hunger before becoming invincible. The creature will exhibit hungry behaviors and be able to eat, but never be satisfied. (The lavae will be caught in an endless loop of trying to burn things.)

Invincibility should only prevent negative hunger deltas.


Steps to Reproduce

Modding or console commands




User Feedback


If you only want invincibility to apply to health, you can instead use externalabsorbmodifiers if it's temporary or remove the health component if it's permanent.

inst.components.health.externalabsorbmodifiers:SetModifier(inst, 1.0, "invincible")
--- or
inst:RemoveComponent("health")

 

Otherwise, to set hunger you should do:

inst.components.hunger:SetPercent(1.0)

 

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...