[solved!] storage-tank woes... tile_width

Place to get help with not working mods / modding interface.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

[solved!] storage-tank woes... tile_width

Post by aubergine18 »

I've run in to some strange problems with a custom storage-tank (based on the Stone Water Well mod that's on the mod portal)...

First, while the tank has 4 directions and rotation works prior to placement, after placing it on the map it can only be subsequently rotated 180º rather than the usual 90º. For example, a south-facing tank can be rotated between north and south, but not east and west. Likewise, an east-facing tank can be rotated between west and east, but not north and south. I have no idea what's causing this to happen.

Second, I can only connect water pipes when the tank is facing north or south, it's not accepting pipe connections at all from east and west (even when placed facing in those directions).

Anyone encountered anything like this before?

Prototype:

Code: Select all

{
  circuit_connector_sprites = {
    {
      blue_led_light_offset = {
        -0.1875,
        -0.40625
      },
      connector_main = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-main.png",
        height = 27,
        priority = "low",
        shift = {
          -0.1875,
          -0.359375
        },
        width = 28,
        x = 196,
        y = 0
      },
      led_blue = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-led-blue.png",
        height = 22,
        priority = "low",
        shift = {
          -0.203125,
          -0.375
        },
        width = 21,
        x = 147,
        y = 0
      },
      led_green = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-led-green.png",
        height = 16,
        priority = "low",
        shift = {
          -0.1875,
          -0.40625
        },
        width = 20,
        x = 140,
        y = 0
      },
      led_light = {
        intensity = 0.8,
        size = 0.9
      },
      led_red = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-led-red.png",
        height = 16,
        priority = "low",
        shift = {
          -0.1875,
          -0.40625
        },
        width = 20,
        x = 140,
        y = 0
      },
      logistic_animation = {
        blend_mode = "additive",
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-logistic-animation.png",
        frame_count = 15,
        height = 43,
        line_length = 4,
        priority = "low",
        shift = {
          -0.28125,
          -0.8125
        },
        width = 43
      },
      red_green_led_light_offset = {
        -0.1875,
        -0.53125
      }
    },
    {
      blue_led_light_offset = {
        0.375,
        -0.5625
      },
      connector_main = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-main.png",
        height = 27,
        priority = "low",
        shift = {
          0.375,
          -0.515625
        },
        width = 28,
        x = 28,
        y = 0
      },
      led_blue = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-led-blue.png",
        height = 22,
        priority = "low",
        shift = {
          0.359375,
          -0.53125
        },
        width = 21,
        x = 21,
        y = 0
      },
      led_green = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-led-green.png",
        height = 16,
        priority = "low",
        shift = {
          0.375,
          -0.5625
        },
        width = 20,
        x = 20,
        y = 0
      },
      led_light = {
        intensity = 0.8,
        size = 0.9
      },
      led_red = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-led-red.png",
        height = 16,
        priority = "low",
        shift = {
          0.375,
          -0.5625
        },
        width = 20,
        x = 20,
        y = 0
      },
      logistic_animation = {
        blend_mode = "additive",
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-logistic-animation.png",
        frame_count = 15,
        height = 43,
        line_length = 4,
        priority = "low",
        shift = {
          0.390625,
          -0.765625
        },
        width = 43
      },
      red_green_led_light_offset = {
        0.375,
        -0.6875
      }
    },
    {
      blue_led_light_offset = {
        -0.1875,
        -0.40625
      },
      connector_main = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-main.png",
        height = 27,
        priority = "low",
        shift = {
          -0.1875,
          -0.359375
        },
        width = 28,
        x = 196,
        y = 0
      },
      led_blue = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-led-blue.png",
        height = 22,
        priority = "low",
        shift = {
          -0.203125,
          -0.375
        },
        width = 21,
        x = 147,
        y = 0
      },
      led_green = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-led-green.png",
        height = 16,
        priority = "low",
        shift = {
          -0.1875,
          -0.40625
        },
        width = 20,
        x = 140,
        y = 0
      },
      led_light = {
        intensity = 0.8,
        size = 0.9
      },
      led_red = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-led-red.png",
        height = 16,
        priority = "low",
        shift = {
          -0.1875,
          -0.40625
        },
        width = 20,
        x = 140,
        y = 0
      },
      logistic_animation = {
        blend_mode = "additive",
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-logistic-animation.png",
        frame_count = 15,
        height = 43,
        line_length = 4,
        priority = "low",
        shift = {
          -0.28125,
          -0.8125
        },
        width = 43
      },
      red_green_led_light_offset = {
        -0.1875,
        -0.53125
      }
    },
    {
      blue_led_light_offset = {
        0.375,
        -0.5625
      },
      connector_main = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-main.png",
        height = 27,
        priority = "low",
        shift = {
          0.375,
          -0.515625
        },
        width = 28,
        x = 28,
        y = 0
      },
      led_blue = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-led-blue.png",
        height = 22,
        priority = "low",
        shift = {
          0.359375,
          -0.53125
        },
        width = 21,
        x = 21,
        y = 0
      },
      led_green = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-led-green.png",
        height = 16,
        priority = "low",
        shift = {
          0.375,
          -0.5625
        },
        width = 20,
        x = 20,
        y = 0
      },
      led_light = {
        intensity = 0.8,
        size = 0.9
      },
      led_red = {
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-led-red.png",
        height = 16,
        priority = "low",
        shift = {
          0.375,
          -0.5625
        },
        width = 20,
        x = 20,
        y = 0
      },
      logistic_animation = {
        blend_mode = "additive",
        filename = "__base__/graphics/entity/circuit-connector/circuit-connector-logistic-animation.png",
        frame_count = 15,
        height = 43,
        line_length = 4,
        priority = "low",
        shift = {
          0.390625,
          -0.765625
        },
        width = 43
      },
      red_green_led_light_offset = {
        0.375,
        -0.6875
      }
    }
  },
  circuit_wire_connection_points = {
    {
      shadow = {
        green = {
          2.29688,
          0.953125
        },
        red = {
          2.35938,
          0.890625
        }
      },
      wire = {
        green = {
          -0.53125,
          -0.46875
        },
        red = {
          -0.40625,
          -0.375
        }
      }
    },
    {
      shadow = {
        green = {
          2.29688,
          0.953125
        },
        red = {
          2.35938,
          0.890625
        }
      },
      wire = {
        green = {
          0.375,
          -0.4375
        },
        red = {
          0.46875,
          -0.53125
        }
      }
    },
    {
      shadow = {
        green = {
          2.29688,
          0.953125
        },
        red = {
          2.35938,
          0.890625
        }
      },
      wire = {
        green = {
          -0.53125,
          -0.46875
        },
        red = {
          -0.40625,
          -0.375
        }
      }
    },
    {
      shadow = {
        green = {
          2.29688,
          0.953125
        },
        red = {
          2.35938,
          0.890625
        }
      },
      wire = {
        green = {
          0.375,
          -0.4375
        },
        red = {
          0.46875,
          -0.53125
        }
      }
    }
  },
  circuit_wire_max_distance = 7.5,
  collision_box = {
    {
      -1,
      -1
    },
    {
      1,
      1
    }
  },
  corpse = "medium-remnants",
  flags = {
    "placeable-neutral",
    "placeable-player",
    "player-creation"
  },
  flow_length_in_ticks = 360,
  fluid = "water",
  fluid_box = {
    base_area = 500,
    base_level = 1,
    pipe_connections = {
      {
        position = {
          0,
          1
        },
        type = "output"
      }
    }
  },
  icon = "__Epoch__/graphics/icon/stone-well.png",
  map_color = {
    b = 0.4196,
    g = 0.3568,
    r = 0.0941
  },
  max_health = 200,
  minable = {
    mining_time = 4,
    results = {
      {
        amount_max = 10,
        amount_min = 5,
        name = "stone-block",
        probability = 1,
        type = "item"
      },
      {
        amount_max = 10,
        amount_min = 2,
        name = "stone-slab",
        probability = 1,
        type = "item"
      },
      {
        amount_max = 4,
        amount_min = 0,
        name = "tree-trunk",
        probability = 1,
        type = "item"
      }
    }
  },
  mined_sound = {
    {
      filename = "__base__/sound/deconstruct-bricks.ogg",
      preload = true,
      volume = 1
    }
  },
  name = "stone-well",
  pictures = {
    flow_sprite = {
      filename = "__Epoch__/graphics/stone-well/flow-sprite.png",
      height = 20,
      priority = "very-low",
      width = 160,
      x = 0,
      y = 0
    },
    fluid_background = {
      filename = "__Epoch__/graphics/stone-well/fluid-background.png",
      height = 15,
      priority = "very-low",
      width = 32,
      x = 0,
      y = 0
    },
    picture = {
      east = {
        filename = "__Epoch__/graphics/stone-well/stone-well.png",
        height = 256,
        priority = "extra-high",
        scale = 0.5,
        shift = {
          0.15,
          0.05
        },
        width = 256,
        x = 256,
        y = 0
      },
      north = {
        filename = "__Epoch__/graphics/stone-well/stone-well.png",
        height = 256,
        priority = "extra-high",
        scale = 0.5,
        shift = nil,
        width = 256,
        x = 0,
        y = 0
      },
      south = {
        filename = "__Epoch__/graphics/stone-well/stone-well.png",
        height = 256,
        priority = "extra-high",
        scale = 0.5,
        shift = nil,
        width = 256,
        x = 512,
        y = 0
      },
      west = {
        filename = "__Epoch__/graphics/stone-well/stone-well.png",
        height = 256,
        priority = "extra-high",
        scale = 0.5,
        shift = nil,
        width = 256,
        x = 768,
        y = 0
      }
    },
    window_background = {
      filename = "__Epoch__/graphics/stone-well/window-background.png",
      height = 24,
      priority = "very-low",
      width = 17,
      x = 0,
      y = 0
    }
  },
  pumping_speed = 1,
  resistances = {
    {
      percent = 90,
      type = "fire"
    }
  },
  selection_box = {
    {
      -1,
      -1
    },
    {
      1,
      1
    }
  },
  tile_width = 1,
  type = "storage-tank",
  vehicle_impact_sound = {
    {
      filename = "__base__/sound/car-stone-impact.ogg",
      preload = true,
      volume = 0.65
    }
  },
  window_bounding_box = {
    {
      -3,
      -3
    },
    {
      3,
      3
    }
  },
  working_sound = {
    apparent_volume = 1.5,
    max_sounds_per_type = 3,
    sound = {
      {
        filename = "__base__/sound/storage-tank.ogg",
        preload = true,
        volume = 0.8
      }
    }
  }
}
Last edited by aubergine18 on Sat Oct 29, 2016 12:42 am, edited 2 times in total.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: storage-tank woes...

Post by aubergine18 »

Almost solved... Seems it has something to do with tile_width property. If I set tile_width = 2, then rotation works normally again (all 4 directions). However, that causes the pipe connection to be on boundary between two tiles and thus my pipes won't connect to it. So I set tile_width = 3 and now my pipe will connect, however the rotation is broken again. Investigation continues...
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: storage-tank woes... tile_width

Post by aubergine18 »

Tried setting `tile_width = 2.5`, but that threw an error - it needs to be an integer.

Then tried shifting the images by 0.5,0.5... that messed up the selection/collision boxes, and also caused the pipes to not line up in all directions. I was about to shift each image separately, by different value to allow pipe connection, but then realised that doing so would cause the entity to "judder" when rotating it.

It's doing my nut in.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14892
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: storage-tank woes... tile_width

Post by Rseding91 »

Storage tanks don't support 90 degree rotation as you've experienced.
If you want to get ahold of me I'm almost always on Discord.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: storage-tank woes... tile_width

Post by aubergine18 »

Well, they partly support it as the stone water well mod shows:
Image
It's only when placed it seems they stop rotating properly, although by setting tile_width I was able to get placed entities rotating all 4 directions too:
Small GIF
Regardless, is there some other entity you would recommend? Specifically: I want something that both produces and stores water. The water production rate will be slow, and water usage irregular. I want the effect of the well filling up when production > consumption, but draining when production < consumption. It's sort of like a "water accumulator" with an internal water source.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: storage-tank woes... tile_width

Post by aubergine18 »

I found that by setting both the tile_width and tile_height, as well as tweaks to the pipe connection position to compensate, resulted in a fully operational storage tank :ugeek: It can now rotate all directions after placement, and applicable pipes will automatically connect to the storage tank when rotated. *success*
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.
Post Reply

Return to “Modding help”