Hello guys, I have yet again re-designed my Inventory system , which I feel is a lot better then my previous. Anyway, Hmm, I have this problem where I am equipping a item. If there is only one item in my contents, it works properly. But once there's more then 1 item and I click Equip, it creates a pop-up indicating which item I want to equip. This is completely unintentional as I want the system to refer back to the item clicked, and automatically select that one to equip/unequip.
Here is animated picture depicting the occurence:
![](http://imageshack.com/a/img812/7824/g0h.gif)
Please do forget the "lag" Licecap slowed me down a little xD.
Anyway, when I equipped the shirt it was working as intended, but once I get more then 1 item it does unwanted behavior.
How can I go about it always working as it worked the 1st time?
Here is my code:
Code:
#define WEAPONS_1 FLOAT_LAYER -1
#define ARMOR_1 FLOAT_LAYER -5 //armor pants
#define ARMOR_2 FLOAT_LAYER -4
#define CLOTHES_2 FLOAT_LAYER -6 //shirts
#define CLOTHES_3 FLOAT_LAYER -3 // vest
#define CLOTHES_4 FLOAT_LAYER -2 // scarf
Equipment
parent_type = /Inventory
var/list/Clothes = list()
var Armor
var Weapons
var Armor_type
var/list/Arrangement = list()
verb/Get()
set hidden = 1
set src in oview(1)
src.Move(usr)
usr.Add_Items(src)
Click()
..()
sleep(2)
if(src in usr.contents)
var/Inventory_pos = winget(usr,"Inventory","pos")
winshow(usr,"Inventory",0)
winshow(usr,"Item_Info",1)
winset(usr,"Item_Info","pos=[Inventory_pos]")
spawn(2)
usr<<output(
{"
<b><font color = white>Item:</color><font color = green> [src]</color>
<font color = white>Description:[src.desc]
"}
,"Item_Info.Info")
sleep(world.tick_lag)
verb/Equip()
if(src in usr.contents)
switch(src.is_equipped)
if(TRUE)
for(var/obj/Maptext in usr.client.screen)
if(Maptext.tag == "[src]")
del(Maptext)
src.is_equipped = FALSE
switch(gear_type)
if("Clothing")
usr.clothing_equipped -= src
usr.overlays -= Clothes
if("Armor")
usr.armor_equipped -= src
usr.overlays -= Armor
if("Weapons")
usr.weapon_equipped = null
usr.overlays -= Weapons
if(FALSE)
new/Maptext("E","[src]",src.screen_loc,16,16,1)
src.is_equipped = TRUE
switch(gear_type)
if("Clothing")
switch(src.Arrangement)
if(2)
Clothes = image(icon = src.real_icon, layer = CLOTHES_4)
if(3)
Clothes = image(icon = src.real_icon, layer = CLOTHES_3)
if(4)
Clothes = image(icon = src.real_icon, layer = CLOTHES_2)
usr.clothing_equipped += src
usr.overlays += Clothes
if("Armor")
switch(src.Arrangement)
if(1)
Armor = image(icon = src.real_icon, layer = ARMOR_1)
if(2)
Armor = image(icon = src.real_icon, layer = ARMOR_2)
usr.armor_equipped += src
usr.overlays += Armor
if("Weapons")
usr.weapon_equipped = "[src]"
Weapons = image(icon = src.real_icon, layer = WEAPONS_1)
usr.overlays += Weapons
If you're going for a solely interface-based approach you don't even need a verb here, just a proc, which you call within Click() or as needed.