Added code for C96 and P08, since Uhangi is lazy.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1147 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
cagerrin@gmail.com
2011-03-01 08:29:43 +00:00
parent fafe58190a
commit 4eacb7ae39
4 changed files with 237 additions and 22 deletions
+190 -11
View File
@@ -1152,16 +1152,195 @@ obj/item/weapon/gun/revolver/attackby(obj/item/weapon/ammo/a357/A as obj, mob/us
//GLOCK
//Mauser C96
/obj/item/weapon/gun/c96/examine()
set src in usr
if (src.magazine)
if (istype(src.magazine, /obj/item/weapon/ammo/a763m))
src.desc = text("There are [] round\s left! Uses 7.63x25 Mauser", src.magazine.amount_left)
else
src.desc = text("There are 0 rounds left! Uses 7.63x25 Mauser")
..()
return
/obj/item/weapon/gun/c96/verb/eject()
set src in usr
if (src.magazine)
if (istype(src.magazine, /obj/item/weapon/ammo/a763m))
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/c96))
src.magazine = null
else
src.magazine.loc = src.loc
src.magazine = null
..()
return
/obj/item/weapon/ammo/a763m/examine()
set src in usr
src.desc = text("There are [] round\s left!", src.amount_left)
..()
return
/obj/item/weapon/gun/c96/attackby(obj/item/weapon/ammo/a763m/A as obj, mob/user as mob)
..()
if (istype(A, /obj/item/weapon/ammo/a763m))
if (src.magazine)
user << "\blue There is already a magazine in!"
return 1
user.drop_item()
A.loc = src
flick("c96load",src)
src.magazine = A
return 1
return
/obj/item/weapon/gun/c96/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 c96 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/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
//Luger P08
/obj/item/weapon/gun/p08/examine()
set src in usr
if (src.magazine)
if (istype(src.magazine, /obj/item/weapon/ammo/a9x19p))
src.desc = text("There are [] round\s left! Uses 9x19 Parabellum", src.magazine.amount_left)
else
src.desc = text("There are 0 rounds left! Uses 9x19 Parabellum")
..()
return
/obj/item/weapon/gun/p08/verb/eject()
set src in usr
if (src.magazine)
if (istype(src.magazine, /obj/item/weapon/ammo/a9x19p))
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/p08))
src.magazine = null
else
src.magazine.loc = src.loc
src.magazine = null
..()
return
/obj/item/weapon/ammo/a9x19p/examine()
set src in usr
src.desc = text("There are [] round\s left!", src.amount_left)
..()
return
/obj/item/weapon/gun/p08/attackby(obj/item/weapon/ammo/a9x19p/A as obj, mob/user as mob)
..()
if (istype(A, /obj/item/weapon/ammo/a9x19p))
if (src.magazine)
user << "\blue There is already a magazine in!"
return 1
user.drop_item()
A.loc = src
src.magazine = A
icon_state = "p08"
return 1
return
/obj/item/weapon/gun/p08/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 p08 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/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
//GLOCK G21
/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)
src.desc = text("There are [] round\s left! Uses .45 ACP", src.magazine.amount_left)
else
src.desc = "There are 0 bullets left! Uses .45 ACP"
src.desc = "There are 0 rounds left! Uses .45 ACP"
..()
return
@@ -1184,13 +1363,13 @@ obj/item/weapon/gun/revolver/attackby(obj/item/weapon/ammo/a357/A as obj, mob/us
/obj/item/weapon/ammo/a45/examine()
set src in usr
src.desc = text("There are [] bullet\s left!", src.amount_left)
src.desc = text("There are [] round\s left!", src.amount_left)
..()
return
/obj/item/weapon/ammo/assaultmag/examine()
set src in usr
src.desc = text("There are [] bullet\s left!", src.amount_left)
src.desc = text("There are [] round\s left!", src.amount_left)
..()
return
@@ -1250,9 +1429,9 @@ obj/item/weapon/gun/revolver/attackby(obj/item/weapon/ammo/a357/A as obj, mob/us
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)
src.desc = text("There are [] round\s left! Uses .45 ACP", src.magazine.amount_left)
else
src.desc = "There are 0 bullets left! Uses .45 ACP"
src.desc = "There are 0 rounds left! Uses .45 ACP"
..()
return
@@ -1329,9 +1508,9 @@ obj/item/weapon/gun/revolver/attackby(obj/item/weapon/ammo/a357/A as obj, mob/us
set src in usr
if (src.magazine)
if (istype(src.magazine, /obj/item/weapon/ammo/assaultmag))
src.desc = text("There are [] bullet\s left! Uses 5.56x45mm NATO", src.magazine.amount_left)
src.desc = text("There are [] round\s left! Uses 5.56x45mm NATO", src.magazine.amount_left)
else
src.desc = "There are 0 bullets left! Uses 5.56x45mm NATO"
src.desc = "There are 0 rounds left! Uses 5.56x45mm NATO"
..()
return
@@ -1411,9 +1590,9 @@ obj/item/weapon/gun/revolver/attackby(obj/item/weapon/ammo/a357/A as obj, mob/us
set src in usr
if (src.magazine)
if (istype(src.magazine, /obj/item/weapon/ammo/assaultmag))
src.desc = text("There are [] bullet\s left! Uses 5.56x45mm NATO", src.magazine.amount_left)
src.desc = text("There are [] round\s left! Uses 5.56x45mm NATO", src.magazine.amount_left)
else
src.desc = "There are 0 bullets left! Uses 5.56x45mm NATO"
src.desc = "There are 0 rounds left! Uses 5.56x45mm NATO"
..()
return