Script help

Place to get help with not working mods / modding interface.
User avatar
LuziferSenpai
Filter Inserter
Filter Inserter
Posts: 393
Joined: Tue Jul 08, 2014 10:06 am
Contact:

Script help

Post by LuziferSenpai »

Hey,

i have maked the MOD Straight Pipes, but now i need help by getting the graphics set how they are normaly. So i want to have that a W-E Pipe are looking like that every time.

But i dont know how i can make that working!

Here ist the Script of the MOD, how i get every Pipe i want!

Code: Select all

require("config")

data:extend
(
 {
  { type = "item-group", name = "Straight-Pipes-MOD", icon = MODNAME.."/graphics/icon.png", order = "gg" }
 }
)

local subgroupnumber = 0
local new_pipes = {}
local new_recipes = {}
local new_items = {}

for pp, pipe in pairs(data.raw["pipe"]) do
  if subgroupnumber < 10 then subpad = "0" else subpad = "" end
  subgroupnumber = subgroupnumber + 1
  local pipe_subgroup =
    {
      type = "item-subgroup",
      name = "pipe-subgroup-"..subpad..subgroupnumber,
      group = "Straight-Pipes-MOD",
      order = subpad..subgroupnumber
    }
  local ordernumber = 0
  for sides, connec in pairs(PIPE_DIR) do
    table.insert(new_pipes,
      {
        type = "pipe",
        name = pipe.name.."-"..sides,
        icons = { { icon = pipe.icon, tint = { r = 1, g = 1, b = 1, a = 1 } }, { icon = MODNAME.."/graphics/"..sides..".png", tint = { r = 1, g = 1, b = 1, a = 0.85 } } },
        flags = pipe.flags,
        minable = pipe.minable,
        max_health = pipe.max_health,
        corpse = pipe.corpse,
        resistances = pipe.resistances,
        fast_replaceable_group = pipe.fast_replaceable_group,
        collision_box = pipe.collision_box,
        selection_box = pipe.selection_box,
        fluid_box = { base_are = 1, pipe_connections = connec },
        pictures = pipe.pictures,
        working_sound = pipe.working_sound,
        horizontal_window_bounding_box = pipe.horizontal_window_bounding_box,
        vertical_window_bounding_box = pipe.vertical_window_bounding_box,
        localised_name = { "entity-name.straight-pipe", { "entity-name."..pipe.name }, { sides } }
      })
    if ordernumber < 10 then pad = "0" else pad = "" end
    table.insert(new_items,
      {
        type = "item",
        name = pipe.name.."-"..sides,
        icons = { { icon = pipe.icon, tint = { r = 1, g = 1, b = 1, a = 1 } }, { icon = MODNAME.."/graphics/"..sides..".png", tint = { r = 1, g = 1, b = 1, a = 0.85 } } },
        flags = {"goes-to-quickbar"},
        subgroup = "pipe-subgroup-"..subpad..subgroupnumber,
        order = "pipe-"..pad..subgroupnumber,
        place_result = pipe.name.."-"..sides,
        stack_size = 50,
        localised_name = { "item-name.straight-pipe", { "entity-name."..pipe.name }, { sides } }
      })
    table.insert(new_recipes,
      {
        type = "recipe",
        name = pipe.name.."-"..sides,
        ingredients = { { pipe.name, 1 } },
        result = pipe.name.."-"..sides,
      })
  end
  data:extend( { pipe_subgroup } )
end

for i=1,#new_pipes do
  data:extend({ new_pipes[i], new_items[i], new_recipes[i] })
end
And these are my configs:

Code: Select all

MODNAME = "__Straight_Pipes__"

PIPE_DIR = {}
PIPE_DIR["E-N-S"] = { { position = { 0, -1 } }, { position = { 1, 0 } }, { position = { 0, 1 }  } }
PIPE_DIR["E-S"]   = { { position = { 1, 0 } }, { position = { 0, 1 } } }
PIPE_DIR["E-W"]   = { { position = { 1, 0 } }, { position = { -1, 0 } } }
PIPE_DIR["N-E"]   = { { position = { 0, -1 } }, { position = { 1, 0 } } }
PIPE_DIR["N-E-W"] = { { position = { 0, -1 } }, { position = { 1, 0 } }, { position = { -1, 0 } } }
PIPE_DIR["N-S"]   = { { position = { 0, -1 } }, { position = { 0, 1 } } }
PIPE_DIR["N-W"]   = { { position = { 0, -1 } }, { position = { -1, 0 } } }
PIPE_DIR["S-W"]   = { { position = { 0, 1 } }, { position = { -1, 0 } } }
PIPE_DIR["S-W-E"] = { { position = { 1, 0 } }, { position = { 0, 1 } }, { position = { -1, 0 } } }
PIPE_DIR["W-N-S"] = { { position = { 0, -1 } }, { position = { 0, 1 } }, { position = { -1, 0 } } }
Pls help me getting the graphics set.

Greetz,

Luzifer
Coding is awesome!
Animes are love!
Factorio is life!

My MODs:
Click

Greetz,

Senpai
Post Reply

Return to “Modding help”