isOpenWagon = GetBoolParam("isOpen", true)

function init()
	vehicle = FindVehicle()
	body = FindBody()
	joint = FindJoint("EscapeJoint")
	SoundOpen = LoadLoop("MOD/sound/horse_pair_vehicle-drive1.ogg")
	SoundClose = LoadLoop("MOD/sound/horse_pair_vehicle-drive0.ogg")
end

function update()
	if VecLength(GetBodyVelocity(body)) > 0.2 then
		if isOpenWagon then
			PlayLoop(SoundOpen, GetBodyTransform(body).pos)
		else
			PlayLoop(SoundClose, GetBodyTransform(body).pos)
		end
	end
end
