Just the types? Indeed very easy. Just fucking hardcode the list, it almost never changes anyway. Every"smart" solution you try will just be a buggy mess that randomly fails on modded entities that are different than you "expect", and nobody will bother sending you bug reports about it.
Code: Select all
local hardcoded_classes = {
--A *HARDCODED* classification of all known prototype types
--
--Current Version: base-0.17.53
--
item = { --ITEMS
'item', 'armor' , 'mining-tool' , 'item-with-tags' , 'item-with-inventory' ,
'ammo', 'module' , 'repair-tool' , 'selection-tool' , 'item-with-entity-data',
'gun' , 'capsule' , 'rail-planner' , 'item-with-label' , 'copy-paste-tool' ,
'tool', 'blueprint', 'blueprint-book', 'deconstruction-item', 'upgrade-item' },
building = { --ENTITIES (BUILDINGS)
'lab' , 'inserter' , 'solar-panel' , 'rail-chain-signal' ,
'gate' , 'roboport' , 'fluid-turret' , 'assembling-machine' ,
'lamp' , 'splitter' , 'mining-drill' , 'decider-combinator' ,
'pipe' , 'container' , 'power-switch' , 'infinity-container' ,
'pump' , 'generator' , 'storage-tank' , 'logistic-container' ,
'wall' , 'heat-pipe' , 'electric-pole' , 'constant-combinator' ,
'radar' , 'land-mine' , 'offshore-pump' , 'programmable-speaker' ,
'beacon' , 'train-stop' , 'simple-entity' , 'arithmetic-combinator' ,
'boiler' , 'accumulator', 'straight-rail' , 'simple-entity-with-force' ,
'loader' , 'ammo-turret', 'pipe-to-ground' , 'simple-entity-with-owner' ,
'market' , 'curved-rail', 'transport-belt' , 'electric-energy-interface',
'turret' , 'player-port', 'electric-turret' , 'heat-interface' ,
'furnace', 'rail-signal', 'artillery-turret', 'infinity-pipe' ,
'reactor', 'rocket-silo', 'underground-belt' },
robot = { --ENTITY (ROBOTS)
'combat-robot', 'logistic-robot', 'construction-robot' },
special_entity = { --ENTITIES (SPECIAL)
'beam' , 'stream' , 'entity-ghost' , 'item-request-proxy' ,
'fire' , 'sticker' , 'unit-spawner' , 'rocket-silo-rocket' ,
'fish' , 'particle' , 'leaf-particle' , 'smoke-with-trigger' ,
'unit' , 'explosion' , 'rail-remnants' , 'artillery-projectile' ,
'arrow' , 'projectile' , 'trivial-smoke' , 'flame-thrower-explosion' ,
'smoke' , 'tile-ghost' , 'artillery-flare' , 'rocket-silo-rocket-shadow' ,
'corpse', 'flying-text', 'particle-source' , 'deconstructible-tile-proxy',
'character', 'item-entity', 'character-corpse' },
map_entity = { --ENTITIES (MAP)
'cliff', 'resource', 'tree', 'tile', 'decorative', 'optimized-decorative' },