local Q=game:GetService("\082\117\110\083\101\114\118\105\099\101")local R=require(script.Parent.Signal)local w=function() end local S={}S.__index=S function S.new()return setmetatable({_onStep=R.new();_onStart=R.new();_onComplete=R.new()},S)end function S.onStep(R,Q)return R._onStep:connect(Q)end function S.onStart(R,Q)return R._onStart:connect(Q)end function S.onComplete(R,Q)return R._onComplete:connect(Q)end function S.start(R)if not R._connection then R._connection=Q.RenderStepped:Connect(function(Q)R:step(Q)end)end end function S.stop(Q)if Q._connection then Q._connection:Disconnect()Q._connection=nil end end S.destroy=S.stop S.step=w S.getValue=w S.setGoal=w function S.__tostring(Q)return"\077\111\116\111\114"end return S
local RunService = game:GetService("RunService")

local Signal = require(script.Parent.Signal)

local noop = function() end

local BaseMotor = {}
BaseMotor.__index = BaseMotor

function BaseMotor.new()
	return setmetatable({
		_onStep = Signal.new(),
		_onStart = Signal.new(),
		_onComplete = Signal.new(),
	}, BaseMotor)
end

function BaseMotor:onStep(handler)
	return self._onStep:connect(handler)
end

function BaseMotor:onStart(handler)
	return self._onStart:connect(handler)
end

function BaseMotor:onComplete(handler)
	return self._onComplete:connect(handler)
end

function BaseMotor:start()
	if not self._connection then
		self._connection = RunService.RenderStepped:Connect(function(deltaTime)
			self:step(deltaTime)
		end)
	end
end

function BaseMotor:stop()
	if self._connection then
		self._connection:Disconnect()
		self._connection = nil
	end
end

BaseMotor.destroy = BaseMotor.stop

BaseMotor.step = noop
BaseMotor.getValue = noop
BaseMotor.setGoal = noop

function BaseMotor:__tostring()
	return "Motor"
end

return BaseMotor
