Merge pull request #3585 from Aranclanos/ViolinAndPiano

canUseTopic()
This commit is contained in:
Alex
2014-05-14 11:05:17 +01:00
2 changed files with 32 additions and 21 deletions
+31 -20
View File
@@ -202,30 +202,41 @@ Class Procs:
..()
if(!interact_offline && stat & (NOPOWER|BROKEN))
return 1
if(usr.restrained() || usr.lying || usr.stat)
if(!usr.canUseTopic(src))
return 1
if(!(ishuman(usr) || issilicon(usr)))
usr << "<span class='notice'>You don't have the dexterity to do this!</span>"
return 1
var/norange = 0
if(istype(usr, /mob/living/carbon/human))
var/mob/living/carbon/human/H = usr
if(istype(H.l_hand, /obj/item/tk_grab))
norange = 1
else if(istype(H.r_hand, /obj/item/tk_grab))
norange = 1
if(!norange)
if(!issilicon(usr))
if(!in_range(src, usr))
return 1
if(!isturf(loc))
return 1
add_fingerprint(usr)
return 0
/mob/proc/canUseTopic() //TODO: once finished, place these procs on the respective mob files
return
/mob/dead/observer/canUseTopic()
if(check_rights(R_ADMIN))
return
/mob/living/canUseTopic()
src << "<span class='notice'>You don't have the dexterity to do this!</span>"
return
/mob/living/carbon/human/canUseTopic(atom/movable/M)
if(restrained() || lying || stat || stunned || weakened)
return
if(!in_range(M, src))
return
if(!isturf(M.loc) && M.loc != src)
return
return 1
/mob/living/silicon/ai/canUseTopic()
if(stat)
return
return 1
/mob/living/silicon/robot/canUseTopic()
if(stat || lockcharge || stunned || weakened)
return
return 1
/obj/machinery/attack_ai(mob/user as mob)
if(isrobot(user))
// For some reason attack_robot doesn't work
+1 -1
View File
@@ -174,7 +174,7 @@
/datum/song/Topic(href, href_list)
if(!in_range(instrumentObj, usr) || (issilicon(usr) && instrumentObj.loc != usr) || !isliving(usr) || !usr.canmove || usr.restrained())
if(usr.canUseTopic(src))
usr << browse(null, "window=instrument")
usr.unset_machine()
return