ID:155563
 
Hello. I'm trying to make crafting system and I have a little problem. My crafting system is drag and drop based. Here is a little code of it:
obj
MouseDrop(O)
var/object=CanCombo(src,O)
var/L=GetOloc(O,usr)
world<<"[O]"
if(object)
var/V= new object(L)
usr<<"You have made [V]"
if(istype(O,/obj/tool))
if(istype(src,/obj/tool))
return
else
del(src)
else if(istype(src,/obj/tool))
if(istype(O,/obj/tool))
return
else
del(O)
else
del(O)
del(src)

But the problem is with little supporting proc that checks object's, which was dragged onto, location. I want it to return usr if object is in user's inventory and to return turf location which it is onto if that object is on the ground. As you can see, that later will be used as location of new object. Here is the code of that proc:
    proc/GetOloc(O,U)
if(istype(U,/mob))
return usr
//More code needed here

If my code has flaws, please tell me so I can fix them and learn from it.
Thank you for your answers.