local regenLocked = false

function onEvent(name, value1, value2)
    if name == 'noHealthRegen' then
        if value1 == 'on' then
            if getProperty('health') > 1 then
                setProperty('health', 1) -- Set to 50%
            end
            regenLocked = true
        elseif value1 == 'off' then
            regenLocked = false
        end
    end
end

function goodNoteHit(id, direction, noteType, isSustainNote)
    if regenLocked then
        -- Cancel health gain from hitting notes
        setProperty('health', getProperty('health') - 0.023) -- Remove approx. default gain
    end
end
