stijnwop / manualAttach

Manual Attach modification for Farming Simulator 2022
GNU General Public License v3.0
108 stars 29 forks source link

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

Closed dziuch closed 1 year ago

dziuch commented 1 year ago

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.

sdmadsen commented 1 year ago

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

stijnwop commented 1 year ago

Should be fixed with the latest push