pOffset = GetFloatParam("offset", 0)

function init()
	joint = FindJoint()
	mi, ma = GetJointLimits(joint)
	trigger = FindTrigger("pusheractive", true)
	timer = pOffset
	extend = 0
	
end

function tick(dt)
	if IsPointInTrigger(trigger, GetPlayerEyeTransform().pos) then
		if timer > 0 then
			extend = 0
			timer = timer - dt
		else
			extend = extend + dt
			if extend > 0.7 then
				timer = 5.0
			end
		end
	else
		extend = 0
	end
	if extend == 0 then
		SetJointMotorTarget(joint, ma, 3, 2000)
	else
		SetJointMotorTarget(joint, mi, 3, 2000)
	end
end


