stijnwop/manualAttach

ManualAttach + Autodrive = store issue for some vehicles (ManualAttachConnectionHoses.lua:185: attempt to index local 'spec' (a nil value))

dziuch opened this issue · 2 comments

After adding Autodrive to a previously working save with ManualAttach enabled, some vehicles can't be loaded in the store and a following errors show up in the log:

2022-11-20 18:22 Error: Running LUA method 'loadSharedI3DFileAsyncFinished'.
C:/Users/dziuch/Documents/My Games/FarmingSimulator2022/mods/FS22_manualAttach/src/vehicle/ManualAttachConnectionHoses.lua:185: attempt to index local 'spec' (a nil value)

Currently I found two vehicles, that cause that behavior:

Steps to reproduce:

  1. Install following mods on a fresh save:
  2. Start the game and go to the store
  3. Find the Jenz BA 725 D in Implements->Forestry machines and try to buy it
  4. The console shows the error and the vehicle doesn't load in the store

If you buy the vehicle without either Manual Attach or Autodrive enabled, then save, then reenable the mod - the save cannot be loaded and the same error appears in the log.

Full log: https://pastebin.com/C1pri8Nv

I also tried the latest version or Manual Attach from Github and the problem is the same.

In case you wanted a fix for this since every issue opened with this is being ignored, the following changes will make these items work.

src\vehicle\ManualAttachConnectionHoses.lua:80
spec.hasAttachedHoses = true

src\vehicle\ManualAttachConnectionHoses.lua:186
local spec = self.spec_manualAttachConnectionHoses
if spec ~= nil then
return spec.hasAttachedHoses
else
return true
end

Should be fixed with the latest push