var list/imgs = new
proc/Icon2Browser(icon_file)
var list/states = icon_states(icon_file)
for(var/state in states)
imgs[state] = image(icon_file,null,state)
mob/proc/PreloadIcons2Browser()
world.name = "Loading [imgs.len] Images"
for(var/i in imgs)
src << browse_rsc(imgs[i],i)
Understanding
You'd call Icon2Browser() at worldstart as needed.
You'd call PreloadIcons2Browser() when connecting as to allow for icons in the browser.
Problem description:
Trying to take a .dmi file and grab all the current states from inside it, which works, and then I add them to a global variable "imgs" which stores a image created using the icon and state.
However this doesn't seem to work with browse_rsc() as I run into this issue
--> runtime error: bad resource file
-.-
Is there an easy way to load an entire icon file into the browse cache so that I can use multiple icon_states within it? Driving me crazy.
While it seems to work for the output, I thought that turning each state into its own /image object would allow to preload it via browse_rsc as it says it accepts images, but it's still only grabbing the 1st frame.