[Lou][2.0.41] Issues with scripting and remote driving
Posted: Fri Mar 21, 2025 7:54 pm
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:
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:
Switch to map view (press tab)
Run this:
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.
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)
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)
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)
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.