Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local entity = table.deepcopy(data.raw["pipe-to-ground"]["pipe-to-ground"])
- local dist = entity.fluid_box.pipe_connections[2].max_underground_distance
- local underground_collision_mask = {layers={lava_tile=true, empty_space=true}}
- -- local simulations = require("__base__.prototypes.factoriopedia-simulations")
- if mods["ConfigUnderLengths"] then
- dist = tonumber(settings.startup["config-under-lengths-pipes-1"].value) + 1
- end
- local category = tostring(settings.startup["connection-categories"].value) ---@type string
- function get_categories(inputstr) --underground pipes cant have more than one connection atm
- sep = ","
- local t = {}
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- str = string.gsub(str, "%s+", "")
- table.insert(t, str)
- end
- return t
- end
- local name = {"pipe-to-ground", "pipe-to-ground-2", "pipe-to-ground-3"}
- local icon = {
- "__base__/graphics/icons/pipe-to-ground.png",
- "__pipe_plus__/graphics/icon-2.png",
- "__pipe_plus__/graphics/icon-3.png",
- }
- local pictures = {
- north =
- {
- entity.pictures.north.filename,
- "__pipe_plus__/graphics/pipe/hr-up-2.png",
- "__pipe_plus__/graphics/pipe/hr-up-3.png",
- },
- south =
- {
- entity.pictures.south.filename,
- "__pipe_plus__/graphics/pipe/hr-down-2.png",
- "__pipe_plus__/graphics/pipe/hr-down-3.png",
- },
- west =
- {
- entity.pictures.west.filename,
- "__pipe_plus__/graphics/pipe/hr-left-2.png",
- "__pipe_plus__/graphics/pipe/hr-left-3.png",
- },
- east =
- {
- entity.pictures.east.filename,
- "__pipe_plus__/graphics/pipe/hr-right-2.png",
- "__pipe_plus__/graphics/pipe/hr-right-3.png",
- }
- }
- -- log(serpent.block(pictures.north[1]))
- local pipe_connections = {
- {
- { connection_type = "underground", direction = defines.direction.south, position = {0, 0}, max_underground_distance = dist},
- { direction = defines.direction.north, position = {0, 0} },
- },
- {
- { direction = defines.direction.east, position = {0, 0} },
- { underground_collision_mask = underground_collision_mask, connection_type = "underground", direction = defines.direction.south, position = {0, 0}, max_underground_distance = dist, },
- { direction = defines.direction.west, position = {0, 0} },
- },
- {
- { direction = defines.direction.north, position = {0, 0} },
- { underground_collision_mask = underground_collision_mask, connection_type = "underground", direction = defines.direction.south, position = {0, 0}, max_underground_distance = dist},
- { direction = defines.direction.east, position = {0, 0} },
- { direction = defines.direction.west, position = {0, 0} },
- },
- }
- local vis_data = {
- { -- skip, lol
- filename = "__base__/graphics/entity/pipe-to-ground/visualization.png",
- x = {64, 128, 192, 256},
- },
- {
- filename = "__pipe_plus__/graphics/pipe/visualization_2.png",
- x = {0, 64, 0, 64},
- },
- {
- filename = "__pipe_plus__/graphics/pipe/visualization_3.png",
- x = {64, 128, 0, 192},
- }
- }
- local visualization_2 = {
- north =
- {
- filename = vis_data[2].filename,
- priority = "extra-high",
- x = vis_data[2].x[1],
- size = 64,
- scale = 0.5,
- flags = {"icon"}
- },
- east =
- {
- filename = vis_data[2].filename,
- priority = "extra-high",
- x = vis_data[2].x[2],
- size = 64,
- scale = 0.5,
- flags = {"icon"}
- },
- south =
- {
- filename = vis_data[2].filename,
- priority = "extra-high",
- x = vis_data[2].x[3],
- size = 64,
- scale = 0.5,
- flags = {"icon"}
- },
- west =
- {
- filename = vis_data[2].filename,
- priority = "extra-high",
- x = vis_data[2].x[4],
- size = 64,
- scale = 0.5,
- flags = {"icon"}
- },
- }
- local visualization_3 = {
- north =
- {
- filename = vis_data[3].filename,
- priority = "extra-high",
- x = vis_data[3].x[1],
- size = 64,
- scale = 0.5,
- flags = {"icon"}
- },
- east =
- {
- filename = vis_data[3].filename,
- priority = "extra-high",
- x = vis_data[3].x[2],
- size = 64,
- scale = 0.5,
- flags = {"icon"}
- },
- south =
- {
- filename = vis_data[3].filename,
- priority = "extra-high",
- x = vis_data[3].x[3],
- size = 64,
- scale = 0.5,
- flags = {"icon"}
- },
- west =
- {
- filename = vis_data[3].filename,
- priority = "extra-high",
- x = vis_data[3].x[4],
- size = 64,
- scale = 0.5,
- flags = {"icon"}
- },
- }
- for i = 2, 3 do
- entity = table.deepcopy(data.raw["pipe-to-ground"]["pipe-to-ground"])
- local item = table.deepcopy(data.raw.item["pipe-to-ground"])
- local recipe = table.deepcopy(data.raw.recipe["pipe-to-ground"])
- item.name = name[i]
- item.localised_name = i >1 and {"", {"entity-name.pipe-to-ground"}, " ", tostring(i)} or nil
- item.icon = icon[i]
- item.place_result = name[i]
- recipe.name = name[i]
- recipe.localised_name = i >1 and {"", {"entity-name.pipe-to-ground"}, " ", tostring(i)} or nil
- recipe.icon = icon[i]
- recipe.results = {{type = "item", name = name[i], amount = 2}}
- entity.name = name[i]
- entity.localised_name = i >1 and {"", {"entity-name.pipe-to-ground"}, " ", tostring(i)} or nil
- entity.icon = icon[i]
- entity.minable = {mining_time = 0.1, result = name[i]}
- -- entity.corpse = "pipe-to-ground-remnants" -- TODO
- -- entity.factoriopedia_simulation = simulations.factoriopedia_pipe_to_ground
- entity.fluid_box = {
- volume = 100,
- pipe_covers = pipecoverspictures(),
- pipe_connections = pipe_connections[i],
- hide_connection_info = true
- }
- entity.fluid_box.pipe_connections[2].connection_category = get_categories(category)
- if i == 2 then
- entity.visualization = visualization_2
- end
- if i == 3 then
- entity.visualization = visualization_3
- end
- for _, dir in pairs({"north","south","west","east"}) do
- entity.pictures[dir].filename = pictures[dir][i]
- end
- if i > 1 and data.raw.technology["steam-power"] then
- recipe.enabled = false
- table.insert(data.raw.technology["steam-power"].effects, {type = "unlock-recipe", recipe = name[i]})
- end
- data:extend({entity, item, recipe})
- end
Advertisement
Add Comment
Please, Sign In to add comment