client/var/equipped_helm=0
mob/var/helmet
client
MouseDrag(src_object, over_object, src_location, over_location, src_control, over_control, params)
if(!(src in usr.contents))return
MouseDrop(src_object, over_object, src_location, over_location, src_control, over_control, params)
if(src in usr.contents)
if(over_object == /obj/hud/Helmet)
if(!usr.helmet)
usr.helmet=src
equipped_helm=1
new src_object
if(over_location == null)
if(!equipped_helm)
switch(alert("Are you sure you want to drop [src]?","Drop [src]","Drop it","Cancel"))
if("Drop it")
src_location = locate(usr.x,usr.y,usr.z)
else return
else
usr << "You cannot drop [src] while it is equipped!"
return
Problem description:For the life of my i cannot figure out why it wont drop the src over my hud object and display the icon over it, can anyone provide any insight please? no compile errors or runtime
This will never be true, because src is the client that dropped the item.
Let's take a look at how to do this properly.
client/MouseDrop() is called when any object is dropped after a drag operation. Its default action is to call atom/MouseDrop() on the object being dropped.
Also, a few finer points:
A type path is never equal to an object. You can check if an object is a type of something with istype().
src in usr.contents should never be done, because all atoms have a variable called loc. if(loc==usr) is significantly faster.
You aren't actually moving the object. src.loc = locate(usr.x,usr.y,usr.z) would be changing the loc of the object. You are just changing an argument in the Drop proc. Second, you don't need locate(usr.x,usr.y,usr.z), you already have the location you are trying to locate, so you can just do: loc = usr.loc. However, this is still wrong. You never want to manually assign the location of anything in DM unless you want to lose the ability to use Cross()/Uncross()/ed and Enter()/Exit()/ed functions. You should ALWAYS use Move() to move things or you risk making in-out trackers nonfunctional and eliminating algorithms that are amazingly easy and fast to solve a lot of really complex/irritating problems otherwise.