[Lou][2.0.41] Issues with scripting and remote driving

This subforum contains all the issues which we already resolved.
Gorfiend7
Burner Inserter
Burner Inserter
Posts: 5
Joined: Thu Jun 16, 2022 5:41 pm
Contact:

[Lou][2.0.41] Issues with scripting and remote driving

Post by Gorfiend7 »

Ran into a couple issues with remote driving using a script/mod, where you can be driving a vehicle but have your camera on a different surface, or cause a vehicle to be stuck with a "ghost" remote driver (similar to this previous report).


First issue setup: Place a tank on Nauvis, and go to another planet (say, Fulgora).
Run this in the console:

Code: Select all

/c local tank = game.surfaces["nauvis"].find_entities_filtered({name = "tank"})[1] tank.set_driver(game.player)
You will be driving the tank, but your camera will still be on Fulgora. If you get out of the tank, you will get out on Fulgora.


Second issue setup: Place a tank and a spidertron on Nauvis.
Run this:

Code: Select all

/c local tank = game.surfaces["nauvis"].find_entities_filtered({name = "tank"})[1]
game.player.set_controller({type = defines.controllers.remote, surface=tank.surface})
tank.set_driver(game.player)
Switch to map view (press tab)
Run this:

Code: Select all

/c local spider = game.surfaces["nauvis"].find_entities_filtered({name = "spidertron"})[1]
game.player.set_controller({type = defines.controllers.remote, surface=spider.surface})
spider.set_driver(game.player)
The tank is now in the broken state again - it shows the green "Drive Remotely" button, but clicking it fails and pops up the "Vehicle already has a driver" message.
It works properly without the "Switch to map view" step, letting you directly swap between remote driving the two vehicles. The "surface" parameter to set_controller is also important - leaving that out allows it to work properly.
User avatar
Lou
Factorio Staff
Factorio Staff
Posts: 292
Joined: Mon Nov 30, 2020 10:50 am
Contact:

Re: [Lou][2.0.41] Issues with scripting and remote driving

Post by Lou »

Thank you for the report. Since 2.0.55:
- calling set_driver in cases which would cause character to change surfaces is not supported and should throw an error.
- in other cases your controller position and surface should be updated to correspond with the driven vehicle
Post Reply

Return to “Resolved Problems and Bugs”