local y={}y.Settings={Enabled=true;Sensitivity=1;MusicResponse=1}y.Config={DefaultHeight=1,HeightScale=10,BaseDuration=.3,ExtraDurationScale=50}local K=require(script.Parent.Parent.Modules)function y.Trigger(s,y)s:Stop()if y and y.Settings then if y.Settings.Enabled~=nil then s.Settings.Enabled=y.Settings.Enabled end if y.Settings.Sensitivity~=nil then s.Settings.Sensitivity=y.Settings.Sensitivity end if y.Settings.MusicResponse~=nil then s.Settings.MusicResponse=y.Settings.MusicResponse end end if not s.Settings.Enabled then return end local I=y.MasVibrateSettings if not I then return end local V=y.Height or s.Config.DefaultHeight local G=((V/s.Config.HeightScale)*s.Settings.Sensitivity)*s.Settings.MusicResponse local b=math.clamp(G,I.MinIntensity,I.MaxIntensity)local R=s.Config.BaseDuration+V/s.Config.ExtraDurationScale local m=y.MotorChoice or"\098\111\116\104"K:Apply(b,R,I,m,"\083\111\117\110\100")end function y.Stop(y)K:Stop("\083\111\117\110\100")end return y
local PluginSound = {}

PluginSound.Settings = {
    Enabled = true,
    Sensitivity = 1,
    MusicResponse = 1
}

PluginSound.Config = {
    DefaultHeight = 1,
    HeightScale = 10,
    BaseDuration = 0.3,
    ExtraDurationScale = 50
}

local Modules = require(script.Parent.Parent.Modules)

function PluginSound:Trigger(pluginData)
    self:Stop()

    if pluginData and pluginData.Settings then
        if pluginData.Settings.Enabled ~= nil then
            self.Settings.Enabled = pluginData.Settings.Enabled
        end
        if pluginData.Settings.Sensitivity ~= nil then
            self.Settings.Sensitivity = pluginData.Settings.Sensitivity
        end
        if pluginData.Settings.MusicResponse ~= nil then
            self.Settings.MusicResponse = pluginData.Settings.MusicResponse
        end
    end

    if not self.Settings.Enabled then
        return
    end

    local allSettings = pluginData.MasVibrateSettings
    if not allSettings then
        return
    end

    local height = pluginData.Height or self.Config.DefaultHeight
    local baseIntensity = (height / self.Config.HeightScale)
        * self.Settings.Sensitivity
        * self.Settings.MusicResponse
    local intensity = math.clamp(baseIntensity, allSettings.MinIntensity, allSettings.MaxIntensity)
    local duration = self.Config.BaseDuration + (height / self.Config.ExtraDurationScale)
    local motorChoice = pluginData.MotorChoice or "both"

    Modules:Apply(intensity, duration, allSettings, motorChoice, "Sound")
end

function PluginSound:Stop()
    Modules:Stop("Sound")
end

return PluginSound