Jump to content

Recommended Posts

I plan to have a character who loses hunger when working but gains sanity when working. This is what I tried and it didn't work.
(all of the hunger stuff works fine, just the sanity part doesn't work)
 

local function OnWork(inst, data)
    local burnrate = inst.components.hunger.burnratemodifiers:Get()

    if
        data.action.action == ACTIONS.CHOP
        or data.action.action == ACTIONS.MINE
        or data.action.action == ACTIONS.PICK
        or data.action.action == ACTIONS.HAMMER
        or data.action.action == ACTIONS.DIG
        or data.action.action == ACTIONS.TILL
    then
        if inst._cdtask == nil then
            inst._cdtask = inst:DoTaskInTime(0.3, OnCooldown)
            inst.components.hunger:DoDelta(-1 * burnrate, true)
            inst.components.sanity:DoDelta(1)
        end
    end
end

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