Skip to content

Commit

Permalink
-Added onback for combat shotgun, added onback sprite
Browse files Browse the repository at this point in the history
-Added ak331
-Added carbine
-Added assault rifle magazines

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1136 316c924e-a436-60f5-8080-3fe189b3f50e
  • Loading branch information
uhangi@gmail.com committed Feb 26, 2011
1 parent e8d6c50 commit e792d76
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 1 deletion.
34 changes: 33 additions & 1 deletion code/defines/obj/weapon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@
icon_state = "45-10"
amount_left = 10.0

/obj/item/weapon/ammo/assaultmag
desc = "There are 30 bullets left!"
name = "5.56x45mm NATO"
icon_state = "5.56"
amount_left = 30.0

/obj/item/weapon/ammo/shell //easier to add new shell types. Like badmin laser/taser/pulse shells.
desc = "Generic shell description."
name = "Generic shell."
Expand Down Expand Up @@ -592,7 +598,7 @@
icon_state = "cshotgun"
w_class = 4.0
force = 12.0
flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY // THERE IS NO COMBAT SHOTGUN BACK SPRITE. DON'T ADD ONBACK -- Callagan
flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY | ONBACK
shellsmax = 8
origin_tech = "combat=3"

Expand Down Expand Up @@ -703,6 +709,32 @@
m_amt = 2000
// origin_tech = "combat=3;materials=2"

/obj/item/weapon/gun/carbine
desc = "There are 0 bullets left. Uses 5.56x45mm NATO"
name = "carbine"
icon_state = "carbinenomag"
var/obj/item/weapon/ammo/assaultmag/magazine
flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY
w_class = 4.0
throw_speed = 2
throw_range = 10
force = 6.0
m_amt = 2000
// origin_tech = "combat=3;materials=2"

/obj/item/weapon/gun/ak331
desc = "There are 0 bullets left. Uses 5.56x45mm NATO"
name = "ak331"
icon_state = "ak331nomag"
var/obj/item/weapon/ammo/assaultmag/magazine
flags = FPRINT | TABLEPASS | CONDUCT | USEDELAY
w_class = 4.0
throw_speed = 2
throw_range = 10
force = 18.0
m_amt = 2000
// origin_tech = "combat=3;materials=2"

/obj/item/weapon/gun/detectiverevolver
desc = "A cheap Martian knock-off of a Smith & Wesson Model 10. Uses .38-Special rounds."
name = ".38 revolver"
Expand Down
169 changes: 169 additions & 0 deletions code/game/objects/items/weapons/guns_ammo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,12 @@ obj/item/weapon/gun/revolver/attackby(obj/item/weapon/ammo/a357/A as obj, mob/us
..()
return

/obj/item/weapon/ammo/assaultmag/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)
..()

Expand Down Expand Up @@ -1308,3 +1314,166 @@ obj/item/weapon/gun/revolver/attackby(obj/item/weapon/ammo/a357/A as obj, mob/us
A.process()
return
return

/obj/item/weapon/gun/carbine/examine()
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)
else
src.desc = "There are 0 bullets left! Uses 5.56x45mm NATO"
..()
return

/obj/item/weapon/gun/carbine/verb/eject()
set src in usr
if (src.magazine)
if (istype(src.magazine, /obj/item/weapon/ammo/assaultmag))
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
src.icon_state = "carbinenomag"
else
src.magazine.loc = src.loc
src.magazine = null
..()
return

/obj/item/weapon/gun/carbine/attackby(obj/item/weapon/ammo/assaultmag/A as obj, mob/user as mob)
..()

if (istype(A, /obj/item/weapon/ammo/assaultmag))
if (src.magazine)
user << "\blue There is already a magazine in!"
return 1
user.drop_item()
A.loc = src
src.magazine = A
src.icon_state = "carbine"
return 1
return

/obj/item/weapon/gun/carbine/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 carbine 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/ak331/examine()
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)
else
src.desc = "There are 0 bullets left! Uses 5.56x45mm NATO"
..()
return

/obj/item/weapon/gun/ak331/verb/eject()
set src in usr
if (src.magazine)
if (istype(src.magazine, /obj/item/weapon/ammo/assaultmag))
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
src.icon_state = "ak331nomag"
else
src.magazine.loc = src.loc
src.magazine = null
..()
return

/obj/item/weapon/gun/ak331/attackby(obj/item/weapon/ammo/assaultmag/A as obj, mob/user as mob)
..()

if (istype(A, /obj/item/weapon/ammo/assaultmag))
if (src.magazine)
user << "\blue There is already a magazine in!"
return 1
user.drop_item()
A.loc = src
src.magazine = A
src.icon_state = "ak331"
return 1
return

/obj/item/weapon/gun/ak331/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 ak331 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
Binary file modified icons/mob/back.dmi
Binary file not shown.
Binary file modified icons/obj/ammo.dmi
Binary file not shown.
Binary file modified icons/obj/gun.dmi
Binary file not shown.

0 comments on commit e792d76

Please sign in to comment.