From 254fd23fdb8349f3b3e3b6d828c672179a3d73ae Mon Sep 17 00:00:00 2001 From: protocol_1903 <67478786+protocol-1903@users.noreply.github.com> Date: Sun, 15 Feb 2026 13:00:12 -0700 Subject: [PATCH] Added META:hide() and META:unhide() to hide/unhide the prototype from any in-game browser and factoriopedia --- changelog.txt | 1 + lib/metas/metas.lua | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/changelog.txt b/changelog.txt index 038e726..74f80b3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -4,6 +4,7 @@ Date: ??? Changes: - Fix load failure with zh-cn locale. Resolves https://github.com/pyanodon/pybugreports/issues/1347 - Added py.spoilage_enabled() which checks for the feature flag and mod setting + - Added META:hide() and META:unhide() to hide/unhide the prototype from any in-game browser and factoriopedia --------------------------------------------------------------------------------------------------- Version: 3.0.41 Date: 2025-12-28 diff --git a/lib/metas/metas.lua b/lib/metas/metas.lua index ff889e3..528262f 100644 --- a/lib/metas/metas.lua +++ b/lib/metas/metas.lua @@ -15,6 +15,8 @@ local lib = { ---@field public set_fields fun(self: data.AnyPrototype, fields: table): data.AnyPrototype ---@field public set fun(self: data.AnyPrototype, field: string, value: any): data.AnyPrototype ---@field public delete fun(self: data.AnyPrototype) +---@field public hide fun(self: data.AnyPrototype): data.AnyPrototype +---@field public unhide fun(self: data.AnyPrototype): data.AnyPrototype for _, meta in pairs(lib) do meta.copy = function(self, new_name) @@ -50,6 +52,18 @@ for _, meta in pairs(lib) do meta.delete = function(self) data.raw[self.type][self.name] = nil end + + meta.hide = function(self) + self.hidden = true + self.hidden_in_factoriopedia = true + return self + end + + meta.unhide = function(self) + self.hidden = nil + self.hidden_in_factoriopedia = nil + return self + end end local metas = {}