L0laapk3 / FactorioMaps

L0laapk3's FactorioMaps mod
https://mods.factorio.com/mod/L0laapk3_FactorioMaps
Other
119 stars 22 forks source link

Update index.js #52

Closed Ptitlaby closed 4 years ago

Ptitlaby commented 4 years ago

Reorder the maps by their time so the vertical map slider show layers ordered by their save time rather by their generation time

Situation : if you generate three maps for the same save in incorrect order (lets say 1h, 10h and 9h), the map will show you the slider in this order

image

With the fix : the slider will have its natural order

image

L0laapk3 commented 4 years ago

Thanks for the pull request!

However, there are some significant problems with out of order rendering, mainly in the ref.py. It compares the images to the last snapshot and deletes the ones that are deemed not changed. Doing any kind of splicing with timelines results in poorly compressed timelines and a lot more work would have had to be done to make it work, since none of the code was made with that use scenario in mind. I'm surprised it even got to the end without crashing :p

I might have a look at it, but with just changing index.js alone definitely I can't publish it. I imagine it would also seriously screw up the map if you build something at 9h and deleted it again in 10h. Maybe another option is to simply prevent people from doing this with an assertion, I'll have to think about it.

Ptitlaby commented 4 years ago

Hello ! Thank you for your answer, and the detailed explanation behind the related issues.

While I believe reordering in the index.js by using the path should be ok most of the time i(if not everytime) if the folder name is simply the number of hours elapsed in the game, you are right in the fact that there will be a bunch of back issues with out of order saves.

I'll work on my headless server configuration to correctly create save backup in the correct order :)