Changing specific filepaths for sprites.
Posted: Fri Oct 25, 2024 8:12 pm
So im pretty new to modding factorio and i wanted to implement a really basic line in data.lua that just changes the base sprite of the small electric pole.
After some research i found the image filepath was defined as the first index in layers under the property filename and so wrote this code.
This gives the error "attempt to index field '?' (a nil value)" which im assuming is saying that the 'layers' field doesnt exist.
Is this just me being bad a lua or misunderstanding how factorio handles its data.
Because i dont want have to redefine the entire layers field from scratch but with different filepaths which i know works but is really tedious.
Any help is appreciated!
After some research i found the image filepath was defined as the first index in layers under the property filename and so wrote this code.
Code: Select all
data.raw["electric-pole"]["small-electric-pole"]["pictures"].layers[0].filename = "$FILEPATH"
Is this just me being bad a lua or misunderstanding how factorio handles its data.
Because i dont want have to redefine the entire layers field from scratch but with different filepaths which i know works but is really tedious.
Any help is appreciated!