W name = "wall" icon_state = "W" Enter() call(contents:mob,mob.icon.Shift)(WEST,4) return ..() Exit() call(contents:mob,mob.icon.Shift)(EAST,4) return ..()
Problem description:
I am trying to make the icon so when it is entered the mob the mob of the icon is shifted, but I couldnt figure out how to reference the shift proc or the mob icon itself. This is what I have.
First, when something successfully goes into a turf (I assume, since you didn't specify whether it's a turf, or anything else), you should call Entered(). Enter() should be used to see whether something can enter the place, or not.
You shouldn't need to use call() in this situation.
mob/var oldicon // when you use Shift(), the icons can lose data at the other side if you don't want to
w Entered(atom/movable/A) if(ismob(A)) var/mob/M=A var/icon/I = new(M.icon) // define the icon in another var I.Shift(WEST, 4) // shift the icon four pixels M.oldicon = M.icon // backup the icon M.icon = I // set the icon return ..() Exited(atom/movable/A) if(ismob(A)) var/mob/M=A if(M.oldicon) M.icon=oldicon // revert to the old icon return ..()
I really don't see the need to use Shift() when you can set the pixel_x of the item. Using this might not be the best thing for what you want. A better way to do it is just to set pixel_x.
You shouldn't need to use call() in this situation.
I really don't see the need to use Shift() when you can set the pixel_x of the item. Using this might not be the best thing for what you want. A better way to do it is just to set pixel_x.
Use whichever fits what you need. If you actually need to shift the icon, then use the above one.
~~> Dragon Lord