-- This Source Code Form is subject to the terms of the bCDDL, v. 1.1.
-- If a copy of the bCDDL was not distributed with this
-- file, You can obtain one at http://beamng.com/bCDDL-1.1.txt

local M = {}

local function onReset()
    electrics.values['tilt'] = 0
    electrics.values['tilt_input'] = 0
    electrics.values['lift'] = 0
    electrics.values['lift_input'] = 0
    electrics.values['claw_lift'] = 0
    electrics.values['claw_lift_input'] = 0
end


local function updateGFX(dt)
    electrics.values['tilt'] = math.min(1, math.max(-0.5, (electrics.values['tilt'] + electrics.values['tilt_input'] * dt * 1)))
    electrics.values['lift'] = math.min(1, math.max(-0.5, (electrics.values['lift'] + electrics.values['lift_input'] * dt * 1)))
    electrics.values['claw_lift'] = math.min(1, math.max(-0.5, (electrics.values['claw_lift'] - electrics.values['claw_lift_input'] * dt * 0.6)))
end



-- public interface
M.onInit    = onReset
M.onReset   = onReset
M.updateGFX = updateGFX

return M
