ID:177912
 
mob
verb

what_to_build()
set category = "Build"
var/newtype = input("What type?")in typesof(/turf,/obj)+"Cancel"
if(newtype == "Cancel")
return
else
if(newtype == "lockeddoor")
var/obj/lockeddoor/D
usr.buildtype = newtype
D.owner = "[usr]"
else
usr.buildtype = newtype


turf
Click()
new usr.buildtype(src)

MouseDrag(typeb,unused,location)
typeb = usr.buildtype
new typeb(location)

lockeddoor
icon = 'turfs.dmi'
icon_state = "9"
var/owner = ""
density = 1
verb
open()
set category = "Door"
set src in oview(1)
if(usr == src.owner)
src.density = 0
src.icon_state = "closed"
else
usr <<"This isn't your door!"

close()
set category = "Door"
set src in oview(1)
if(usr == src.owner)
src.density = 1
src.icon_state = "9"
else
usr <<"This isn't your door!"

If i make a lockeddoor,it doesn't know I am the owner!
That's because usr is a mob, not a text string. Replace it with usr.ckey (or key) and the owner, too.
I suggest you try this instead:
turf/Click()
new usr.buildtype(src,usr)

Then set up your door like this:
turf/lockeddoor
New(newloc,mob/M)
..()
owner=M

This should set the owner for you.

For an ultra-safe method you may eventually want to use some kind of canonical key/character combo for lockeddoor.owner like "[usr.client.ckey]:[ckey(usr.name)]" so that the mob can be safely deleted and reloaded later.

Lummox JR