Vehicles can't use electricity, crash for gui.

Bugs that are actually features.
Post Reply
User avatar
y.petremann
Filter Inserter
Filter Inserter
Posts: 410
Joined: Mon Mar 17, 2014 4:24 pm
Contact:

Vehicles can't use electricity, crash for gui.

Post by y.petremann »

For now, It looks like that everything that use energy_source can handle burner and electricity.
Locomotives use the energy_source tag so for me they can use electricity.
I've made one that act like a roboport for energy, so it has an inner accumulator and then could work outside a network.
  • They act like they were out of an electric network, maybe becasue this is a entity that can move.
  • According to this bug report (setting energy using script is not possible), we can't put energy by script because energy is lost for the next tick, so not possible to do this.

    Code: Select all

    /c for _,player in pairs(game.players) do if player.vehicle then player.vehicle.energy=150000 end end
    But it's possible to do this.

    Code: Select all

    /c game.onevent(0,function() for _,player in pairs(game.players) do if player.vehicle then player.vehicle.energy=150000 end end end)
  • In the case we put electricity for a train, they don't need an additionnal gui page for fuel and if we try to go to this page we get this crash.

    Code: Select all

    #0  0x000000000050d6a9 in CrashHandler::SignalHandler(int) at /home/build/Factorio/src/Util/CrashHandler.cpp:139
    #1  0x00007f9f08dded40 in ?? at ??:0
    #2  0x00000000007a9491 in std::vector<ItemStack*, std::allocator<ItemStack*> >::size() const at /usr/include/c++/4.8/bits/stl_vector.h:646 (discriminator 1)
    Inventory::size() const
    /home/build/Factorio/src/Item/Inventory.hpp:82 (discriminator 1)
    BurnerInfo
    /home/build/Factorio/src/Gui/BurnerInfo.cpp:19 (discriminator 1)
    #3  0x00000000009031d2 in LocomotiveGui at /home/build/Factorio/src/Gui/TrainGui.cpp:257
    TrainGui::switchView()
    /home/build/Factorio/src/Gui/TrainGui.cpp:321
    #4  0x00000000006da691 in Slot::mouseDownCB(agui::MouseEvent&) at /home/build/build_environment/boost_1_57_0/output_linux64/include/boost/variant/variant.hpp:1282
    #5  0x0000000000a08893 in agui::Widget::_dispatchMouseListenerEvent(agui::MouseEvent::MouseEventEnum, agui::MouseEvent&) at ??:?
    #6  0x0000000000a0fc4b in agui::Gui::handleMouseDown(agui::MouseInput const&) at ??:?
    #7  0x0000000000a106f5 in agui::Gui::_dispatchMouseEvents() at ??:?
    #8  0x0000000000a107a2 in agui::Gui::logic() at ??:?
    #9  0x00000000009619c2 in GlobalContext::updateGui() at /home/build/Factorio/src/GlobalContext.cpp:645
    processAllegroEvent
    /home/build/Factorio/src/MainLoop.cpp:109
    processAllegroEvents
    /home/build/Factorio/src/MainLoop.cpp:131
    #10 0x00000000009638c7 in tickStep at /home/build/Factorio/src/MainLoop.cpp:370
    run
    /home/build/Factorio/src/MainLoop.cpp:450
    #11 0x00000000009959dc in main at /home/build/Factorio/src/Main.cpp:267 (discriminator 3)
    #12 0x00007f9f08dc9ec5 in ?? at ??:0
    #13 0x000000000040f039 in _start at ??:?
    470765.716732  Error Util.cpp:43: Unexpected error occurred. You can help us to solve the problem by posting the contents of the log file on the Factorio forums.
Finally the car still use

Code: Select all

    burner =
    {
      effectivity = 0.6,
      fuel_inventory_size = 1,
      smoke =
      {
        {
          name = "smoke",
          deviation = {0.25, 0.25},
          frequency = 50,
          position = {0, 1.5},
          slow_down_factor = 0.9,
          starting_frame = 3,
          starting_frame_deviation = 5,
          starting_frame_speed = 0,
          starting_frame_speed_deviation = 5
        }
      }
    }
instead of

Code: Select all

    energy_source =
    {
      type = "burner",
      effectivity = 1,
      fuel_inventory_size = 3,
      smoke =
      {
        {
          name = "smoke",
          deviation = {0.1, 0.1},
          frequency = 210,
          position = {0, 0},
          slow_down_factor = 3,
          starting_frame = 1,
          starting_frame_deviation = 5,
          starting_frame_speed = 0,
          starting_frame_speed_deviation = 5,
          height = 2,
          height_deviation = 0.2,
          starting_vertical_speed = 0.2,
          starting_vertical_speed_deviation = 0.06,
        }
      }
    }

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Vehicles can't use electricity, crash for gui.

Post by bobingabout »

I think the issue is when the fuel slot is 0, and you open up the gui where the fuel slot would go.
In the case of a locomotive, it works fine (Tested making it electric powered, but I no way to provide it with energy without scripting, so I've not tried to see if it moves) as long as you don't open the fuel panel. I've not tried with cars/tanks.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: Vehicles can't use electricity, crash for gui.

Post by kovarex »

y.petremann wrote:For now, It looks like that everything that use energy_source can handle burner and electricity.
This is not true, especially not for vehicles. We made few of the entities to work with both types of energy sources, so it works properly even in the gui (lab, assembling machine, furnace), maybe more, it is written somewhere in the change log, but not all of them.

We might do it someday, but it would be mainly a feature addition.

P.S. You can set the burner energy from script, follow the answer in the linked thread.

Post Reply

Return to “Not a bug”