obj
Weapon
Lightsaber
icon_state="obisaber"
dmg=150
var
ltype
activated
r
g
bl
verb
Activate()
if(usr.Weapon==src)
if(activated)
view(usr)<<sound('deactivate.wav')
sleep(3)
activated=0
for(var/obj/Weapon/Lightsaber/L in usr)
if(L.ltype=="One Sided")
usr.overlays-='Lightsaber.dmi'
if(L.ltype=="Dual Sabers")
usr.overlays-='Dual Sabers.dmi'
if(L.ltype=="Double Sided")
usr.overlays-='Double Sided Saber.dmi'
else
view(usr)<<sound('activate.wav')
sleep(3)
activated=1
var/icon/S=new(locate(0,0,0))
if(ltype=="One Sided")
S.icon='Lightsaber.dmi'
if(ltype=="Dual Sabers")
S.icon='Dual Sabers.dmi'
if(ltype=="Double Sided")
S.icon='Double Sided Saber.dmi'
S+=rgb(r,g,bl)
usr.overlays+=S
Problem description:
I'm coding a lightsaber system, and you have a lightsaber object in your inventory, with an inventory icon. When you Activate it, there is an overlay on the player icon with the color r,g,bl for the rgb() proc. The problem is, I can't find a way to have the overlay disappear when deactivating the lightsaber, since using usr.overlays=null would make the player naked.