ID:1687447
 
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
What you're missing is an explanation of what you're actually trying to do. "It doesn't work", by itself, is not an explanation.
When I log back in the suffix of the item is Equipped but it isn't equipped. The player is given a new version of the regular attack verb for the weapon upon equipping it which is a proc but you don't have it anymore after relogging. You can't equip or unequip the item anymore if you logged out with it equipped, the item just becomes bugged.

obj/Inventory/Equipment
Weapon
identifier = "weapon"
Sword
var
basedamage = 0
OnEquip()
if(istype(src.loc, /mob))
var/mob/P=loc
P.verbs +=/obj/Inventory/Equipment/Weapon/Sword/proc/Attack

OnRemoval()
if(istype(src.loc, /mob))
var/mob/P=loc
P.verbs -=/obj/Inventory/Equipment/Weapon/Sword/proc/Attack
proc
Attack(var/mob/M in get_step(src, src.dir))
set category = "Skills"
set popup_menu = 0
var/mob/P = src
P << "sword attack"
if(P.attdelay || P.stam < P.attstam || P.KOED || P.train || P.rest) return
P.AttackProcs()
P.SMMastery()
P.SMR()
if(M.KOED)
P.Death(M)
else
P.DamageS(M)
spawn(P.attdelayt) P.attdelay = 0



Test_Sword
icon = 'Sword.dmi'
icon_state = ""
basedamage = 100

What I wanted to know is why it wouldn't unequip when the player logs out? I was planning on unequipping it upon logout but keep it the player's equipped list. Then when the player logs on they reequip the weapon that is in their equipped list. However, the item doesn't unequip upon logout dispite the Logout() code.
Because that player doesnt exist in that world anymore ... try to do it in Login(). So if the player logout and log in again it will unequip :)
mhm thanks that worked.

client
Del()
..()
for(var/obj/Inventory/Equipment/E in mob.equipped)
mob.Unequip(E)
mob.Save()
del(mob)