local module = {}

function module.new(this,speaker,context)
	this.main = _G.GetInstance(speaker,"Main")
	this.tts = _G.GetInstance(this.main,"AudioTextToSpeech")
end

function module.replicate(this,speaker,context,value)
	this.tts.Text = tostring(value or "") or ""
	if _G.IsClient then
		if this.tts.IsPlaying then return end
		this.tts:Play()
	end
end

module.messages = {
	default = function(this,speaker,context,value)
		context.replicate(this,speaker,module,value)
	end
}

module.manifest = {
	"Speaker"
}

return module