Barotrauma

Barotrauma

Barotrauma Workshop
You can build your own submarines and monsters with in-game editors and share your creations with other players. Imagine and experiment.
Foxxie 29 Jun, 2024 @ 6:01am
I notice that fabricator doesn't have a button that makes "show only craftable items", so I tried to make a mod but it didn't work. Is someone can help?
Filelist = <contentpackage name="Custom Crafting Filter" modversion="1.0" corepackage="False" gameversion="1.5.9.1">
<Text file="%ModDir%/scripts.lua"/>
</contentpackage>

Script = Hook.Add("fabricatorcreated", "createCraftableItemsButton", function(fabricator)
local button = GUIButton:new(RectTransform(Vector2(0.1, 0.9), fabricator.RectTransform, Anchor.BottomLeft))
button.Text = "Show Craftable Items"

button.OnClicked = function()
local craftableItems = {}
for _, itemPrefab in ipairs(ItemPrefab.Prefabs) do
if itemPrefab:CanBeFabricated(fabricator) then
table.insert(craftableItems, itemPrefab)
end
end

fabricator.FilteredItemPrefabs = craftableItems
fabricator:UpdateFabricatorUI()
return true
end

fabricator.GUI.AddChild(button)
end)

**I allow to copy my idea, it would be very useful mod**