mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 11:13:16 +00:00
- Replaced them with a whole range of inventory slot flags. These now govern whether an item can or can't be placed in a certain inventory slot. See setup.dm for information on the flags. These flags only affect humans tho, as humans are the only beings with an inventory to talk of. - Standardized some gun code and some other pieces of code as I came accross them. I hate indented variable definitions! This commit should not bring any change whatsoever to the game from a player's perspective. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3659 316c924e-a436-60f5-8080-3fe189b3f50e
85 lines
2.1 KiB
Plaintext
85 lines
2.1 KiB
Plaintext
/obj/item/weapon/gun/projectile
|
|
desc = "A classic revolver. Uses 357 ammo"
|
|
name = "revolver"
|
|
icon_state = "revolver"
|
|
caliber = "357"
|
|
origin_tech = "combat=2;materials=2"
|
|
w_class = 3.0
|
|
m_amt = 1000
|
|
|
|
var/ammo_type = "/obj/item/ammo_casing/a357"
|
|
var/list/loaded = list()
|
|
var/max_shells = 7
|
|
var/load_method = 0 //0 = Single shells or quick loader, 1 = box, 2 = magazine
|
|
var/obj/item/ammo_magazine/empty_mag = null
|
|
|
|
|
|
New()
|
|
..()
|
|
for(var/i = 1, i <= max_shells, i++)
|
|
loaded += new ammo_type(src)
|
|
update_icon()
|
|
return
|
|
|
|
|
|
load_into_chamber()
|
|
// if(in_chamber)
|
|
// return 1 {R}
|
|
|
|
if(!loaded.len)
|
|
return 0
|
|
|
|
var/obj/item/ammo_casing/AC = loaded[1] //load next casing.
|
|
loaded -= AC //Remove casing from loaded list.
|
|
AC.loc = get_turf(src) //Eject casing onto ground.
|
|
AC.desc += " This one is spent." //descriptions are magic
|
|
|
|
if(AC.BB)
|
|
in_chamber = AC.BB //Load projectile into chamber.
|
|
AC.BB.loc = src //Set projectile loc to gun.
|
|
return 1
|
|
return 0
|
|
|
|
|
|
attackby(var/obj/item/A as obj, mob/user as mob)
|
|
|
|
var/num_loaded = 0
|
|
if(istype(A, /obj/item/ammo_magazine))
|
|
if((load_method == 2) && loaded.len) return
|
|
var/obj/item/ammo_magazine/AM = A
|
|
for(var/obj/item/ammo_casing/AC in AM.stored_ammo)
|
|
if(loaded.len >= max_shells)
|
|
break
|
|
if(AC.caliber == caliber && loaded.len < max_shells)
|
|
AC.loc = src
|
|
AM.stored_ammo -= AC
|
|
loaded += AC
|
|
num_loaded++
|
|
if(load_method == 2)
|
|
user.remove_from_mob(AM)
|
|
empty_mag = AM
|
|
empty_mag.loc = src
|
|
if(istype(A, /obj/item/ammo_casing) && !load_method)
|
|
var/obj/item/ammo_casing/AC = A
|
|
if(AC.caliber == caliber && loaded.len < max_shells)
|
|
user.drop_item()
|
|
AC.loc = src
|
|
loaded += AC
|
|
num_loaded++
|
|
if(num_loaded)
|
|
user << "\blue You load [num_loaded] shell\s into the gun!"
|
|
A.update_icon()
|
|
update_icon()
|
|
return
|
|
|
|
|
|
examine()
|
|
..()
|
|
usr << "Has [loaded.len] round\s remaining."
|
|
// if(in_chamber && !loaded.len)
|
|
// usr << "However, it has a chambered round."
|
|
// if(in_chamber && loaded.len)
|
|
// usr << "It also has a chambered round." {R}
|
|
return
|
|
|