diff --git a/scripts/scanner/backends/single-entity.lua b/scripts/scanner/backends/single-entity.lua index 902cf3ba..17dc9036 100644 --- a/scripts/scanner/backends/single-entity.lua +++ b/scripts/scanner/backends/single-entity.lua @@ -2,6 +2,7 @@ We have to declare categorization and subcategorization functions for everything by declaring our backends. Simple already does everything else for us. ]] +local BuildingTools = require("scripts.building-tools") local decl = require("scripts.scanner.backends.simple").declare_simple_backend local functionize = require("scripts.functools").functionize local Info = require("scripts.fa-info") @@ -191,4 +192,16 @@ mod.Roboport = decl("fa.scanner.backends.Roboport", { return cat2(ent.name, ent.backer_name) end, }) + +mod.Pipe = decl("fa.scanner.backends.Pipe", { + category_callback = functionize(SC.CATEGORIES.LOGISTICS), + + ---@param ent LuaEntity + subcategory_callback = function(ent) + local fluids = ent.get_fluid_contents() + local fluid = next(fluids) or "" + local end_part = BuildingTools.is_a_pipe_end(ent) and "" or "" + return string.format("%s/%s/%s", ent.name, fluid, end_part) + end, +}) return mod diff --git a/scripts/scanner/surface-scanner.lua b/scripts/scanner/surface-scanner.lua index 7ba287fe..fb343329 100644 --- a/scripts/scanner/surface-scanner.lua +++ b/scripts/scanner/surface-scanner.lua @@ -85,7 +85,7 @@ local BACKEND_LUT = { ["mining-drill"] = SEB.MiningDrill, ["offshore-pump"] = SEB.Production, ["pipe-to-ground"] = SEB.LogisticsWithFluid, - ["pipe"] = SEB.LogisticsWithFluid, + ["pipe"] = SEB.Pipe, ["player-port"] = SEB.Other, ["power-switch"] = SEB.Logistics, ["programmable-speaker"] = SEB.Logistics, @@ -200,7 +200,7 @@ end local surface_state = GlobalManager.declare_global_module( "scanner", new_empty_surface, - { root_field = "surfaces", ephemeral_state_version = 4 } + { root_field = "surfaces", ephemeral_state_version = 5 } ) -- Given a backend setup and an array of entities, dispatch the entities to the