diff --git a/Tools/Material.lua b/Tools/Material.lua index e010b69..3a0b775 100644 --- a/Tools/Material.lua +++ b/Tools/Material.lua @@ -29,7 +29,10 @@ local MaterialTool = { } MaterialTool.ManualText = [[Material Tool 🛠 -Lets you change the material, transparency, and reflectance of parts.]] +Lets you change the material, transparency, and reflectance of parts. + +TIP: Press R while hovering over a part to copy its material properties.]] + -- Container for temporary connections (disconnected automatically) local Connections = {}; @@ -39,6 +42,7 @@ function MaterialTool:Equip() -- Start up our interface self:ShowUI() + BindShortcutKeys() end; @@ -85,6 +89,19 @@ local Materials = { [Enum.Material.Wood] = 'Wood'; [Enum.Material.WoodPlanks] = 'Wood Planks'; [Enum.Material.Glass] = 'Glass'; + [Enum.Material.Asphalt] = 'Asphalt'; + [Enum.Material.Basalt] = 'Basalt'; + [Enum.Material.CrackedLava] = 'Cracked Lava'; + [Enum.Material.Glacier] = 'Glacier'; + [Enum.Material.Ground] = 'Ground'; + [Enum.Material.LeafyGrass] = 'Leafy Grass'; + [Enum.Material.Limestone] = 'Limestone'; + [Enum.Material.Mud] = 'Mud'; + [Enum.Material.Pavement] = 'Pavement'; + [Enum.Material.Rock] = 'Rock'; + [Enum.Material.Salt] = 'Salt'; + [Enum.Material.Sandstone] = 'Sandstone'; + [Enum.Material.Snow] = 'Snow'; }; function MaterialTool:ShowUI() @@ -180,6 +197,42 @@ function SyncInputToProperty(Property, Input) end; +function BindShortcutKeys() + -- Enables useful shortcut keys for this tool + + -- Track user input while this tool is equipped + table.insert(Connections, UserInputService.InputBegan:Connect(function (InputInfo, GameProcessedEvent) + -- Make sure this is an intentional event + if GameProcessedEvent then + return; + end; + + -- Make sure this input is a key press + if InputInfo.UserInputType ~= Enum.UserInputType.Keyboard then + return; + end; + + -- Make sure it wasn't pressed while typing + if UserInputService:GetFocusedTextBox() then + return; + end; + + -- Check if the enter key was pressed + if InputInfo.KeyCode == Enum.KeyCode.R then + + -- Set selection's properties to that of the target (if any) + if Core.Mouse.Target then + SetProperty('Material', Core.Mouse.Target.Material) + SetProperty('Transparency', Core.Mouse.Target.Transparency) + SetProperty('Reflectance', Core.Mouse.Target.Reflectance) + end; + + end; + + end)); + +end; + function SetProperty(Property, Value) -- Make sure the given value is valid @@ -379,4 +432,4 @@ function RegisterChange() end; -- Return the tool -return MaterialTool; \ No newline at end of file +return MaterialTool;