LuaEntity.stop_spider() has no effect
Posted: Wed Sep 21, 2022 6:04 pm
Expected behavior: If a spider-vehicle is in motion, it will immediately stop once it has received the stop_spider() command.
Real behavior: For this code
I get the following output:
Neither vehicle.autopilot_destination nor vehicle.autopilot_destinations have been affected by vehicle.stop_spider(), and the vehicle happily continued on its path.
The only way to make sure the vehicle stops seems to be this:
This isn't very intuitive. Shouldn't stop_spider() automatically clear autopilot_destination/autopilot_destinations?
Real behavior: For this code
Code: Select all
AD.show("vehicle.autopilot_destination", vehicle.autopilot_destination)
AD.show("vehicle.autopilot_destinations", vehicle.autopilot_destinations)
AD.writeDebug("Trying to stop spider!")
vehicle.stop_spider()
AD.show("vehicle.autopilot_destination", vehicle.autopilot_destination)
AD.show("vehicle.autopilot_destinations", vehicle.autopilot_destinations)
Code: Select all
20189.718 Script @__autodrive__/libs/debugging.lua:167: vehicle.autopilot_destination: {
x = -11.5,
y = -17.5
}
20189.718 Script @__autodrive__/libs/debugging.lua:167: vehicle.autopilot_destinations: {
{
x = -11.5,
y = -17.5
},
{
x = -11.5,
y = -18.5
},
{
x = -12.42578125,
y = -19.06640625
}
}
20189.718 Script @__autodrive__/libs/debugging.lua:167: Trying to stop spider!
20189.718 Script @__autodrive__/libs/debugging.lua:167: vehicle.autopilot_destination: {
x = -11.5,
y = -17.5
}
20189.718 Script @__autodrive__/libs/debugging.lua:167: vehicle.autopilot_destinations: {
{
x = -11.5,
y = -17.5
},
{
x = -11.5,
y = -18.5
},
{
x = -12.42578125,
y = -19.06640625
}
}
The only way to make sure the vehicle stops seems to be this:
Code: Select all
for w, waypoint in pairs(vehicle.autopilot_destinations) do
vehicle.autopilot_destination = nil
end