obj/Inventory
Equipment
var
identifier
Click()
if(ismob(src.loc))
if(src.loc && src.loc.vars["[src.identifier]"]== src)
src.Unequip_Item()
else
src.Equip_Item()
verb
Equip_Item()
set hidden = TRUE
set name = "Equip"
set src in usr
var/mob/P=usr
P.Equip(src)
Unequip_Item()
set hidden = TRUE
set name = "Unequip"
set src in usr
var/mob/P=usr
P.Unequip(src)
proc
OnEquip()
OnRemoval()
mob
var
obj/Inventory/Equipment
Weapon/weapon
Shield/shield
proc
Equip(obj/Inventory/Equipment/E)
if(!istype(E) || !E.AllowEquip() || !(E.identifier in src.vars) || src.vars["[E.identifier]"])
return 0
E.OnEquip()
src << "You equip [E]."
src.vars["[E.identifier]"] = E
E.suffix = "Equipped"
src.equipped += E
Unequip(obj/Inventory/Equipment/E)
if(!istype(E) || !E.AllowUnequip() || !(E.identifier in src.vars) || src.vars["[E.identifier]"]!=E)
return 0
E.OnRemoval()
src << "You unequip [E]."
src.vars["[E.identifier]"]=null
E.suffix=""
src.equipped -= E
Get(obj/Inventory/E)
if(istype(E) && E.AllowGet())
src << "You obtained a\ [E]!"
E.Move(src)
E.OnGet()
Drop(obj/Inventory/Equipment/E)
if(istype(E, /obj/Inventory) && E.AllowDrop())
if(src.vars["[E.identifier]"] == E)
Unequip(E)
src << "You drop [E]."
E.Move(locate(src.x,src.y,src.z))
E.OnDrop()
mob/Logout()
for(var/obj/Inventory/Equipment/E in equipped)
Unequip(E)
..()
For some reason I can't get logging out with an equipped weapon to function properly. I'm not sure why, I even tried to make it unequip the weapon on logout but that doesn't work. What am I missing?
equipped is a player var/list