Page 1 of 1

pipe connections

Posted: Sun Oct 30, 2022 2:30 pm
by evandro_6565
can someone help me with this code

Code: Select all

fluid_box =
  {
    base_area = 150,
    pipe_covers = pipecoverspictures(),
    filter = "water",
    pipe_connections = 
    {
      { position = {0.64, -0.12} },
    },
    hide_connection_info = true,
  },
bug.png
bug.png (28.02 KiB) Viewed 1131 times

Re: pipe connections

Posted: Sun Oct 30, 2022 3:16 pm
by robot256
The pipe connection offset is the X and Y distance from the *center of the entity* to the center of *the tile where a pipe can be placed to connect to it*. So if you have a 2x2 entity, a valid connection offset would be {1.5, 0.5}, placing the pipe on one half of the right side.

Re: pipe connections

Posted: Sun Oct 30, 2022 3:24 pm
by evandro_6565
robot256 wrote: ↑Sun Oct 30, 2022 3:16 pm The pipe connection offset is the X and Y distance from the *center of the entity* to the center of *the tile where a pipe can be placed to connect to it*. So if you have a 2x2 entity, a valid connection offset would be {1.5, 0.5}, placing the pipe on one half of the right side.
when you say entity center, would be in collision box the entity center or the sprite width x height

Re: pipe connections

Posted: Sun Oct 30, 2022 3:32 pm
by evandro_6565
I set a high value to test and this message continues

Re: pipe connections

Posted: Sun Oct 30, 2022 3:58 pm
by robot256
Can you post the rest of the prototype? What is your entity bounding box? Do your offsets land at exactly coordinates ending in 0.5?

Re: pipe connections

Posted: Sun Oct 30, 2022 4:26 pm
by evandro_6565

Code: Select all

{
  type = "storage-tank",
  name = "fish-tank-pump",
  icon = "__update-fish__/graphics/icons/fish-farm-icon.png",
  icon_size = 32,
  flags = {},--{"placeable-player", "player-creation"},
  minable = {mining_time = 0.5, result = "fish-tank-pump"},
  max_health = 500,
  corpse = "fish-tank-remnants",
  dying_explosion = "storage-tank-explosion",
  collision_box = {{-0.4, -0.6}, {0.4, 1.1}},
  selection_box = {{-0.5, -1.2}, {0.5, 1.2}},
  damaged_trigger_effect = hit_effects.entity(),
  fluid_box =
  {
    base_area = 250,
    pipe_covers = pipecoverspictures(),
    filter = "water",
    pipe_connections = {{ type = "input", position = {6.5, 2.5} }},
    hide_connection_info = true,
  },
  --two_direction_only = true,
  window_bounding_box = {{-0.125, 0.6875}, {0.1875, 1.1875}},--{{-0.1, -0.1}, {0.1, 0.1}},--{{-2.8, -3.3}, {2.1, 0.3}},
  pictures =
  {
    picture =
    {
      sheets =
      {
        {
          filename = "__update-fish__/graphics/entity/pump.png",
          frames = 1,
          width = 104,
          height = 227,
          shift = util.by_pixel(-7.1, -9.9),
          scale = 0.5
        },
        {
          filename = "__update-fish__/graphics/entity/pump-shadow.png",
          --priority = "extra-high",
          frames = 1,
          width = 150,
          height = 122,
          shift = util.by_pixel(26.2, 10.8),
          scale = 0.5,
          draw_as_shadow = true
        }
      }
    },
    fluid_background = blank,
    window_background = blank,
    flow_sprite = blank,
    gas_flow = blank
  },
  --flow_length_in_ticks = 360,
  vehicle_impact_sound = sounds.generic_impact,
  open_sound = sounds.machine_open,
  close_sound = sounds.machine_close,
  working_sound =
  {
    sound =
    {
        filename = "__base__/sound/storage-tank.ogg",
        volume = 0.6
    },
    match_volume_to_activity = true,
    audible_distance_modifier = 0.5,
    max_sounds_per_type = 3
  },
}

Re: pipe connections

Posted: Sun Oct 30, 2022 6:39 pm
by evandro_6565
the problem was collision_box, selection_box
and pipe_connections = {{ type = "input", position = {1, 0} }}

I changed the entity to assembler and observed the values ​​in the selection_box in relation to the tiles :)