AtomicTorch Studio Forums

VoidExpanse => Help section => Topic started by: loudent on April 21, 2015, 05:36:00 PM

Title: Script works but I'm getting an error after it completes
Post by: loudent on April 21, 2015, 05:36:00 PM
Ok, I've been wrestling with this for days and I finally got a proof of concept working except I'm getting this error after the script finishes:

21.4.15 17:25:22.8945 [ERR] Unhandled exception in Server game loop
Exception System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
   -------------------------stack-------------------------
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
   at System.Collections.Generic.List`1.Enumerator.MoveNext()
   at jvMuEfWa4dI5JoCFn5h.qLinMVWiyGcCwUBomHI.LNLpgxUlx9(Double  )
   at vxVLwDhWYiEysuRM7sN.ml7y5YhuRUkrQAmipFF.<>c__DisplayClassc.<ServerTick>b__2()
   at yh4Zn3002uxc4RoZtM8.gAxJV70qX9ONgNlNcs7`1.FnFGVddIss(Func`1 function, Func`1 shouldAbortCheckFunction)
   at vxVLwDhWYiEysuRM7sN.ml7y5YhuRUkrQAmipFF.lPDtIYPk3R(Double  )
   at vxVLwDhWYiEysuRM7sN.ml7y5YhuRUkrQAmipFF.EaltAtbg4x()

The script can be found at https://www.dropbox.com/s/wmofwjt210nq4cg/ldt_JettisonCargo.js?dl=0
Title: Re: Script works but I'm getting an error after it completes
Post by: ai_enabled on April 22, 2015, 12:00:54 AM
Hi!
How often does it happen?
Usually it's nothing serious and caused by some limitations in the server engine and can happens sometimes even if you're playing without any mod. It doesn't cause any harm, but the exception is written to the log.
If it always happens after execution of the script from your mod, then upload the mod and we will test and fix it.
Regards!
Title: Re: Script works but I'm getting an error after it completes
Post by: loudent on April 22, 2015, 12:16:36 AM
It happens every time.

And the script I linked to in my original post is pretty much the entire mod.
Title: Re: Script works but I'm getting an error after it completes
Post by: ai_enabled on April 22, 2015, 10:50:24 PM
Thanks for the script.
It will be fixed with the next build. It happens because you're adding a crate (which is a physics body) while the server iterating the list of the physics objects. So collection was modified and it stops processing it. However, it stops only for the current server frame and it will continue on the next frame, so this exception is just a warning for us, don't worry about it - it should works fine!
Regards!
Title: Re: Script works but I'm getting an error after it completes
Post by: loudent on April 22, 2015, 11:00:48 PM
thanks, finished up the script and added my mod.