Greetings,
I am trying to add overlays to a turf that also overlay any objects and mobs which enter the turf, but obviously since the turf is below the mob the overlay is also..
At first I tried spawning a lot of objects to do it and it worked but it's way too CPU intensive. Simply adding the icon to a turfs overlays fixed the CPU problem but didn't overlay mobs and objects with the icon as well.
Is there a CPU friendly way to overlay an area with an icon that also is on a higher layer than mobs and objects?
ID:158606
Jul 31 2009, 1:26 am
|
|
In response to Demon_F0rce
|
|
Hmm thanks yeah I tried that and it works but I can't get it off afterwards T.overlays -= /obj/circle didn't work.
|
In response to Liens
|
|
Which I find strange, since that works for me. Did you wait the full 6 seconds (assuming you're testing out the test code I used)?
|
In response to Demon_F0rce
|
|
obj/Block That's the code I'm using to do it, I put a world << 1 in to see if it is actually getting that far and it does, so I don't see what is stopping it from removing the overlay... |
In response to Liens
|
|
That's because you've changed the icon from the default, so removing the type path will no longer work (as that simply fetches the default icon for the type). You'll need to store the created obj in a variable and then remove that one specifically (speaking of which: create the obj BEFORE the loop, not within it):
var/obj/Block/B = new(usr) Note that you can use image objects instead of objs in this case, which just makes more sense. |
In response to Garthor
|
|
Yes, but also if you want the overlays to do more, for example:
obj/pithole It would be much easier, not sure if even possible, to simply add the obj (I don't know why you'd want some like this, but eh...). |
In response to Demon_F0rce
|
|
If you want overlays to do anything but look pretty then you should not be using overlays, because that's all they can do.
Not even going to go into how you managed to pack in as many errors as lines of code, there. |
In response to Garthor
|
|
Thanks man, that was a big help!
|
Notice how I've set the circle's layer to 5? This is the higher than the highest pre-defined layer, the highest being MOB_LAYER at 4. Simple think of layers as an ordering system of importance, where the atom with the highest layer is shown at the top, and atom's with similar layers are displayed depending on which was put their last.