ID:2407847
 
Hello, I'm working on updating my minimap code, and there is a particular problem it has with certain maps, I was wondering if there was a way to bypass or still access the exact icon/image and begin manipulating it.

Basically, many map objects are generated within the map editor using "Generate Instances From Icon_states" or "Generate Instances from Directions". When my minimap "scanner" run into these objects, it doesn't pull up the correct replica of the icon, and fucks up the minimap. How do I get a direct copy of these map editor generate icons?

I've tried applying fcopy_rsc() to see if it could help but no luck. Lmk if you got any advice.

                                if(!minimap[T.type])//T is turf thats been scanned
ic=icon(T.icon,T.icon_state)

scalex=ic.Width()/8
scaley=ic.Height()/8

ic.Scale(scalex,scaley)
minimap[T.type]=ic


You could probably use the appearance variable instead of relying on icon/icon_state.
I need the image to be icon format, cuz Im eventually Blending the shrinken icon into a minimap chunk.
You could probably handle a good deal of that using vis_contents and transforms. The only real reason to be using actual icons here is if you're planning on saving the results.

If you absolutely need to use icons though, you'd have to assign more values than icon/icon_state, and stop using the type variable for your minimap list, you'd need to use something more unique, since instances will share a type.
yeah I understand the array needs a more unique id. Thats actually another thing I wanted to mention is do generate instances have separate ids that I can use?
I have to use actually icons and blend them together. I initially tried developing this minimap code using individual objects as pixels or representations and it caused awful lag/sluggishness. So developing them into a single icon was a much more effective applications. That lead to my suggestion of the TILE_BOUND feature. Now I'm dealing with a ridiculously big map and it causes the server to freeze, so I'm updating the code to divide/render the minimap into chunks. And this particular problem dealing with the generated turfs/objs existed before, but it does excessively to the current map I'm working with and I can't get a exact replica of the icon for the minimap.
You'd probably just want your list ID to contain more information than the type, like the variables you tend to be modifying for the instances.

"[T.type][T.icon][T.icon_state][T.layer][T.dir]"


For instance.
Might want to throw a : between layer and dir to avoid some later confusion. Maybe between all of them especially if your icon states can be numbers.
Thanks guys
So the main issue, is with double turfs. When turfs are stacked in the map editor, the minimap scanner only picks up the top layer turf. If I search for a turf in the turf that it picks up will it find the other turf?
The problem is, there are no 'double turfs'. Whenever you place one turf over another in the editor, the bottom turf gets turned into an underlay of the top one, and I don't think there is a way to read that value in game.
Yeah. I tried the adding a code for turf/New() where it would blend icon overlay the underturf and overturf. No luck...
turf
New(var/loc)
var/turf/t = locate(loc)
if(t&&t!=src)
var/icon/i=icon(t.icon,t.icon_state,t.dir)
var/icon/i2=icon(src.icon,src.icon_state,src.dir)
i2.Blend(i,ICON_OVERLAY)
src.icon=i2
t.icon=i2
..()