Jump to content

Recommended Posts

I would like to make a mod that, every time you eat, briefly displays the food's hunger/health/sanity values. (I want to be able to figure out exact values more easily, but the Display Food Values mod seems a bit too easy for me.) Any suggestions on where to begin? Is there an existing mod that performs some action upon eating that I could examine for ideas?

-- inst is the player instance
-- use GetPlayer() if you don't already have a reference to it
inst:ListenForEvent("oneat", function(inst, data)
    -- data.food contains the food's instance

    -- Example on how to get stats
    local hunger = data.food.components.edible:GetHunger(inst)
    -- Check the the edible component for more functions
end)

 

Edited by Blueberrys

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...