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
a month ago
0.17 - 2.0
3.27K
Transportation Combat Logistic network Circuit network

g [Pending] Crash in multiplayer when I get in friend's car

29 days ago

The mod crashes the game when I get in my friend's (multiplayer host) car

The mod Autodrive (2.0.4) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event autodrive::on_player_driving_changed_state (ID 33)
The mod Autodrive (2.0.4) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event autodrive::on_entity_color_changed (ID 197)
The mod Autodrive (2.0.4) caused a non-recoverable error.
Please report this error to the mod author.

29 days ago

Error while running event autodrive::on_entity_color_changed (ID 197)
autodrive/scripts/event_handlers.lua:2154: C stack overflow
stack traceback:
autodrive/scripts/event_handlers.lua:2154: in function <autodrive/scripts/event_handlers.lua:2150>
stack traceback:
[C]: in function 'newindex'
__autodrive
/scripts/vehicles.lua:4788: in function 'paint'
autodrive/scripts/vehicles.lua:4798: in function 'reset_color'
autodrive/scripts/event_handlers.lua:2191: in function <autodrive/scripts/event_handlers.lua:2150>

29 days ago
(updated 29 days ago)

Thanks for the report, I'll look into this! By the way, are you using GCKI as well?

The mod crashes the game when I get in my friend's (multiplayer host) car

Does this mean that your friend already is in the car when you enter it?

28 days ago

Nope, just autodrive. Also nope, friend wasn't in his car when i entered it if i remember correctly

8 days ago

I've figured out what happened: on_entity_color_changed is raised whenever an entity changes color, so before recoloring a vehicle we store vehicle.unit_number and expected color. When the event is raised and both vehicle.unit_number and color of the vehicle match the stored data, we skip the event – otherwise we try to set vehicle color to the color of the player who owns the vehicle (i.e. your friend). This works in single player (where the player also is the vehicle owner), but if we change vehicle.color in multiplayer, it will be overridden with the color of the player who entered the vehicle. In this case, vehicle.color and expected color differ, so we set vehicle.color again which will raise another on_entity_color_changed event, etc. – until the game crashes with a stack overflow error.

As a temporary fix, please replace lines 4721-4723 in function _common_vehicle.reset_color() (file scripts/vehicles.lua):

  if not (vehicle and vehicle.valid) then
    AD.arg_err(vehicle, "vehicle")
  end

with the following:

  if not (vehicle and vehicle.valid) then
    AD.arg_err(vehicle, "vehicle")
  end

  do
    occupants = common_vehicle.get_occupants(vehicle)
    local d = occupants and occupants.driver
    local p = occupants and occupants.passenger
    if (d and d.valid) or (p and p.valid) then
      AD.entered_function({}, "leave", "Can't set vehicle color (player inside)!")
      return
    end
  end

This way, vehicle won't be recolored if any player (or character connected to a player) is still inside the vehicle.

New response