mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-26 00:51:23 +00:00
Spent casings ejected from firearms will spin as they 'tumble' towards the ground. Improved sprites for shotgun shells Improved sprite for bullet projectile.
83 lines
2.4 KiB
Plaintext
83 lines
2.4 KiB
Plaintext
/obj/item/weapon/gun/projectile
|
|
desc = "Now comes in flavors like GUN. Uses 10mm ammo, for some reason"
|
|
name = "projectile gun"
|
|
icon_state = "pistol"
|
|
origin_tech = "combat=2;materials=2"
|
|
w_class = 3.0
|
|
m_amt = 1000
|
|
|
|
var/mag_type = /obj/item/ammo_box/magazine/m10mm //Removes the need for max_ammo and caliber info
|
|
var/obj/item/ammo_box/magazine/magazine
|
|
|
|
/obj/item/weapon/gun/projectile/New()
|
|
..()
|
|
magazine = new mag_type(src)
|
|
chamber_round()
|
|
update_icon()
|
|
return
|
|
|
|
/obj/item/weapon/gun/projectile/process_chamber(var/eject_casing = 1, var/empty_chamber = 1)
|
|
// if(in_chamber)
|
|
// return 1
|
|
var/obj/item/ammo_casing/AC = chambered //Find chambered round
|
|
if(isnull(AC) || !istype(AC))
|
|
chamber_round()
|
|
return
|
|
if(eject_casing)
|
|
AC.loc = get_turf(src) //Eject casing onto ground.
|
|
AC.SpinAnimation(10, 1) //next gen special effects
|
|
|
|
if(empty_chamber)
|
|
chambered = null
|
|
chamber_round()
|
|
return
|
|
|
|
/obj/item/weapon/gun/projectile/proc/chamber_round()
|
|
if (chambered || !magazine)
|
|
return
|
|
else if (magazine.ammo_count())
|
|
chambered = magazine.get_round()
|
|
chambered.loc = src
|
|
return
|
|
|
|
/obj/item/weapon/gun/projectile/attackby(var/obj/item/A as obj, mob/user as mob)
|
|
if (istype(A, /obj/item/ammo_box/magazine))
|
|
var/obj/item/ammo_box/magazine/AM = A
|
|
if (!magazine && istype(AM, mag_type))
|
|
user.remove_from_mob(AM)
|
|
magazine = AM
|
|
magazine.loc = src
|
|
user << "<span class='notice'>You load a new magazine into \the [src].</span>"
|
|
chamber_round()
|
|
A.update_icon()
|
|
update_icon()
|
|
return 1
|
|
else if (magazine)
|
|
user << "<span class='notice'>There's already a magazine in \the [src].</span>"
|
|
return 0
|
|
|
|
/obj/item/weapon/gun/projectile/attack_self(mob/living/user as mob)
|
|
if (magazine)
|
|
magazine.loc = get_turf(src.loc)
|
|
user.put_in_hands(magazine)
|
|
magazine.update_icon()
|
|
magazine = null
|
|
user << "<span class='notice'>You pull the magazine out of \the [src].</span>"
|
|
else
|
|
user << "<span class='notice'>There's no magazine in \the [src].</span>"
|
|
update_icon()
|
|
return
|
|
|
|
|
|
/obj/item/weapon/gun/projectile/examine()
|
|
..()
|
|
usr << "Has [get_ammo()] round\s remaining."
|
|
return
|
|
|
|
/obj/item/weapon/gun/projectile/proc/get_ammo(var/countchambered = 1)
|
|
var/boolets = 0 //mature var names for mature people
|
|
if (chambered && countchambered)
|
|
boolets++
|
|
if (magazine)
|
|
boolets += magazine.ammo_count()
|
|
return boolets |