ID:140296
 
Code:
obj
clothes
feet
var/obj/clothes/feet/right
var/obj/clothes/feet/left
Click()
//var/shirticon="[src.icon]"
if(usr.feet=="off")
if(usr.sex in src.sex)
var/obj/l = new left
var/obj/r = new right
usr.overlays+=image(src.icon)
usr.overlays+=image(l.icon)
usr.overlays+=image(r.icon)
usr.feet="on"
src.suffix="Equipped"
else
return
else if(usr.feet=="on"&&src.suffix=="Equipped")
if(usr.sex in src.sex)
usr.overlays-=image(src.icon)
for(var/o in usr.overlays)
if(o==src.left)
usr.overlays-=image(src.left)
if(o==src.right)
usr.overlays-=image(src.right)
//usr.overlays-=image(src.left)
//usr.overlays-=image(src.right)
usr.feet="off"
src.suffix=null
else
return
else
usr<<"<font color=red>You can't equip two pieces of the same type of clothing."
aile
left=/obj/clothes/feet/aile/l
right=/obj/clothes/feet/aile/r
icon='Clothes/Feet/Female/aile/aile.dmi'
icon_state="item"
sex=list("Female")
l
icon='Clothes/Feet/Female/aile/left.dmi'
pixel_x=-32
r
icon='Clothes/Feet/Female/aile/right.dmi'
pixel_x=32


Problem description:

There're no runtime errors, but it displays wrong or doesn't display at all. I've checked the icons and their states are right and everything. Don't mind the "unequip" I'm not really done with that yet. Anyways, is there any way where I can get these to display in their respective places?(left being pixel_x=-32 and right being pixel_x=32)
The feet you are adding have no icons or offsets.

Also I suggest adding the items to the player when adding them, so that you can restore them without any problem, or check if they are equipped by checking the usrs vars.
obj/overlay/feet/left
icon='feets.dmi'
icon_state="l"
obj/overlay/feet/right
icon='feets.dmi'
icon_state="r"

obj/items/clothes/feets
icon='feets.dmi'
Click()
if(!usr.feets)
usr.overlays+=/obj/overlay/feet/left
usr.overlays+=/obj/overlay/feet/right
usr.feets=src
usr<< "Feets added"
else if(usr.feets==src)
usr.overlays-=/obj/overlay/feet/left
usr.overlays-=/obj/overlay/feet/right
usr.feets=null
usr<< "Feets removed"
In response to Pirion (#1)
They have icons, that's why they show up, but they don't show up correctly. For example, the one that is supposed to be to the left of the character shows up to the right, instead, and the one that is supposed to show up on the right shows to the left. I've checked everything and they're sprited and programmed correctly as far as I know, the left has a -32, and the right has a +32, the icons are made like they should as well. They just show up wrong. The items are added to the player and the suffix="Equipped" shows me the item is equipped.

Note the left and right aren't the items themselves, they are add ons to the main item, which is aile. l and r are part of the aile item.
In response to Thetis (#2)
Thetis wrote:
They have icons, that's why they show up, but they don't show up correctly. For example, the one that is supposed to be to the left of the character shows up to the right, instead, and the one that is supposed to show up on the right shows to the left. I've checked everything and they're sprited and programmed correctly as far as I know, the left has a -32, and the right has a +32, the icons are made like they should as well. They just show up wrong. The items are added to the player and the suffix="Equipped" shows me the item is equipped.

Based on your mention of the suffix var, I have a guess as to what's wrong. The critical piece of information I believe you left out of both your posts is that the display problem you're referring to happens in statpanels.

When you display an object in a statpanel or grid, overlay offsets are not preserved. This is something we would like to change at some point but it is not a trivial change.

Lummox JR
In response to Lummox JR (#3)
I found out the problem myself actually. I'm not quite sure what you said, Lummox, but the problem was that the icon state "item" was used for the left and right of the "aile" item as well as the aile item itself. I had to use the overlays as objects in the end, and make the icon state for the left and right null. Just figured I'd post my solution in case someone else happened upon it with the same problem.