Door
icon = 'obj.dmi'
icon_state = "door"
density = 1
contents = list()
Click()
var/target = get_step(usr,usr.dir)
for(var/obj/Doors/X in target)
if(get_dist(usr.loc, src) > 1)
if(usr.Type == "Destroy")
del(src)
else
..()
else
if(src.Locked == 1)
if(usr.contents.len)
for(var/obj/key/O in usr.contents)
if(O.HiddenKey == src.name)
usr<<sound('door.wav')
src.icon_state = null
src.density = 0
sleep(50)
src.icon_state = "door"
src.density = 1
else
usr << "You need [src.key] key to open [src]!"
else
usr << "You need [src.key] key to open [src]!"
else
usr<<sound('door.wav')
src.icon_state = null
src.density = 0
sleep(50)
src.icon_state = "door"
src.density = 1
obj
key
icon = 'obj.dmi'
icon_state = "key"
gettable = 1
Click()
if(src in usr.contents)
var/target = get_step(usr,usr.dir)
for(var/obj/Doors/X in target)
if(src.HiddenKey == X.name)
if(X.Locked == 1)
usr << "You unlock [X]."
X.Locked = 0
view()<<sound('door.wav')
else
usr << "You lock [X]."
X.Locked = 1
view()<<sound('door.wav')
else if(X.Locked == 1)
usr << "You can't lock [X] with [src]!"
else
usr << "You can't unlock [X] with [src]!"
else
if(usr.Type == "Destroy")
del(src)
else
..()
ID:261530
Jun 11 2002, 4:29 pm (Edited on Jun 11 2002, 4:38 pm)
|
|
Everything works perfect but if you have more than 1 key other than the one you need when its locked it says You need [blah] to open this door then it opens it.
|
In response to Garthor
|
|
Lol sorry I didnt check it. It's been edited.
|
In response to Thief Jack
|
|
I'm pretty sure I posted the code you need...
|
In response to Garthor
|
|
That only checks if its open.....It doesnt even use keys.
|
In response to Thief Jack
|
|
The one in this thread uses keys to open the door. You'll have to make a closing verb yourself. The opened var isn't important I just realize, you can just check it's icon_state.
|
In response to Garthor
|
|
But I dont want to make a closing verb DWL has an exact same code as mine but it's perfect and doesnt use close verbs.
|
In response to Thief Jack
|
|
Then just do a check to see what it's icon_state is, then do the appropriate code.
|
In response to Garthor
|
|
Garthor, stop trying to help you dont understand what I need.
|
In response to Thief Jack
|
|
Then what do you need?
|
In response to Garthor
|
|
_< read the first post |
In response to Thief Jack
|
|
else
if(src.Locked == 1) if(usr.contents.len) for(var/obj/key/O in usr.contents) if(O.HiddenKey == src.name) usr<<sound('door.wav') src.icon_state = null src.density = 0 sleep(50) src.icon_state = "door" src.density = 1 You'll want something like... else if(src.Locked == 1) if(usr.contents.len) for(var/obj/key/O in usr.contents) if(O.HiddenKey == src.name) usr<<sound('door.wav') src.icon_state = null src.density = 0 sleep(50) src.icon_state = "door" src.density = 1 var/OK = 1 if(!OK) usr << "You do not have the correct key!" |
In response to Garthor
|
|
Yay thanks I got it to work perfectly now.
|
var/opened = 0
for(var/obj/key/K in usr)
if(K.door = src.door) //or whatever you use to determine which ones work
opened = 1
... //do the opening code
break
if(!opened)
usr << "You do not have the correct key!"