From 0582d87a08dad4018dcebe60938bc5a8d5b6cf02 Mon Sep 17 00:00:00 2001 From: Menshin Date: Tue, 13 Jan 2015 00:30:54 +0100 Subject: [PATCH] * Fixes "Toggle Gunlight" verb runtimes for guns without any light. * The verb will now only appear if there's a gunlight attached to the gun. --- code/modules/projectiles/gun.dm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 5d64fe6e093..98fa0bad3dc 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -165,6 +165,8 @@ A.loc = src update_icon() update_gunlight(user) + verbs += /obj/item/weapon/gun/proc/toggle_gunlight + if(istype(A, /obj/item/weapon/screwdriver)) if(F) if(user.l_hand != src && user.r_hand != src) @@ -177,13 +179,18 @@ update_gunlight(user) S.update_brightness(user) update_icon() + verbs -= /obj/item/weapon/gun/proc/toggle_gunlight ..() return -/obj/item/weapon/gun/verb/toggle_gunlight() +/obj/item/weapon/gun/proc/toggle_gunlight() set name = "Toggle Gunlight" set category = "Object" set desc = "Click to toggle your weapon's attached flashlight." + + if(!F) + return + var/mob/living/carbon/human/user = usr if(!isturf(user.loc)) user << "You cannot turn the light on while in this [user.loc]."