ID:264615
 
Code:
//this matter has a lot of repeated code, so one of the calls to the following object's New:
if(b.privs&IUPD_HANDGUN) items += new /obj/hud/iupd/weapon_container(null,"handgun","Smith and Wesson .38 special",32,"SOUTH,WEST")
//several more of these to construct the entire display shown below
c.client.screen.Add(items)

obj/iupd/hud/weapon_container
mouse_opacity = 1
layer = EFFECTS_LAYER+1
New(l,p,n,w,s)
..(l)
src.name = n
src.width = w
src.icon = Server.resource("iupd_weapon_bg_disabled-[src.width]")
src.overlays += Server.resource("iupd_weapon_[p]")
src.screen_loc = s


Problem description:
When the server is initialized, all of the states contained in a pair of DMI files in my project are created as new icon()s and stuffed into a list for future use. I went this route because they have no container /objs and their only purpose is to be an overlay on a button on HUD elements, and I figured I could save some memory by loading them all up once, and using the same /icon object on every player's screen (of course, if this is a bad idea then feel free to suggest better methods). This has somehow netted me a problem, though:


But if I simply maneuver the IUPD logo beyond the map bounds:


My question is: why? What exactly happens when a screen object is displayed over a map void that'd make this display suddenly work?

I'm using the TOPDOWN_MAP format on 462.1056, and each element above is used at their native size (32x32 and 64x32, as applicable).
Your BYOND version is ?
In response to Getenks
Getenks wrote:
Your BYOND version is ?
462.1056.
Your layer is set incorrectly. It should be EFFECTS_LAYER+OBJ_LAYER. See the Reference entry here.
In response to Garthor
Garthor wrote:
Your layer is set incorrectly. It should be EFFECTS_LAYER+OBJ_LAYER. See the Reference entry here.

That doesn't seem to have any effect, it still exhibits the behavior described above.
In response to Mobius Evalon
Whoops, mis-read what you had.

How are you creating the icons returned by resource()?
In response to Garthor
Garthor wrote:
Whoops, mis-read what you had.

How are you creating the icons returned by resource()?

for(var/a in icon_states('iupd_weapons-32x32.dmi')) src.add_resource(a,icon('iupd_weapons-32x32.dmi',a))
for(var/a in icon_states('iupd_weapons-64x32.dmi')) src.add_resource(a,icon('iupd_weapons-64x32.dmi',a))

Server/proc
add_resource(name,icon)
if(!src.preloaded) src.preloaded = new /list
src.preloaded[name] = icon
remove_resource(name)
if(!isnull(src.preloaded))
src.preloaded -= name
if(!src.preloaded.len) src.preloaded = null
resource(name)
if(!isnull(src.preloaded) && (name in src.preloaded)) . = src.preloaded[name]
In response to Mobius Evalon
That is quite weird, and looks like a BYOND bug to me. For now, a workaround is to be adding an obj with that icon to overlays, instead of the icon itself.