Page 1 of 1

Bug in offshore-pump sprite tint

Posted: Thu Dec 30, 2021 11:14 am
by Ondras4620
Hello i've been modding for while and made mod for tinting with help of somebody on Factorio discord but nobody could find out what my error means,

error is 100% replicatable
error is in serpernt.block
error and log files are atteched to this post

what i was about to do ? i have some functions that loops a lot but main thing is to give function sprite and tint color
after that my function should recursively run until it finds sprite with hr_version or layers, after that it tints

what i got ? Error... error about boolean on sprite ? yeah i cant give more detail cause there is nothing very useful in logs if you undestand modding then check it out thanks everyone !! :)

Any suggestions are accepted too! this might be question for devs too.

Re: Bug in offshore-pump sprite tint

Posted: Thu Dec 30, 2021 1:00 pm
by Pi-C
Ondras4620 wrote: Thu Dec 30, 2021 11:14 am what i was about to do ? i have some functions that loops a lot but main thing is to give function sprite and tint color
after that my function should recursively run until it finds sprite with hr_version or layers, after that it tints

what i got ? Error... error about boolean on sprite ? yeah i cant give more detail cause there is nothing very useful in logs if you undestand modding then check it out thanks everyone !! :)
You wrongly assume that the argument "sprite" that you pass on to setTint() will always be a table. The error in this case was caused in solveWorldPoints(), where you iterate over all values in the table and call setTint() for each value. Just add a type check and it should work. I've made a minimal example (removed cruft, added logging, and added the check) that will work. Just replace data-updates.lua with this version, run it, and check the log file. You probably should add such a test to dePipeIfy as well. It didn't throw an error with the prototypes you've used, but it could crash with other prototypes.