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.
This commit is contained in:
VistaPOWA
2014-04-09 15:02:33 +02:00
parent 4e5d757726
commit e4e7331399
+71 -57
View File
@@ -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 << "<span class='warning'>*click*</span>"
return
/obj/item/weapon/gun/proc/shoot_with_empty_chamber(mob/living/user as mob|obj)
user << "<span class='warning'>*click*</span>"
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("<span class='danger'>[user] fires [src] point blank at [pbtarget]!</span>", "<span class='danger'>You fire [src] point blank at [pbtarget]!</span>", "You hear a [istype(src, /obj/item/weapon/gun/energy) ? "laser blast" : "gunshot"]!")
else
playsound(user, fire_sound, 50, 1)
user.visible_message("<span class='danger'>[user] fires [src]!</span>", "<span class='danger'>You fire [src]!</span>", "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 << "<span class='danger'>You shoot yourself in the foot with \the [src]!</span>"
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 << "<span class='danger'>You shoot yourself in the foot with \the [src]!</span>"
afterattack(user, user)
M.drop_item()
return
if (!user.IsAdvancedToolUser())
user << "<span class='notice'>You don't have the dexterity to do this!</span>"
return
if (!user.IsAdvancedToolUser())
user << "<span class='notice'>You don't have the dexterity to do this!</span>"
return
if(trigger_guard)
if(istype(user, /mob/living))
var/mob/living/M = user
if (HULK in M.mutations)
M << "<span class='notice'>Your meaty finger is much too large for the trigger guard!</span>"
return
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.dna && H.dna.mutantrace == "adamantine")
user << "<span class='notice'>Your metal fingers don't fit in the trigger guard!</span>"
return
if(trigger_guard)
if(istype(user, /mob/living))
var/mob/living/M = user
if (HULK in M.mutations)
M << "<span class='notice'>Your meaty finger is much too large for the trigger guard!</span>"
return
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(H.dna && H.dna.mutantrace == "adamantine")
user << "<span class='notice'>Your metal fingers don't fit in the trigger guard!</span>"
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