--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/show-buildable/sb-util.lua Sat Jul 05 00:35:41 2025 +0300 @@ -0,0 +1,117 @@ +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 \ No newline at end of file