From ee9146cda4f89cb879cbed4c19247392a0f8224e Mon Sep 17 00:00:00 2001 From: SkyMarshal Date: Thu, 1 Mar 2012 22:15:03 -0700 Subject: [PATCH] Added more sanity checks to the gun code. --- code/modules/DetectiveWork/detective_work.dm | 2 +- code/modules/mob/mob.dm | 7 +++++++ code/modules/mob/screen.dm | 18 ++++++++++++++++++ code/modules/projectiles/gun.dm | 2 +- 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/code/modules/DetectiveWork/detective_work.dm b/code/modules/DetectiveWork/detective_work.dm index 589cb7bab3..bbe23a4a85 100644 --- a/code/modules/DetectiveWork/detective_work.dm +++ b/code/modules/DetectiveWork/detective_work.dm @@ -50,7 +50,7 @@ atom/proc/add_fibers(mob/living/carbon/human/M) if(!suit_fibers.len) del suit_fibers atom/proc/get_duplicate(var/atom/location) - var/atom/temp_atom = new src.type(location) + var/atom/movable/temp_atom = new /atom/movable(location) temp_atom.name = src.name temp_atom.desc = src.desc temp_atom.icon = src.icon diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index e8ff62279c..c8afaaccde 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -277,6 +277,13 @@ back = null else if (W == wear_mask) wear_mask = null + if(istype(W,/obj/item/weapon/gun)) + var/obj/item/weapon/gun/gun = W + if(gun.target) + gun.target.NotTargeted(gun) + del(item_use_icon) + del(gun_move_icon) + del(gun_run_icon) update_clothing() return diff --git a/code/modules/mob/screen.dm b/code/modules/mob/screen.dm index d646df6906..bbd470d7b1 100644 --- a/code/modules/mob/screen.dm +++ b/code/modules/mob/screen.dm @@ -589,32 +589,50 @@ usr:module_active = null if("Allow Walking") + if(!istype(usr.equipped(),/obj/item/weapon/gun)) + usr << "You need your gun in your active hand to do that!" + return usr.AllowTargetMove() icon_state = "walking" name = "Disallow Walking" if("Disallow Walking") + if(!istype(usr.equipped(),/obj/item/weapon/gun)) + usr << "You need your gun in your active hand to do that!" + return usr.AllowTargetMove() icon_state = "no_walk" name = "Allow Walking" if("Allow Running") + if(!istype(usr.equipped(),/obj/item/weapon/gun)) + usr << "You need your gun in your active hand to do that!" + return usr.AllowTargetRun() icon_state = "running" name = "Disallow Running" if("Disallow Running") + if(!istype(usr.equipped(),/obj/item/weapon/gun)) + usr << "You need your gun in your active hand to do that!" + return usr.AllowTargetRun() icon_state = "no_run" name = "Allow Running" if("Allow Item Use") + if(!istype(usr.equipped(),/obj/item/weapon/gun)) + usr << "You need your gun in your active hand to do that!" + return name = "Disallow Item Use" icon_state = "act_throw_off" usr.AllowTargetClick() if("Disallow Item Use") + if(!istype(usr.equipped(),/obj/item/weapon/gun)) + usr << "You need your gun in your active hand to do that!" + return name = "Allow Item Use" icon_state = "no_item" usr.AllowTargetClick() diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 690b7ed4e9..0f89206cec 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -285,7 +285,7 @@ mob/proc src << "((\red Your character is being targeted. They have 1 second to stop any click or move actions. \black While targeted, they may \ drag and drop items in or into the map, speak, and click on interface buttons. Clicking on the map, their items \ (other than a weapon to de-target), or moving will result in being fired upon. \red The aggressor may also fire manually, \ - so try not to get on their bad side.))" + so try not to get on their bad side.\black ))" if(targeted_by.len == 1) spawn(0) target_locked = new /obj/effect/target_locked(src)