From e4e733139988b1bf1fce975ed5d94aff4476734c Mon Sep 17 00:00:00 2001 From: VistaPOWA Date: Wed, 9 Apr 2014 15:02:33 +0200 Subject: [PATCH 1/2] Adds point-blank shooting Adds point blank shooting, now you can shoot anyone even if they are on the same tile or one tile from you. On harm intent, you BUTT-STROKE or PISTOL WHIP (military terms!!) people with the gun, allowing for not quite harmful floggings. Makes gun.dm less shit. --- code/modules/projectiles/gun.dm | 128 ++++++++++++++++++-------------- 1 file changed, 71 insertions(+), 57 deletions(-) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 284c49f2f91..c58d92672bb 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -22,78 +22,92 @@ var/obj/item/ammo_casing/chambered = null var/trigger_guard = 1 - proc/process_chamber() - return 0 +/obj/item/weapon/gun/proc/process_chamber() + return 0 - proc/special_check(var/mob/M) //Placeholder for any special checks, like detective's revolver. - return 1 +/obj/item/weapon/gun/proc/special_check(var/mob/M) //Placeholder for any special checks, like detective's revolver. + return 1 - proc/shoot_with_empty_chamber(mob/living/user as mob|obj) - user << "*click*" - return +/obj/item/weapon/gun/proc/shoot_with_empty_chamber(mob/living/user as mob|obj) + user << "*click*" + return - proc/shoot_live_shot(mob/living/user as mob|obj) - if(recoil) - spawn() - shake_camera(user, recoil + 1, recoil) +/obj/item/weapon/gun/proc/shoot_live_shot(mob/living/user as mob|obj, var/pointblank = 0, var/mob/pbtarget = null) + if(recoil) + spawn() + shake_camera(user, recoil + 1, recoil) - if(silenced) - playsound(user, fire_sound, 10, 1) + if(silenced) + playsound(user, fire_sound, 10, 1) + else + playsound(user, fire_sound, 50, 1) + if(pointblank) + user.visible_message("[user] fires [src] point blank at [pbtarget]!", "You fire [src] point blank at [pbtarget]!", "You hear a [istype(src, /obj/item/weapon/gun/energy) ? "laser blast" : "gunshot"]!") else - playsound(user, fire_sound, 50, 1) user.visible_message("[user] fires [src]!", "You fire [src]!", "You hear a [istype(src, /obj/item/weapon/gun/energy) ? "laser blast" : "gunshot"]!") - emp_act(severity) - for(var/obj/O in contents) - O.emp_act(severity) +/obj/item/weapon/gun/emp_act(severity) + for(var/obj/O in contents) + O.emp_act(severity) - afterattack(atom/target as mob|obj|turf, mob/living/user as mob|obj, flag, params)//TODO: go over this - if(flag) //It's adjacent, is the user, or is on the user's person +/obj/item/weapon/gun/afterattack(atom/target as mob|obj|turf, mob/living/user as mob|obj, flag, params)//TODO: go over this + if(flag) //It's adjacent, is the user, or is on the user's person + if(istype(target, /mob/) && target != user && !(target in user.contents)) //We make sure that it is a mob, it's not us or part of us. + if(user.a_intent == "harm") //Flogging action + return + else return - //Exclude lasertag guns from the CLUMSY check. - if(clumsy_check) - if(istype(user, /mob/living)) - var/mob/living/M = user - if ((CLUMSY in M.mutations) && prob(40)) - M << "You shoot yourself in the foot with \the [src]!" - afterattack(user, user) - M.drop_item() - return + //Exclude lasertag guns from the CLUMSY check. + if(clumsy_check) + if(istype(user, /mob/living)) + var/mob/living/M = user + if ((CLUMSY in M.mutations) && prob(40)) + M << "You shoot yourself in the foot with \the [src]!" + afterattack(user, user) + M.drop_item() + return - if (!user.IsAdvancedToolUser()) - user << "You don't have the dexterity to do this!" - return + if (!user.IsAdvancedToolUser()) + user << "You don't have the dexterity to do this!" + return - if(trigger_guard) - if(istype(user, /mob/living)) - var/mob/living/M = user - if (HULK in M.mutations) - M << "Your meaty finger is much too large for the trigger guard!" - return - if(ishuman(user)) - var/mob/living/carbon/human/H = user - if(H.dna && H.dna.mutantrace == "adamantine") - user << "Your metal fingers don't fit in the trigger guard!" - return + if(trigger_guard) + if(istype(user, /mob/living)) + var/mob/living/M = user + if (HULK in M.mutations) + M << "Your meaty finger is much too large for the trigger guard!" + return + if(ishuman(user)) + var/mob/living/carbon/human/H = user + if(H.dna && H.dna.mutantrace == "adamantine") + user << "Your metal fingers don't fit in the trigger guard!" + return - add_fingerprint(user) + add_fingerprint(user) - if(!special_check(user)) - return - if(chambered) - if(!chambered.fire(target, user, params, , silenced)) - shoot_with_empty_chamber(user) + if(!special_check(user)) + return + if(chambered) + if(!chambered.fire(target, user, params, , silenced)) + shoot_with_empty_chamber(user) + else + if(get_dist(user, target) <= 1) //Making sure whether the target is in vicinity for the pointblank shot + shoot_live_shot(user, 1, target) else shoot_live_shot(user) - else - shoot_with_empty_chamber(user) - process_chamber() - update_icon() - - if(user.hand) - user.update_inv_l_hand(0) - else - user.update_inv_r_hand(0) + else + shoot_with_empty_chamber(user) + process_chamber() + update_icon() + if(user.hand) + user.update_inv_l_hand(0) + else + user.update_inv_r_hand(0) +/obj/item/weapon/gun/attack(mob/M as mob, mob/user) + if(user.a_intent == "harm") //Flogging + ..() + else + return \ No newline at end of file From bd4156f18c16c2c380ef08c5a55c8d2ee1befc04 Mon Sep 17 00:00:00 2001 From: VistaPOWA Date: Wed, 9 Apr 2014 15:08:51 +0200 Subject: [PATCH 2/2] Adds missing newline --- code/modules/projectiles/gun.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index c58d92672bb..7d79eaeb7de 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -50,7 +50,6 @@ for(var/obj/O in contents) O.emp_act(severity) - /obj/item/weapon/gun/afterattack(atom/target as mob|obj|turf, mob/living/user as mob|obj, flag, params)//TODO: go over this if(flag) //It's adjacent, is the user, or is on the user's person if(istype(target, /mob/) && target != user && !(target in user.contents)) //We make sure that it is a mob, it's not us or part of us. @@ -106,6 +105,7 @@ user.update_inv_l_hand(0) else user.update_inv_r_hand(0) + /obj/item/weapon/gun/attack(mob/M as mob, mob/user) if(user.a_intent == "harm") //Flogging ..()