#Pipe jamctions included?

1 messages ยท Page 1 of 1 (latest)

hollow saddle
#

So is this why you made pipe junctions for the jam?

ruby sand
#

perhaps :D

#

i've had the idea written down forever but the timing was perfect

#

also, speedmodding is fun

hollow saddle
#

Yeah do you think any can be added (other than an item description) to the mod? Could filters on the junctions be supported, like splitters?

ruby sand
#

no complex functions, yet

#

i think i can do prio/filters with some jank but thats tbd

bright spoke
#

A rare mod that looks like it should be in the base game. Good work!

ruby sand
#

:D

#

the best kind of praise!

#

ty!

bright spoke
#

I'm bookmarking it now...

ruby sand
#

A fluid junction, mostly evenly splitting fluid. Does not force fluid out, only prevents backflow. Change junction type with CTRL+R

hollow saddle
#

Yes and mention the ctrl+r keybind

ruby sand
#

great now how do i set that keybind link programmatically ๐Ÿ˜… ๐Ÿ˜…

#

ah __CONTROL__control-name__

swift prism
#

WOW, that is amazing

#

this kind of logic is so hard to write

leaden knot
#

tell me about it

ruby sand
#

tell him about it

#

then tell me about integrating it into everything else ๐Ÿ˜…

#

full connection category and pipe connection detection

#

the only thing i cant do is check if machines currently have pipe connections active, like assemblers

west aurora
#

Hell yeah! Can also confirm this stuff is crazy to implement, nice job!

ruby sand
#

the only thing i dont have is per-connection connection_category checks but i think thats overkill

#

i only check per-entity

ruby sand
west aurora
#

I forget if flow config has that. I lost steam on improving it since rotating blueprints doesn't work with it, though tbf it's been stable at least

#

This looks like a lot of fun to use

ruby sand
#

rotating blueprints is a pain, i have to hotswap the entities to and from pipes to tanks

ruby sand
west aurora
#

I tried for like a month after releasing and had to scrap the attempts. Clever solution

ruby sand
#
script.on_event(defines.events.on_player_setup_blueprint, function (event)
        local player = game.get_player(event.player_index)
        local blueprint = player.blueprint_to_setup
  -- if normally invalid
        if not blueprint or not blueprint.valid_for_read then blueprint = player.cursor_stack end
  -- if non existant, cancel
  local entities = blueprint and blueprint.get_blueprint_entities()
  if not entities then return end
  local changed = false
  -- update entities
  for _, entity in pairs(entities) do
    if xu.base_pipe[entity.name] then
      changed = true
      local variation = xu.pipe_to_tank[xu.bitmasks[entity.name]]
      entity.name = xu.variations[xu.base_pipe[entity.name]][variation.mask]
      entity.direction = variation.direction
    end
  end
  if not changed then return end -- make no changes unless required
  blueprint.set_blueprint_entities(entities)
end)
#
    -- just placed a blueprint, convert to normal
    if entity.type == "entity-ghost" and entity.ghost_type == "storage-tank" or entity.type == "storage-tank" then
      local mask = xu.tank_to_pipe[xu.bitmasks[name]][entity.direction]
      local new_name = xu.variations[xu.base_pipe[name]][mask]
      local new_entity = surface.create_entity{
        name = entity.name == "entity-ghost" and "entity-ghost" or new_name,
        ghost_name = entity.name == "entity-ghost" and new_name or nil,
        position = entity.position,
        quality = entity.quality,
        force = entity.force,
        player = event.player_index,
        undo_index = player and 1 or nil,
        create_build_effect_smoke = false,
      }
      entity.destroy()
      if player then
        storage.previous[player.index] = new_entity
      end
      if stack and not blueprint then
        stack.remove_undo_action(1, 1)
      end
      return
    end
  end

inside the build event

#
xu.tank_to_pipe = {
  nothingburger = {
    [0] = 0,
    [4] = 0,
    [8] = 0,
    [12] = 0
  },
  ending = {
    [0] = 4,
    [4] = 8,
    [8] = 1,
    [12] = 2
  },
  straight = {
    [0] = 5,
    [4] = 10,
    [8] = 5,
    [12] = 10
  },
  junction = {
    [0] = 14,
    [4] = 13,
    [8] = 11,
    [12] = 7
  },
  corner = {
    [0] = 6,
    [4] = 12,
    [8] = 9,
    [12] = 3
  },
  cross = {
    [0] = 15,
    [4] = 15,
    [8] = 15,
    [12] = 15
  }
}
xu.pipe_to_tank = {
  [0] = {mask = "nothingburger"},
  {mask = "ending", direction = defines.direction.south},
  {mask = "ending", direction = defines.direction.west},
  {mask = "corner", direction = defines.direction.west},
  {mask = "ending", direction = defines.direction.north},
  {mask = "straight", direction = defines.direction.north},
  {mask = "corner", direction = defines.direction.north},
  {mask = "junction", direction = defines.direction.west},
  {mask = "ending", direction = defines.direction.east},
  {mask = "corner", direction = defines.direction.south},
  {mask = "straight", direction = defines.direction.east},
  {mask = "junction", direction = defines.direction.south},
  {mask = "corner", direction = defines.direction.east},
  {mask = "junction", direction = defines.direction.east},
  {mask = "junction", direction = defines.direction.north},
  {mask = "cross"},
}

and two whole annoying lookup tables LOL

west aurora
#

Yeah I was trying to handle it by intercepting the rotate input event, which I think from my testing I concluded it wasn't guaranteed to happen before/after the blueprint is actually rotated...

ruby sand
#

(oof)

#

oh wait not even garunteed? jeez

west aurora
#

Yeah i was losing it trying to come to a good solution until I realized it's because it was one way or the other. And I think it depended per launch? I forget, would have to try it again and my advice is: just don't ๐Ÿ˜‚

ruby sand
#

when the best advice you can give is "dont" thats really good advice

#

also, no offense intended that flow config is incompatible, i just dont want to deal with compatibility bug reports with virtually identical mods

west aurora
#

It totally makes sense, no offense felt at all

ruby sand
#

fwiw i love the flow config UI and the initial implementation for this mod was almost an in-world version of it with a few tweaks

west aurora
#

Thank you! Yeah I had a lot of fun with the UI