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
2 months ago
0.17 - 1.1
2.98K
Transportation Combat Logistic network Circuit network

b [Fixed] Many many me's

6 months ago
(updated 6 months ago)

Each time i use the remote to path a vehicle to a new location, a dummy driver pops out.
https://imgur.com/a/Wdg7qdi

6 months ago

I can't reproduce that. Could you upload a saved game where this happens?

5 months ago

Looks like the triggering condition is havign a gate sensor in the grid

anyway debug-autodrive.zip is a minimal save where it happens
https://drive.google.com/drive/folders/1xjIewJztt8WLFGV9qI64GrIgymN7Ubsj?usp=drive_link

5 months ago
(updated 5 months ago)

Thanks for the saved game! I know now what went wrong!

Looks like the triggering condition is havign a gate sensor in the grid

Actually, that's just one thing that may trigger this. It would happen when the vehicle needs to have a driver or passenger, which is true if a vehicle following a path has a gate sensor, or if it has an enemy sensor and guns with ammo and needs a shooter because it has detected enemies within range of its weapons.

Up to version 1.1.12, we'd check vehicle.get_driver() and vehicle.get_passenger() on each tick to find out whether a dummy must be inserted. In 1.1.13, I've changed this to storing the list of occupants with the vehicle state whenever on_player_driving_changed_state was raised. However, that list wouldn't be preserved when a vehicle was reset (e.g. when it had arrived at its destination).

So, with versions >=1.1.13, the first time a path was set for the vehicle, everything would be normal: If there was neither a driver nor a passenger, a dummy would be created and put in the passenger seat. When the vehicle arrived, the dummy would still be passenger, but as there was no record of it, another dummy would be put in the passenger seat the next time the vehicle was following a path, and the existing dummy would be ejected.

As a quick fix before I can upload the next version, try adding

state.occupants = common_vehicle.get_players_inside(vehicle)

at line 576 of scripts/vehicle_functions.lua (directly after state = mod.vehicles[state.id]).

EDIT: Sorry, made a mistake! I've renamed the function for the new version, so common_vehicle.get_occupants wasn't correct. Use common_vehicle.get_players_inside when you fix this for version 1.1.13!

5 months ago

yup, that seems to have fixed it :)

5 months ago

Great! The fix is included in version 1.1.5, which I've just uploaded.

New response