Merge pull request #8289 from Xhuis/alt_clicking

Allows alt-clicking for some stuff
This commit is contained in:
Jordie
2015-03-19 16:43:53 +11:00
4 changed files with 58 additions and 32 deletions
@@ -14,6 +14,28 @@
wall_mounted = 0 //never solid (You can always pass over it)
health = 200
/obj/structure/closet/secure_closet/examine(mob/user)
..()
if(broken || opened || !ishuman(user))
return //Monkeys don't get a message, nor does anyone ief it's open or emagged
else
user << "<span class='notice'>Alt-click the locker to [locked ? "unlock" : "lock"] it.</span>"
/obj/structure/closet/secure_closet/AltClick(var/mob/user)
..()
if(!in_range(src, user))
return
if(!ishuman(user))
user << "<span class='notice'>You have no idea how this thing is supposed to work.</span>"
return
if(user.stat || !user.canmove || user.restrained() || broken)
user << "<span class='notice'>You can't do that right now.</span>"
return
if(src.opened)
return
else
togglelock(user)
/obj/structure/closet/secure_closet/can_open()
if(src.locked || src.welded)
return 0
@@ -101,26 +123,6 @@
/obj/structure/closet/secure_closet/attack_paw(mob/user as mob)
return src.attack_hand(user)
/obj/structure/closet/secure_closet/verb/verb_togglelock()
set src in oview(1) // One square distance
set category = "Object"
set name = "Toggle Lock"
if(!usr.canmove || usr.stat || usr.restrained()) // Don't use it if you're not able to! Checks for stuns, ghost and restrain
return
if(get_dist(usr, src) != 1)
return
if(src.broken)
return
if (ishuman(usr))
if (!opened)
togglelock(usr)
else
usr << "<span class='warning'>This mob type can't use this verb.</span>"
/obj/structure/closet/secure_closet/update_icon()//Putting the welded stuff in updateicon() so it's easy to overwrite for special cases (Fridges, cabinets, and whatnot)
overlays.Cut()
if(!opened)