Page 1 of 1

pipe-to-ground entities limited to 1 underground connectio

Posted: Tue Mar 04, 2014 2:39 am
by sparr
I've defined the following entity of type pipe-to-ground. In theory it should be able to make an underground connection in both directions, but it can't. If underground connections are intentionally limited to one, the structure of the pipe_connections table should be changed. If multiples should work, then this is a bug.

Code: Select all

      pipe_connections =
      {
        {
          position = {0, -1},
          max_underground_distance = 1
        },
        {
          position = {0, 1},
          max_underground_distance = 1
        },
      },

Re: pipe-to-ground entities limited to 1 underground connect

Posted: Tue Mar 04, 2014 2:28 pm
by slpwnd
Yup, this is a bug. It should be possible to have multiple connections. This will be fixed in 0.9.2.

Re: pipe-to-ground entities limited to 1 underground connect

Posted: Tue Mar 04, 2014 7:50 pm
by sparr
Awesome, thanks! Here are the complete entities that I'm adding with this fixed feature:

Code: Select all

  {
    type = "pipe-to-ground",
    name = "underground-pipe",
    icon = "__pipe-dream__/graphics/icons/underground-pipe.png",
    flags = {"placeable-neutral", "player-creation"},
    minable = {hardness = 0.2, mining_time = 0.75, result = "underground-pipe"},
    max_health = 50,
    corpse = "small-remnants",
    resistances =
    {
      {
        type = "fire",
        percent = 80
      }
    },
    collision_box = {{-0.1, -0.1}, {0.1, 0.1}},
    selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
    fluid_box =
    {
      base_area = 1,
      -- pipe_covers = pipecoverspictures(),
      pipe_connections =
      {
        {
          position = {0, -1},
          max_underground_distance = 1
        },
        {
          position = {0, 1},
          max_underground_distance = 1
        },
      },
    },
    underground_sprite =
    {
      filename = "__core__/graphics/arrows/underground-lines.png",
      priority = "high",
      width = 32,
      height = 32
    },
    pictures =
    {
      up =
      {
        filename = "__pipe-dream__/graphics/entity/underground-pipe/underground-pipe-updown.png",
        priority = "high",
        width = 44,
        height = 32 --, shift = {0.10, -0.04}
      },
      down =
      {
        filename = "__pipe-dream__/graphics/entity/underground-pipe/underground-pipe-updown.png",
        priority = "high",
        width = 40,
        height = 32 --, shift = {0.05, 0}
      },
      left =
      {
        filename = "__pipe-dream__/graphics/entity/underground-pipe/underground-pipe-leftright.png",
        priority = "high",
        width = 32,
        height = 42 --, shift = {-0.12, 0.1}
      },
      right =
      {
        filename = "__pipe-dream__/graphics/entity/underground-pipe/underground-pipe-leftright.png",
        priority = "high",
        width = 32,
        height = 40 --, shift = {0.1, 0.1}
      },
    }
  },
  {
    type = "pipe-to-ground",
    name = "pipe-to-ground-tap",
    icon = "__base__/graphics/entity/pipe/pipe-cross.png",
    flags = {"placeable-neutral", "player-creation"},
    minable = {hardness = 0.2, mining_time = 0.75, result = "pipe-to-ground-tap"},
    max_health = 50,
    corpse = "small-remnants",
    resistances =
    {
      {
        type = "fire",
        percent = 80
      }
    },
    collision_box = {{-0.3, -0.3}, {0.3, 0.3}},
    selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
    fluid_box =
    {
      base_area = 1,
      pipe_covers = pipecoverspictures(),
      pipe_connections =
      {
        {
          position = {0, -1},
          max_underground_distance = 5
        },
        {
          position = {1, 0},
          max_underground_distance = 5
        },
        {
          position = {0, 1},
          max_underground_distance = 5
        },
        {
          position = {-1, 0},
          max_underground_distance = 5
        },
        { position = {0, -1} },
        { position = {1, 0} },
        { position = {0, 1} },
        { position = {-1, 0} }
      },
    },
    underground_sprite =
    {
      filename = "__core__/graphics/arrows/underground-lines.png",
      priority = "high",
      width = 32,
      height = 32
    },
    pictures =
    {
      up =
      {
        filename =  "__base__/graphics/entity/pipe/pipe-cross.png",
        priority = "high",
        width = 40,
        height = 40
      },
      down =
      {
        filename =  "__base__/graphics/entity/pipe/pipe-cross.png",
        priority = "high",
        width = 40,
        height = 40
      },
      left =
      {
        filename =  "__base__/graphics/entity/pipe/pipe-cross.png",
        priority = "high",
        width = 40,
        height = 40
      },
      right =
      {
        filename =  "__base__/graphics/entity/pipe/pipe-cross.png",
        priority = "high",
        width = 40,
        height = 40
      },
    },
  },

Re: pipe-to-ground entities limited to 1 underground connect

Posted: Wed Mar 05, 2014 3:01 am
by sparr
I just discovered that *sometimes* the second connection works. I can't discern a pattern, although it always works or doesn't work in the same situation, so it's consistent.

Re: pipe-to-ground entities limited to 1 underground connect

Posted: Wed Mar 05, 2014 6:28 am
by slpwnd
sparr wrote:I just discovered that *sometimes* the second connection works. I can't discern a pattern, although it always works or doesn't work in the same situation, so it's consistent.
My guess would be that now (0.9.1) it doesn't work only when the other connection is in the same direction as from where you are connection. The trick was that when the code is searching for the other side of the pipe and encounters a pipe that has opposite pipe-to-ground connection than it expects then it stops searching. This has been changed that it still looks at other connections of that entity and then stops.

Re: pipe-to-ground entities limited to 1 underground connect

Posted: Wed Mar 05, 2014 3:17 pm
by sparr
In my tests I am using entities with connections in two or four directions. The only time I have two connections in the same direction is when one is underground and the other is aboveground, but that does not seem to affect this behavior. Even with potential connections in four different directions, I am seeing connections after the first one sometimes work and sometimes not.