Call a Plumber


Pipes can only transport compatible fluids. You weren't going to put molten iron in an iron pipe, were you? Can be customized by other mods.

Content
10 months ago
2.0
988
Fluids

i Prevent ghosts for destroyed entities

4 months ago
(updated 4 months ago)

It's a little annoying in testing to have a pipe blow up due to an incompatible fluid, only for construction robots to continually replace them.

I made a little edit around Line 150 of scripts/scanner.lua:

    local volume = entity.prototype.fluidbox_prototypes[1].volume
    entity.remove_fluid{name=fluid_name, amount=math.floor(1.5*volume)}

    local ghostFilter = {
        position = entity.position,
        name = "entity-ghost",
        force = entity.force,
        ghost_name = entity.name,
        }
    local ghostSurface = entity.surface
    entity.die()

    local ghosts = ghostSurface.find_entities_filtered(ghostFilter)
    for _,i in pairs(ghosts) do
        i.destroy()
    end

Also, could you add "valve" as an entity type to both

  • FLUID_ENTITY_PROTOTYPES in script/scanner.lua
  • ENTITY_TYPE_FILTERS in control.lua (but it seems like this variable isn't ever used)

This would allow your mod to work with modded valves. Thanks!

New response