bicon() is fukt when called on icons, not objs
Created by: 9600bauds
We have here two procs:
/obj/machinery/chem_master/proc/test_w_bicon()
for(var/i = 1 to MAX_PILL_SPRITE)
var/icon/I = icon('icons/obj/chemical.dmi', "pill" + num2text(i))
to_chat(world, "Pill number [i] / Ref: \ref[I] / Bicon says: [bicon(I)]")
/obj/machinery/chem_master/proc/test_w_icon2base64()
for(var/i = 1 to MAX_PILL_SPRITE)
var/icon/I = icon('icons/obj/chemical.dmi', "pill" + num2text(i))
var/fuckmasterflex = icon2base64(I)
to_chat(world, "Pill number [i] / Ref: \ref[I] / icon2base64 says: <img src='data:image/png;base64,[fuckmasterflex]'>")
If bicon() worked correctly, both of these would give the exact same results.
The second proc seems to work fine:
but bicon() only gives the first 2 pills over and over (ignore the fact that the icons look smaller):
So what's the problem here? Well, if you look at bicon(), it stores icons in a global cache to prevent doing the same icon twice. The problem here is that it indexes the icons by reference, under the assumption that an icon's reference will never change, I think However that is not the case as seen with these procs: After an icon gets generated, it gets deleted, and a new icon takes up the reference. Pill icons 3+ onwards ARE being created correctly, bicon() just sees them, looks at the reference, and says "oh hey it's pill1 I saw just now". I hope I'm explaining the issue correctly here. See browseroutput.dm, line 199