Nanite-Construction-System / NaniteConstructionSystem

A continuation of scripts for the Nanite Construction System
14 stars 13 forks source link

Fix for #160 and #113 #161

Closed stefan2200 closed 3 years ago

stefan2200 commented 4 years ago

Might require some further testing but it worked for over 30 minutes on projection, construction, deconstruction and life support without any issues. This merge should fix #160 and #113

M0dEx commented 4 years ago

Looks good to me.

I'm actually quite ashamed that I didn't find the time to get to the bottom of all the bugs, since I am still figuring out some personal stuff.

Thank you for this. I'll test this and merge it into the master branch.

stefan2200 commented 4 years ago

Thanks for the quick reply!

Hopefully this merge fixes the issue because NCS is one of those essential late-game mods. But I'm still trying to figure out what caused the issue in the first place, it looks like the Parallel did not seem to like the remove list since m_particles contained over 60.000 entries after 40 minutes of playing.

That is why I also implemented if (item != null) item.Unload(); if (m_particles != null && m_particles.Contains(item)) m_particles.Remove(item); since Remove removes the instance of item and not the value (null).

If I find the time I might look into some of the other open issues, especially #147 since that one starts to annoy me :)

Good luck testing!

M0dEx commented 4 years ago

Yeah, it is absolutely possible that the sheer amount of entries lagged the main-thread into oblivion. Doing it with Parallel.ForEach like this seems like a better way.

I also just found out that I cannot really test this myself, since I permanently moved to Linux (Windows sucks) and I can't get it to work here. The only thing I can do is just code in Rider.

stefan2200 commented 4 years ago

Hmmm perhaps any other maintainers can take a look sometime, my NCS dev is working again so no hurry :)

nukeguard commented 3 years ago

thanks Stefan, I've checked the merge out and I have not been experiencing the save bug, I also don't have a world where that was happening, so if someone has a world with that problem, I can try it out.