local z=game:GetService("\082\117\110\083\101\114\118\105\099\101")local a=require(script.Parent.Signal)local h=function() end local n={}n.__index=n function n.new()return setmetatable({_onStep=a.new();_onStart=a.new();_onComplete=a.new()},n)end function n.onStep(a,z)return a._onStep:connect(z)end function n.onStart(a,z)return a._onStart:connect(z)end function n.onComplete(a,z)return a._onComplete:connect(z)end function n.start(a)if not a._connection then a._connection=z.RenderStepped:Connect(function(z)a:step(z)end)end end function n.stop(z)if z._connection then z._connection:Disconnect()z._connection=nil end end n.destroy=n.stop n.step=h n.getValue=h n.setGoal=h function n.__tostring(z)return"\077\111\116\111\114"end return n
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
