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

Place to get help with not working mods / modding interface.
Post Reply
mmmPI
Smart Inserter
Smart Inserter
Posts: 3372
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

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

Post 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 259 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 37 times

Bilka
Factorio Staff
Factorio Staff
Posts: 3299
Joined: Sat Aug 13, 2016 9:20 am
Contact:

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

Post 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.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

mmmPI
Smart Inserter
Smart Inserter
Posts: 3372
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

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

Post 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 :)

Post Reply

Return to “Modding help”