Page 1 of 1

electric train

Posted: Tue Nov 26, 2013 7:26 pm
by Dysoch
this is the code i created (edited really) for an electric locomotive.
the game launches just fine, i can even place done the train.

BUT, it wont work(it wont get electricity, although it clearly is in the radius of an pole), and when i press the button to open the inventory, the game crashed.
is this possible?

Code: Select all

  {
    type = "locomotive",
    name = "diesel-locomotive",
    icon = "__base__/graphics/icons/diesel-locomotive.png",
    flags = {"placeable-neutral", "player-creation", "placeable-off-grid"},
    minable = {mining_time = 1, result = "diesel-locomotive"},
    max_health = 1000,
    corpse = "medium-remnants",
    collision_box = {{-0.6, -2.6}, {0.9, 2.6}},
    selection_box = {{-0.7, -2.5}, {1, 2.5}},
    drawing_box = {{-1, -4}, {1, 3}},
    weight = 2000,
    max_speed = 1.2,
    max_power = 10,
    braking_force = 10,
    friction_force = 0.0015,
    -- this is a percentage of current speed that will be substracted
    air_resistance = 0.002,
    connection_distance = 3.3,
    joint_distance = 4.6,
	inventory_size = 12,
    energy_source =
    {
      type = "electric",
      input_priority = "secondary"
    },
	energy_usage_per_tick = 1,
    pictures =
    {
      priority = "very-low",
      frame_width = 346,
      frame_height = 248,
      axially_symmetrical = false,
      direction_count = 256,
      filenames =
      {
        "__base__/graphics/entity/diesel-locomotive/diesel-locomotive-01.png",
        "__base__/graphics/entity/diesel-locomotive/diesel-locomotive-02.png",
        "__base__/graphics/entity/diesel-locomotive/diesel-locomotive-03.png",
        "__base__/graphics/entity/diesel-locomotive/diesel-locomotive-04.png",
        "__base__/graphics/entity/diesel-locomotive/diesel-locomotive-05.png",
        "__base__/graphics/entity/diesel-locomotive/diesel-locomotive-06.png",
        "__base__/graphics/entity/diesel-locomotive/diesel-locomotive-07.png",
        "__base__/graphics/entity/diesel-locomotive/diesel-locomotive-08.png"
      },
      line_length = 4,
      lines_per_file = 8,
      shift = {0.9, -0.45}
    },
    rail_category = "regular"
  },
yes, its still the diesel, just used it to see if it would work. that way i dont have to create an item and recipe for it.

Re: electric train

Posted: Tue Nov 26, 2013 7:29 pm
by kovarex
Yea ... the gui for the locomotive expect just burner energy source there, we might change it it won't be hard.

Re: electric train

Posted: Tue Nov 26, 2013 7:30 pm
by Dysoch
kovarex wrote:Yea ... the gui for the locomotive expect just burner energy source there, we might change it it won't be hard.
great, ill add it and disable it for now. when released, ill activate it :P