/mob
Move()
for(var/icon/I in usr.underlays)
usr.underlays -= I
Problem description:
Shouldn't this be getting rid of all the underlays?
I want it to delete all underlays every time i move(Don't ask why)
ID:142264
Jul 8 2008, 4:02 pm
|
|
Code:
/mob Problem description: Shouldn't this be getting rid of all the underlays? I want it to delete all underlays every time i move(Don't ask why) |
Jul 8 2008, 4:06 pm
|
|
When you add something to the overlays var, it is converted to the /image type. It should work if you change icon to image.
|
In response to Jeff8500
|
|
var/obj/raft/I = new()
underlays += I this is what adds it |
No usr in proc.
Also a clean way of doing that would be: mob/Move() |
In response to Jeff8500
|
|
It doesn't turn to /image, it turns to a totally different, special object.
Just nulling underlays should work. 'usr' should NEVER be used in mob/Move(). Why are you deleting the underlays everytime someone moves? Sounds very needless to me. |
In response to GhostAnime
|
|
Really? I asumed it was /image.
|
In response to Jeff8500
|
|
Don't assume, read the Reference... >_>
|
In response to Kaioken
|
|
........Or my post <_<
|
In response to GhostAnime
|
|
Because i have my own reasons...
And what is this special object? Is there a way to remove that specific object from underlays? |
In response to Lcooper
|
|
Lcooper wrote:
And what is this special object? Read The Reference. Basically, it's a special type of object that is not meant to be interacted with, and little interaction is possible to do with it, anyway. Is there a way to remove that specific object from underlays? Duh. Again, Read The Reference. Removing the same thing you've added to the overlays/underlays list with the usual Remove() or -= works, just don't try to access the items by looping through them. underlays.Cut() and the [probably better] underlays = null also work, the latter unusual, but it works for the built-in, special lists. |
In response to Kaioken
|
|
I dont want to null the whole thing...I meant something specific..
Like.... src.underlays.Remove(raft) |
In response to Andre-g1
|
|
.>It doesnt work dude... |
In response to Lcooper
|
|
It doesn't work because "raft" isn't a valid path.
|
In response to Lcooper
|
|
Lcooper wrote:
I dont want to null the whole thing...I meant something specific.. Like my post said, you can use the -= operator or Remove() with the overlays/underlays vars. Please look all of those up (click the links, I made it more convenient) - which should always be done for anything you use in DM when you first use it, or you unsure how it should be used. Like.... src.underlays.Remove(raft) That will work, considering "raft" is replaced by an appropriate element that is already in underlays. Bear in mind underlays/overlays is a special list (again, I urge you to look it up) and items of multiple types can be added to it - object paths, icon objects, image objects, and atom objects. In order to remove something previously added to that list, you need to use the same thing you've used to add it. Eg: if you added an atom object, you must use an atom object in Remove() - I don't think you can add an atom and later attempt to remove it by removing a type path, for example. If you are still having trouble, then show us the relevant code, and we'll try to identify the problem and tell you how to fix it. =) |