Autodrive

by Pi-C

Car equipment for train avoidance, logistic network integration, circuit network connectivity, fuel refill, ammo reload, vehicle repair, radio control, enemy targeting, and gate control.

Content
a month ago
0.17 - 1.1
2.97K
Transportation Combat Logistic network Circuit network

g [Fixed] How to use with AAI?

1 year, 4 months ago


I tried to install AAI things.
How to make work with AAI?

1 year, 4 months ago
(updated 1 year, 4 months ago)

Thanks for the report! It looks like "Autodrive" tried to access the ammo slot of a weapon that has been removed from the vehicle. I know that "AAI Programmable vehicles" creates new versions of the existing vehicle prototypes, with only one weapon (e.g. an AAI controlled tank would have either machine gun, flame thrower, or cannon, while a vanilla tank would have all). But these are different prototypes, so I don't understand what's happening here.

Could you upload a saved game that will crash with the above error shortly after loading? This way, I could reproduce what other mods you are using and what exactly is going on there.

Apart from this: Did you know that you can copy the error message? Just select the text in the error notice window and hit CTRL+C! Then you can paste the text here (you should indent each line of the error message with 4 spaces, so the text will be interpreted as code instead of being reformatted according to MarkDown syntax). The screenshot was rather small, and on zooming in, the text became rather blurry and was extremely hard to read for me -- unfortunately, my eyes aren't at their best capability anymore.

1 year, 4 months ago

Thanks, that makes sense! "AAI Programmable vehicles" will remove the flamethrower of the vanilla tank if aai-vehicles-flame-tank is used, and the machine gun if aai-vehicles-chaingunner is active. If the last weapon used by your vanilla tank was in slot 2 or slot 3, it wouldn't be available anymore, so the game would crash.

I'm still dealing with some other bug, so I can't upload my WIP version yet. But you can patch this yourself by unpacking Autodrive and editing file vehicle_lists.lua in its top directory. Go to line 927 and replace

    for v, vehicle in pairs(vehicles) do
      inv_type = (vehicle.type == "car") and "car" or "spider"
      trunk = vehicle.get_inventory(defines.inventory[inv_type.."_trunk"])
      clip = vehicle.get_inventory(defines.inventory[inv_type.."_ammo"])
      guns = vehicle_map[vehicle.type][vehicle.name].guns

      for slot = 1, #clip do

with

    for v, vehicle in pairs(vehicles) do
      inv_type = (vehicle.type == "car") and "car" or "spider"
      trunk = vehicle.get_inventory(defines.inventory[inv_type.."_trunk"])
      clip = vehicle.get_inventory(defines.inventory[inv_type.."_ammo"])
      guns = vehicle_map[vehicle.type][vehicle.name].guns

      if guns and vehicle.selected_gun_index > #guns then
        vehicle.selected_gun_index = #guns
      end

      for slot = 1, #clip do
1 year, 4 months ago

Also, I put a tank in world and used the remote control on it, now I can't put the tank in my "pocket" anymore.
Can you create a way for remove autodrive from a tank?

1 year, 4 months ago

Same world, same mods? I couldn't reproduce this, and Autodrive actually shouldn't make vehicles unminable. But if it is a strong tank with lots of health, it could be that it has a long mining time.

Nevertheless, your saved game has already been quite useful! Playing around with it (very slow because my computer is a 10-years-old potato, so even loading a 300MB saved game from the main menu takes several minutes) unearthed some more box that I've fixed. :-)

1 year, 4 months ago

I have 1 tank in another planet in SE+K2
Only this is not mineable "this cannot be mined while anyone is in it"

1 year, 4 months ago

OK, I guess there's a dummy inside the tank. You can get rid of it by opening the GUI and clicking the "Remove from GUI" button. This will release the tank, so you can mine it again.

1 year, 4 months ago

No, the dummy persist.
i only used it for try enter in a "geometric structure" from space exploration without success, so i abandoned.

1 year, 4 months ago

I have 1 tank in another planet in SE+K2
Only this is not mineable "this cannot be mined while anyone is in it"

In the save you've uploaded, there is a tank ("Cachorro") on nauvis, and another tank ("Guarda") on Curaga. I've confirmed that there is no character in the tanks. However, the only geometric structures I've found are on Theros and Brion, so if you're trying to enter one, you must have moved the tank and perhaps something happened to it on that way.

Just to rule out the most obvious mistake: Did you accidentally enter the tank yourself before you tried mining it? This would explain the "cannot be mined while anyone is in it" message. If you didn't, can you upload the game at the point where you can't mine the tank?

1 year, 4 months ago

Thanks you! As expected, there's a dummy in that tank. However, it's the driver instead of the passenger, that's why removing the tank from the GUI didn't remove the dummy from the tank. I'm not sure how the dummy could become driver, but I'll take care that it can't happen again. Meanwhile, you can hotfix this yourself. Just add a file "remove_dummy_drivers.lua" to the migrations folder, with this content:

local vehicles, vehicle, driver
for s, surface in pairs(game.surfaces) do
  vehicles = surface.find_entities_filtered({type = AD.vehicle_types})
  for v, vehicle in pairs(vehicles) do
    if vehicle and vehicle.valid then
      driver = vehicle.get_driver()
      if driver and driver.valid and driver.name == AD.dummy_passenger_name then
        driver.destroy()
      end
    end
  end
end

Remember to restart Factorio after you've added the migration file! Just reloading the saved game won't help as Factorio doesn't know about the new file yet.

1 year, 1 month ago

Fixed in 1.1.6!

New response