ID:141126
 
Code:
obj
Door
var
Locked=0
Lock_Level=0
Click()
Door(src.Locked, src.Lock_Level, usr)
Ship_Door
icon='Ship.dmi'
icon_state="Dc"
density=10
opacity=1
Locked=0
Lock_Level=0

obj
proc
Door(locked, locklevel, mob/M)
var/obj/Door/D = locate(M) in get_step(M,dir)
if(D)
if(locked==0)
flick("Do2", D)
D.icon_state="Do"
D.density=0
sleep(30)
flick("Dc2", D)
D.icon_state="Dc"
D.density=1
else
if(M.Pick_Lock <= locklevel-1)
M<<"You try to pick the lock but you fail."
return
else
M<<"You pick the lock."
flick("Do2", D)
D.icon_state="Do"
D.density=0
sleep(30)
flick("Dc2", D)
D.icon_state="Dc"
D.density=1


Problem description:
OK I read up on the mentioned Modular Programming (in my last thread) and I see what they mean about it being good to use. So I am trying it with all of my doors (to pass them all through one thing) and I hit a snag.

To me the above code looks right, but when I click on the door MY icon flicks not the door.
You're not using locate() correctly, or your own object proc for that matter; you're calling the proc on a specific door already, so you shouldn't go looking for a door inside of it; the door is src.

In case you don't understand, since there is no global Door() proc, your call Door(src.Locked, src.Lock_Level, usr) compiles as src.Door() - that proc is called for a specific object (as it's an ... object proc).
In response to Kaioken
You are way smarter and more awesome than me. Thank you.