show-buildable/sb-util.lua

Sat, 05 Jul 2025 00:35:41 +0300

author
Teemu Piippo <teemu.s.piippo@gmail.com>
date
Sat, 05 Jul 2025 00:35:41 +0300
changeset 14
c26d4dd2af9b
permissions
-rw-r--r--

Add show-buildable mod

entity_categories =
{
	"container",
	"storage-tank",
	"transport-belt",
	"underground-belt",
	"splitter",
	"loader",
	"inserter",
	"electric-pole",
	"pipe",
	"pipe-to-ground",
	"pump",
	"straight-rail",
	"half-diagonal-rail",
	"curved-rail-a",
	"curved-rail-b",
	"elevated-straight-rail",
	"elevated-half-diagonal-rail",
	"elevated-curved-rail-a",
	"elevated-curved-rail-b",
	"legacy-straight-rail",
	"legacy-curved-rail",
	"rail-ramp",
	"rail-support",
	"train-stop",
	"rail-signal",
	"rail-chain-signal",
	"logistic-container",
	"roboport",
	"lamp",
	"arithmetic-combinator",
	"decider-combinator",
	"selector-combinator",
	"constant-combinator",
	"power-switch",
	"programmable-speaker",
	"display-panel",
	"boiler",
	"generator",
	"fusion-reactor",
	"fusion-generator",
	"mining-drill",
	"offshore-pump",
	"furnace",
	"assembling-machine",
	"agricultural-tower",
	"lab",
	"lightning-attractor",
	"reactor",
	"beacon",
	"rocket-silo",
	"cargo-landing-pad",
	"cargo-bay",
	"asteroid-collector",
	"thruster",
	"wall",
	"gate",
	"radar",
	"land-mine",
	"ammo-turret",
	"electric-turret",
	"fluid-turret",
	"artillery-turret",
	"plant",
	"simple-entity-with-force",
	"simple-entity-with-owner",
	"electric-energy-interface",
	"linked-container",
	"proxy-container",
	"heat-interface",
	"heat-pipe",
	"lane-splitter",
	"linked-belt",
	"valve",
	"burner-generator",
	"cargo-pod",
	"temporary-container",
	"asteroid",
	"turret",
	"unit-spawner",
	"spider-unit",
	"character",
	"simple-entity",
	"corpse",
	"rail-remnants",
	"explosion",
	"particle-source",
	"fire",
	"sticker",
	"stream",
	"artillery-flare",
	"artillery-projectile",
	"projectile",
	"segment",
	"spider-leg",
	"beam",
	"character-corpse",
	"speech-bubble",
	"loader-1x1",
	"rocket-silo-rocket",
	"market",
	"solar-panel",
}

---@param entity data.EntityPrototype|LuaEntityPrototype
---@param needle_flag EntityPrototypeFlag
function has_flag(entity, needle_flag)
	for _, flag in pairs(entity.flags or {})
	do
		if flag == needle_flag
		then
			return true
		end
	end
	return false
end

mercurial