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
21 days ago
0.17 - 1.1
2.42K
Transportation

b [Fixed] crash, due to sandbox/godmode?

6 months ago

in sandbox play, pyAE installed (doubt it's relevant)
added train sensor and used remote on car. short pathing worked.

Tried to enter vehicle by mouseover car, and hitting 'enter' on keyboard
got non-recoverable error:
error while running event autodrive::on_tick (ID 0)
LuaPlayer doesn't contain key player.
stack traceback:
[C]: in function 'index'
__autodrive
/scripts/driving.lua:585: in function 'tick_vehicle'
autodrive/scripts/event_handlers.lua:912: in function
<autodrive/scripts/event_handlers.lua:883>

Sorry, I crashed your mod within the first 30 seconds I used it. :P

6 months ago

Thanks for the report!

Sorry, I crashed your mod within the first 30 seconds I used it. :P

No problem, I prefer hard crashes that alert me to something I haven't taken care of properly over silently ignoring errors in the logic that may manifest themselves in some unexplainable effects.

Short-term fix (hopefully): Unpack the mod, open file scripts/driving.lua, and go to line 584:

if driver then
  AD.show("driver is player", AD.argprint(driver and driver.player))
end

AD.show("passenger", AD.argprint(passenger))
if passenger then
  AD.show("passenger is player", AD.argprint(passenger and passenger.player))
end

What happens if you comment out the lines with AD.show("driver is player", …) and AD.show("passenger is player", …)? (You can comment out lines by putting -- at the start of the line.) These lines are just for debugging. I wonder if you'll get more errors further on.

6 months ago

Commenting the two lines allowed godmode to enter vehicle and move it.
Allows this mod to be used as intended.

6 months ago

Great! I think I've changed my WIP version so much that the offending lines have already been removed there. Also, I've learned something new today: how to enter a vehicle in god/editor mode. Now it really makes sense that entity.get_driver() will return either a character or a LuaPlayer.

As you are using the train sensor: What do you think, is it still necessary? In version 1.1.5, I've added bouncing. Collisions of Autodrive-controlled vehicles with trains will now result in cars bouncing off trains, or trains pushing the cars out of their way. As train collisions are no longer deadly, I feel that the train sensor has been made obsolete. What do you think? Should I remove it, or should I work on improving it? (The way it's currently working, the train sensor will look for rails and trains anywhere in a circular area around the vehicle position, which isn't very precise. This could be improved by looking for rails/trains in a straight line running from the vehicle position in the direction its moving.)

6 months ago

Sorry - I can't answer that yet. Grand total of about 40 minutes with your mod. I haven't used it in any freeplay yet.

I'm not saying I won't play with it, it has use! But I haven't yet fully (ab)used this mod yet.

Currently trying to work out some other issues in game too.

6 months ago

Fixed in 1.1.6!

New response