Page 1 of 1

data-update vs data-final-fixes with 2 dependant mods to order speaker sound list : i don't understand why i fail

Posted: Wed Jun 12, 2024 9:43 am
by mmmPI
I made one mod adding the (musical) instruments highlighted in red, and a different mod adding the (musical) instruments highlighted in yellow/blue.

https://mods.factorio.com/mod/Robotic-V ... or-Speaker
https://mods.factorio.com/mod/DJRobotMIXTAPE1/

I don't understand what i'm doing wrong that cause 1 instrument to appear in the middle of the list from another mod and not at the bottom :
outofclue.jpg
outofclue.jpg (59.83 KiB) Viewed 516 times
The mod adding the yellow/blue song is adding all of them in the data-update stage and has an optionnal dependancy on the other mod adding the song in red.

The mod adding the song in red adds some of them in the data-update stage those are fine, but there is this one 1 category, the problematic one, that is added in the data-final-fixes stage. I was expecting this to cause it to appear AFTER ALL the othe songs in yellow/blue ideally, or at least at the end of the "red" list.

I read this page : https://lua-api.factorio.com/latest/aux ... cycle.html

But i still don't understand why it appears "in the middle" of the list from the other mod.

This is an empty save with just a speaker and only the 2 mentionned mods in case it help someone helping me :) :
WHATAMIDOING.zip
(2.15 MiB) Downloaded 58 times

Re: data-update vs data-final-fixes with 2 dependant mods to order speaker sound list : i don't understand why i fail

Posted: Wed Jun 12, 2024 10:01 am
by Bilka
The mod that adds the instruments in data-updates is inserting into speaker.instruments[#speaker.instruments+2] and speaker.instruments[#speaker.instruments+3] etc, so it is leaving gaps. The final fixes mod inserts the instruments into one of those gaps.

The first mod would have to insert into speaker.instruments[#speaker.instruments+1] to not leave gaps or use the more foolproof table.insert without an index.

Re: data-update vs data-final-fixes with 2 dependant mods to order speaker sound list : i don't understand why i fail

Posted: Wed Jun 12, 2024 12:15 pm
by mmmPI
Thank you, i will document on the table.insert to try and fix the things that worked despite the way it was done :)