ps. for those not interested in a life story skip the next paragraph
Okay, so I have been coding with dream maker for a while now, but never did anything really large scale until now. The only problem is I think I bit off a little more than I can chew. I have always been searching the forums constantly for answers to all my coding problems and have found it to be incredibly useful, but for this one I am just completely stumped. For all of you still reading thank you and here's my problem:
I am aware that when you place one turf on top of another in the map editor, there is not actually two turfs during runtime. From what I have read only the topmost layer is actually there and all of the previous layers are stored within its underlays list. That's all well and good but the problem that I am having now is accessing those underlays. For all of you questioning why I might be doing that it is because I am trying to generate my own minimap, and am trying to decide between whether or not to base it off of Caution or Zaltron's tutorial, but no matter which one I choose this will still be a problem. I tried placing their libraries within my game and it basically whites out whatever was behind the upmost turf and my only assumption is that its because (in cautions tutorial), it is only grabbing the icon of the turf and not its underlays as well.
At first I jumped right in and tried looping through the turfs underlays and blending them to the new icon I had created to represent the turf on the minimap, but that didn't do anything. Since then I have tried overlays and even contents to no avail.
Finally I tried some debugging code to see what the problem was and I used the following:
verb
checkTerrain()
var/turf/t = locate(src.x, src.y, src.z)
var/icon/saveTurf = icon(t.icon, t.icon_state)
for(var/icon/i in t.overlays)
usr << "Let their be overlays"
saveTurf.Blend(i, ICON_OVERLAY)
for(var/icon/i in t.underlays)
usr << "Let their be underlays"
saveTurf.Blend(i, ICON_OVERLAY)
for(var/atom/i in t.contents)
usr << "Let their be content of Type: [i.type]"
usr << browse_rsc(saveTurf, "Turfed")
usr << browse("<img src=Turfed>", "window=test")
With the above verb I would simply walk over the turf I wanted to examine and a window would appear displaying the turfs icon
I placed the messages to the user so that I could see if the loops were being run through at all, and their in lies the problem. Whenever I tried to run it, the loops weren't being entered at all. Therefore I assumed that their must not be anything in the underlays (even when I tried to stand over turfs that I had more placed more than one turf on in the map editor).
Stranger than that I tried this next code:
verb
checkTerrain()
var/turf/t = locate(src.x, src.y, src.z)
var/icon/saveTurf = icon(t.icon, t.icon_state)
for(var/i in t.overlays)
usr << "Let their be overlays"
//saveTurf.Blend(i, ICON_OVERLAY)
for(var/i in t.underlays)
usr << "Let their be underlays"
//saveTurf.Blend(i, ICON_OVERLAY)
for(var/atom/i in t.contents)
usr << "Let their be content of Type: [i.type]"
usr << browse_rsc(saveTurf, "Turfed")
usr << browse("<img src=Turfed>", "window=test")
the only difference is that instead of for(var/icon/i in whatever)
its for(var/i in whatever). Basically I am declaring a basic variable rather than an icon one. The results that I found were that the underlays loop was being entered suddenly. So now I am more confused than ever. Any thoughts?
Also if I there is a better way to generate minimaps and all I am doing here is just reinventing the wheel, please let me know.
Problem description: In a nutshell, how do I access the turfs underneath the top most turf that have been placed in the map using the map editor.
Thank you all in advance
Keep in mind, since we are now using normal lists instead of the built in special ones, we can access individual elements. Now you can do with this list anything you could do with the normal underlays and overlays lists. Just remember to "update" the internal underlays and overlays lists when you are done modifying the wrapper version.
Feel free to expand on it and make it more robust/secure/clean/whatever.