stijnwop/hoseSystem

LUA-Callstack when connecting hoses to the tanking point (slurry pit)

FarmerAndy opened this issue · 5 comments

Is there a possibility for the system to be throw a callstack error on maps which have the HoseSystem built in?
Because I get the following Callstack-Error when connecting a hose to the slurry pit:

Error: Running LUA method 'update'.
C:/Users/Administrator/Documents/My Games/FarmingSimulator2017/mods/FS17_hoseSystem/specializations/objects/HoseSystemLiquidManureFillTrigger.lua:523: attempt to index field 'animatedObjects' (a nil value)

My entries in map01.xml are as follows:

<hoseSystemFillTriggers>
  <hoseSystemFillTrigger identifier="cowLiquidManure">
    <pit planeNode="0>0" planeMinY="-0.402" planeMaxY="0.482" />
     <hoseSystemReferences>
	<hoseSystemReference node="0>2" /> 
     </hoseSystemReferences>
  </hoseSystemFillTrigger>
		
  <hoseSystemFillTrigger identifier="pigLiquidManure"  >
   <pit planeNode="0>0" planeMinY="-0.477" planeMaxY="0.5" />
    <hoseSystemReferences>
     <hoseSystemReference node="0>2|0" /> 
    </hoseSystemReferences>
  </hoseSystemFillTrigger>
</hoseSystemFillTriggers>

I have found a solution to the error, but I am at a loss of finding out the reason for the error to occur in the first place.

Original Entry:

local animatedObject = g_currentMission.animatedObjects[reference.lockAnimatedObjectSaveId]

Fixed Entry:

local animatedObject = nil;

if g_currentMission.animatedObjects ~= nil then
animatedObject = g_currentMission.animatedObjects[reference.lockAnimatedObjectSaveId]
end

These are the changes I have made in Lines 523 and 556.
It solves the problem, but I would be happy to know if you have a more elegant solution for it :-)

Thank you for looking into this!

Kind regards,

Farmer_Andy of www.modding-welt.com

Lock and Manure flow animations are not supported yet on Map objects.

So adding the animated objects saveId on the hose system reference will trigger some functionality i did not yet complete.

I will open an issue soon according this feature.

talking about making maps compatible with hose system, why isn't there a tutorial on how to do that?

Tutorial will follow someday, when i find time for it. To busy with other things currently.

Please confirm the fix. ;)

confirmed !

bug is gone , all fine now !

thx woppie ;)
best regards grazy