local G={}function DecorateTool.Equip()ShowUI()end function DecorateTool.Unequip()HideUI()ClearConnections()end function ClearConnections()for l,E in pairs(G)do E:disconnect()G[l]=nil end end function ShowUI()if DecorateTool.UI then DecorateTool.UI.Visible=true UIUpdater=Support.ScheduleRecurringTask(UpdateUI,.1)return end DecorateTool.UI=Core.Tool.Interfaces.BTDecorateToolGUI:Clone()DecorateTool.UI.Parent=Core.UI DecorateTool.UI.Visible=true EnableOptionsUI(DecorateTool.UI.Smoke)EnableOptionsUI(DecorateTool.UI.Fire)EnableOptionsUI(DecorateTool.UI.Sparkles)UIUpdater=Support.ScheduleRecurringTask(UpdateUI,.1)end
-- Container for temporary connections (disconnected automatically)
local Connections = {}

function DecorateTool.Equip()
	-- Enables the tool's equipped functionality

	-- Start up our interface
	ShowUI()
end

function DecorateTool.Unequip()
	-- Disables the tool's equipped functionality

	-- Clear unnecessary resources
	HideUI()
	ClearConnections()
end

function ClearConnections()
	-- Clears out temporary connections

	for ConnectionKey, Connection in pairs(Connections) do
		Connection:disconnect()
		Connections[ConnectionKey] = nil
	end
end

function ShowUI()
	-- Creates and reveals the UI

	-- Reveal UI if already created
	if DecorateTool.UI then
		-- Reveal the UI
		DecorateTool.UI.Visible = true

		-- Update the UI every 0.1 seconds
		UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1)

		-- Skip UI creation
		return
	end

	-- Create the UI
	DecorateTool.UI = Core.Tool.Interfaces.BTDecorateToolGUI:Clone()
	DecorateTool.UI.Parent = Core.UI
	DecorateTool.UI.Visible = true

	-- Enable each decoration type UI
	EnableOptionsUI(DecorateTool.UI.Smoke)
	EnableOptionsUI(DecorateTool.UI.Fire)
	EnableOptionsUI(DecorateTool.UI.Sparkles)

	-- Update the UI every 0.1 seconds
	UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1)
end
