More guns, glock and m1911.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1127 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
uhangi@gmail.com
2011-02-25 02:21:35 +00:00
parent 9cb797c382
commit c734c5578a
4 changed files with 199 additions and 0 deletions
@@ -1138,3 +1138,173 @@ obj/item/weapon/gun/revolver/attackby(obj/item/weapon/ammo/a357/A as obj, mob/us
if(O.client) O.show_message(text("\red <B>[M] has been knocked unconscious!</B>"), 1, "\red You hear someone fall", 2)
return
//GLOCK
/obj/item/weapon/gun/glock/examine()
set src in usr
if (src.magazine)
if (istype(src.magazine, /obj/item/weapon/ammo/a45))
src.desc = text("There are [] bullet\s left! Uses .45 ACP", src.magazine.amount_left)
else
src.desc = "There are 0 bullets left! Uses .45 ACP"
..()
return
/obj/item/weapon/gun/glock/verb/eject()
set src in usr
if (src.magazine)
if (istype(src.magazine, /obj/item/weapon/ammo/a45))
if (istype(src.loc, /mob))
var/obj/item/W = src.loc:equipped()
var/emptyHand = (W == null)
if(emptyHand)
src.magazine.DblClick()
if(!istype(src.magazine.loc, /obj/item/weapon/gun/glock))
src.magazine = null
else
src.magazine.loc = src.loc
src.magazine = null
..()
return
/obj/item/weapon/ammo/a45/examine()
set src in usr
src.desc = text("There are [] bullet\s left!", src.amount_left)
..()
return
/obj/item/weapon/gun/glock/attackby(obj/item/weapon/ammo/a45/A as obj, mob/user as mob)
..()
if (istype(A, /obj/item/weapon/ammo/a45))
if (src.magazine)
user << "\blue There is already a magazine in!"
return 1
user.drop_item()
A.loc = src
src.magazine = A
return 1
return
/obj/item/weapon/gun/glock/afterattack(atom/target as mob|obj|turf|area, mob/user as mob, flag)
if (flag)
return
if ((istype(user, /mob/living/carbon/monkey)) && ticker.mode != "monkey")
usr << "\red You don't have the dexterity to do this!"
return
src.add_fingerprint(user)
if (src.magazine.amount_left < 1)
user.show_message("\red *click* *click*", 2)
return
playsound(user, 'Gunshot.ogg', 100, 1)
src.magazine.amount_left--
for(var/mob/O in viewers(user, null))
O.show_message(text("\red <B>[] fires the glock at []!</B>", user, target), 1, "\red You hear a gunshot", 2)
var/turf/T = user.loc
var/turf/U = (istype(target, /atom/movable) ? target.loc : target)
if ((!( U ) || !( T )))
return
while(!( istype(U, /turf) ))
U = U.loc
if (!( istype(T, /turf) ))
return
if (U == T)
user.bullet_act(PROJECTILE_WEAKBULLET)
return
var/obj/bullet/weakbullet/A = new /obj/bullet/weakbullet( user.loc )
if (!istype(U, /turf))
del(A)
return
A.current = U
A.yo = U.y - T.y
A.xo = U.x - T.x
user.next_move = world.time + 4
spawn( 0 )
A.process()
return
return
/obj/item/weapon/gun/m1911/examine()
set src in usr
if (src.magazine)
if (istype(src.magazine, /obj/item/weapon/ammo/a45))
src.desc = text("There are [] bullet\s left! Uses .45 ACP", src.magazine.amount_left)
else
src.desc = "There are 0 bullets left! Uses .45 ACP"
..()
return
/obj/item/weapon/gun/m1911/verb/eject()
set src in usr
if (src.magazine)
if (istype(src.magazine, /obj/item/weapon/ammo/a45))
if (istype(src.loc, /mob))
var/obj/item/W = src.loc:equipped()
var/emptyHand = (W == null)
if(emptyHand)
src.magazine.DblClick()
if(!istype(src.magazine.loc, /obj/item/weapon/gun/m1911))
src.magazine = null
else
src.magazine.loc = src.loc
src.magazine = null
..()
return
/obj/item/weapon/gun/m1911/attackby(obj/item/weapon/ammo/a45/A as obj, mob/user as mob)
..()
if (istype(A, /obj/item/weapon/ammo/a45))
if (src.magazine)
user << "\blue There is already a magazine in!"
return 1
user.drop_item()
A.loc = src
src.magazine = A
return 1
return
/obj/item/weapon/gun/m1911/afterattack(atom/target as mob|obj|turf|area, mob/user as mob, flag)
if (flag)
return
if ((istype(user, /mob/living/carbon/monkey)) && ticker.mode != "monkey")
usr << "\red You don't have the dexterity to do this!"
return
src.add_fingerprint(user)
if (src.magazine.amount_left < 1)
user.show_message("\red *click* *click*", 2)
return
playsound(user, 'Gunshot.ogg', 100, 1)
src.magazine.amount_left--
for(var/mob/O in viewers(user, null))
O.show_message(text("\red <B>[] fires the m1911 at []!</B>", user, target), 1, "\red You hear a gunshot", 2)
var/turf/T = user.loc
var/turf/U = (istype(target, /atom/movable) ? target.loc : target)
if ((!( U ) || !( T )))
return
while(!( istype(U, /turf) ))
U = U.loc
if (!( istype(T, /turf) ))
return
if (U == T)
user.bullet_act(PROJECTILE_BULLET)
return
var/obj/bullet/A = new /obj/bullet( user.loc )
if (!istype(U, /turf))
del(A)
return
A.current = U
A.yo = U.y - T.y
A.xo = U.x - T.x
user.next_move = world.time + 4
spawn( 0 )
A.process()
return
return