Ballistics v3

This commit is contained in:
Cadyn
2020-11-19 17:02:22 -08:00
parent d3c838be3d
commit 7f1579061b
20 changed files with 345 additions and 6 deletions

View File

@@ -1,6 +1,65 @@
//Time to add our own awesome guns! >:D
/obj/item/weapon/gun/projectile/fiveseven
name = "Five-seven handgun"
desc = "A unique pistol that fires 5.7x28mm instead of typical handgun cartridges"
caliber = "5.7x28mm"
bolt_name="slide"
bolt_release = "slide release"
auto_loading_type = CLOSED_BOLT | LOCK_OPEN_EMPTY
magazine_type = /obj/item/ammo_magazine/a57
allowed_magazines = list(/obj/item/ammo_magazine/a57)
projectile_type = /obj/item/projectile/bullet/a57
icon = 'icons/obj/gun_ch.dmi'
icon_state = "fiveseven"
load_method = MAGAZINE
/obj/item/weapon/gun/projectile/fiveseven/update_icon()
icon_state = ammo_magazine ? "[initial(icon_state)]" : "[initial(icon_state)]-e"
/obj/item/weapon/gun/projectile/automatic/cballistic
name = "I AM NOT SUPPOSED TO EXIST"
desc = "Yes hello I'm not supposed to exist, I'm just a weird code artefact thing please contact a developer."
icon = 'icons/obj/gun64_ch.dmi'
icon_state = "mp5a5"
appearance_flags = 288
icon_expected_height = 64
icon_expected_width = 64
//icon_scale_x = 0.5
//icon_scale_y = 0.5
/obj/item/weapon/gun/projectile/automatic/cballistic/Initialize()
. = ..()
update_transform()
/obj/item/weapon/gun/projectile/automatic/cballistic/update_transform()
. = ..()
transform = transform.Scale(0.5,0.5)
transform = transform.Translate(-16,-16)
/obj/item/weapon/gun/projectile/automatic/cballistic/update_icon()
icon_state = ammo_magazine ? "[initial(icon_state)]" : "[initial(icon_state)]-e"
/obj/item/weapon/gun/projectile/automatic/cballistic/mp5a5
name = "MP5A5 submachine gun"
desc = "An old, but extremely reliable machine gun from earth. Known for its use in counter-terrorist forces."
caliber = "9mm"
magazine_type = /obj/item/ammo_magazine/mp5mag
allowed_magazines = list(/obj/item/ammo_magazine/mp5mag)
icon_state = "mp5a5"
projectile_type = /obj/item/projectile/bullet/pistol
firemodes = list(
list(mode_name="semiauto", burst=1, fire_delay=0, move_delay=null, burst_accuracy=null, dispersion=null),
list(mode_name="3-round bursts", burst=3, fire_delay=null, move_delay=4, burst_accuracy=list(0,-10,-10), dispersion=list(0.0, 0.3, 0.6))
)
load_method = MAGAZINE
//Time to give all these existing guns some new properties.
//automatic.dm
/obj/item/weapon/gun/projectile/automatic
bolt_name="charging handle"
sound_ejectchamber = 'sound/weapons/ballistics/rifle_ejectchamber.ogg'
sound_eject = 'sound/weapons/ballistics/rifle_eject.ogg'
sound_chamber = 'sound/weapons/ballistics/rifle_chamber.ogg'
/obj/item/weapon/gun/projectile/automatic/advanced_smg
muzzle_velocity = 390 //Based off MPX
@@ -29,8 +88,11 @@
auto_loading_type = OPEN_BOLT
muzzle_velocity = 280 //Mac-10 .45
/obj/item/weapon/gun/projectile/automatic/p90 //Finally a gun that exists irl. oh wait fuck they decided to chamber the p90 in 9mm kms
muzzle_velocity = 397 //Guestimation. Will hopefully be able to replace with actual 5.7mm at some point.
/obj/item/weapon/gun/projectile/automatic/p90 //Finally a gun that exists irl. oh wait fuck they decided to chamber the p90 in 9mm //Fixed bb
muzzle_velocity = 715 //Guestimation. Will hopefully be able to replace with actual 5.7mm at some point. //Done
desc = "The H90K is a compact, large capacity submachine gun produced by MarsTech. Despite its fierce reputation, it still manages to feel like a toy. Uses 5.7x28mm rounds."
caliber = "5.7x28mm"
allowed_magazines = list(/obj/item/ammo_magazine/m9mmp90)
/obj/item/weapon/gun/projectile/automatic/tommygun //Phew, an actual gun that fires the correct cartridge.
auto_loading_type = OPEN_BOLT
@@ -208,11 +270,14 @@
muzzle_velocity = 340 //Guestimation
//semiauto.dm
/obj/item/weapon/gun/projectile/garand //To be updated to use .30 springfield.
/obj/item/weapon/gun/projectile/garand //To be updated to use .30 springfield. //Leaving it as 7.62 for the purpose of making rounds more available.
bolt_name="charging handle"
auto_loading_type = CLOSED_BOLT | LOCK_OPEN_EMPTY | CHAMBER_ON_RELOAD
bolt_release = null
muzzle_velocity = 853 //Actual gun.
sound_ejectchamber = 'sound/weapons/ballistics/rifle_ejectchamber.ogg'
sound_eject = 'sound/weapons/ballistics/rifle_eject.ogg'
sound_chamber = 'sound/weapons/ballistics/rifle_chamber.ogg'
/obj/item/weapon/gun/projectile/revolvingrifle
manual_chamber = FALSE
@@ -238,6 +303,11 @@
manual_chamber = FALSE
muzzle_velocity = 1132 //Istiglal IST-14.5 anti-materiel rifle
/obj/item/weapon/gun/projectile/SVD //To be updated to use actual 7.62x54 instead of 7.62 NATO
/obj/item/weapon/gun/projectile/SVD //To be updated to use actual 7.62x54 instead of 7.62 NATO //Done!
bolt_name = "charging handle"
muzzle_velocity = 830 //Actual gun.
desc = "The PCA S19 Jalgarr, also known by its translated name the 'Dragon', is mass produced with an Optical Sniper Sight so simple that even a Tajaran can use it. Too bad for you that the inscriptions are written in Siik. Uses 7.62x54mmR rounds."
caliber = "7.62x54mmR"
sound_ejectchamber = 'sound/weapons/ballistics/rifle_ejectchamber.ogg'
sound_eject = 'sound/weapons/ballistics/rifle_eject.ogg'
sound_chamber = 'sound/weapons/ballistics/rifle_chamber.ogg'

View File

@@ -26,6 +26,9 @@
var/bolt_locked = FALSE
var/bolt_release = "bolt release"
var/muzzle_velocity = 500 // meters per second
var/sound_ejectchamber = 'sound/weapons/ballistics/pistol_ejectchamber.ogg'
var/sound_eject = 'sound/weapons/ballistics/pistol_eject.ogg'
var/sound_chamber = 'sound/weapons/ballistics/pistol_chamber.ogg'
/obj/item/weapon/gun/projectile/handle_post_fire(mob/user, atom/target, var/pointblank=0, var/reflex=0)
if(fire_anim)
@@ -94,11 +97,14 @@
other_ejected = casing_ejected ? other_ejected : ""
var/casing_chambered = CHECK_BITFIELD(result,BOLT_CASING_CHAMBERED) ? ", chambering a new round" : ""
if(closed && opened)
playsound(src, sound_ejectchamber, 50, 0)
user.visible_message("<span class='notice'>[user] pulls back \the [bolt_name] before releasing it[close_open_ejected] causing it to slide forward again[casing_chambered].</span>", \
"<span class='notice'>You pull back \the [bolt_name] before releasing it[close_open_ejected] causing it to slide forward again[casing_chambered].</span>")
else if(opened)
playsound(src, sound_eject, 50, 0)
if(locked)
if(CHECK_BITFIELD(auto_loading_type,LOCK_MANUAL_LOCK))
playsound(src, sound_ejectchamber, 50, 0)
user.visible_message("<span class='notice'>[user] pulls back \the [bolt_name] and locks it in the open position[casing_chambered][other_ejected].</span>", \
"<span class='notice'>You pull back \the [bolt_name] and lock it in the open position[other_ejected][casing_chambered].</span>")
else
@@ -108,6 +114,7 @@
user.visible_message("<span class='notice'>[user] opens \the [bolt_name][casing_chambered][other_ejected].</span>", \
"<span class='notice'>You pull back \the [bolt_name][casing_chambered][other_ejected].</span>")
else if(closed)
playsound(src, sound_chamber, 50, 0)
if(unlocked)
if(bolt_release)
if(user.a_intent == I_HURT && CHECK_BITFIELD(auto_loading_type,LOCK_SLAPPABLE))

View File

@@ -23,8 +23,8 @@
velocity = sqrt(2*energy/(grains / GRAINS_PER_KG))
//Pistol projectiles
/obj/item/projectile/bullet/pistol //9x19mm
fire_sound = 'sound/weapons/ballistics/a9mm.ogg'
diam = 9
grains = 108
velocity = 381
@@ -43,6 +43,7 @@
armor_penetration = -50
/obj/item/projectile/bullet/pistol/medium //.45
fire_sound = 'sound/weapons/ballistics/a45.ogg'
diam = 11.43
grains = 230
velocity = 295
@@ -58,13 +59,105 @@
velocity = 286
armor_penetration = -50
/obj/item/projectile/bullet/pistol/strong //.357 and .44 are grouped because ftw
/obj/item/projectile/bullet/pistol/strong //.357 and .44 are grouped because ftw //Time to fix that ffs, this is just .44 now.
diam = 10.9
grains = 240
velocity = 360
/obj/item/projectile/bullet/a57
fire_sound = 'sound/weapons/ballistics/a57.ogg'
diam = 5.7
grains = 31
velocity = 716
damage = 15
/obj/item/projectile/bullet/a57/ap
grains = 23
energy_add = 312.75
velocity = 850
armor_penetration = 35
/obj/item/projectile/bullet/a57/hp
hollow_point = TRUE
armor_penetration = -50
/obj/item/projectile/bullet/a357
fire_sound = 'sound/weapons/gunshot4.ogg'
diam = 9.1
grains = 125
velocity = 440
damage = 20
/obj/item/projectile/bullet/a357/ap
energy_add = 298.07
velocity = 480
armor_penetration = 25
/obj/item/projectile/bullet/a357/hp
hollow_point = TRUE
armor_penetration = -50
/obj/item/projectile/bullet/a38
fire_sound = 'sound/weapons/gunshot2.ogg'
diam = 9.1
grains = 147
velocity = 270
/obj/item/projectile/bullet/a38/ap
grains = 125
energy_add = 138
velocity = 300
armor_penetration = 25
/obj/item/projectile/bullet/a38/hp
grains = 158
energy_add = 175.07
velocity = 297
hollow_point = TRUE
armor_penetration = -50
/obj/item/projectile/bullet/a10mm
fire_sound = 'sound/weapons/gunshot2.ogg'
diam = 10.17
grains = 180
velocity = 400
/obj/item/projectile/bullet/a10mm/ap
grains = 200
energy_add = 435
velocity = 440
armor_penetration = 50
/obj/item/projectile/bullet/a10mm/hp
grains = 135
energy_add = 700.7
velocity = 490
armor_penetration = -50
hollow_point = TRUE
/obj/item/projectile/bullet/a380
fire_sound = 'sound/weapons/gunshot2.ogg'
diam = 9
grains= 95
velocity = 300
/obj/item/projectile/bullet/a380/ap
grains = 45
energy_add = 648.74
velocity = 559
armor_penetration = 25
/obj/item/projectile/bullet/a380/hp
grains = 95
energy_add = 170
velocity = 343
armor_penetration = -50
hollow_point = TRUE
//Shotgun projectiles
/obj/item/projectile/bullet/shotgun //Slug
fire_sound = 'sound/weapons/ballistics/a12g.ogg'
grains = 657
velocity = 489
armor_penetration = -50 //Slugs needed a nerf. Will probably fix the stats for shotguns in general in future updates.
@@ -93,6 +186,7 @@
armor_penetration = 0 //No. Rifle rounds don't get extra AP by default, their nature already makes them more armor penetrating.
/obj/item/projectile/bullet/rifle/a762 //7.62x51 NATO
fire_sound = 'sound/weapons/ballistics/a762.ogg'
diam = 7.62
grains = 147
velocity = 850
@@ -110,6 +204,7 @@
hollow_point = TRUE
/obj/item/projectile/bullet/rifle/a545
fire_sound = 'sound/weapons/ballistics/a545.ogg'
diam = 5.45
grains = 53
velocity = 880
@@ -124,6 +219,7 @@
armor_penetration = -50
/obj/item/projectile/bullet/rifle/a145 // 14.5×114mm
fire_sound = 'sound/weapons/ballistics/a145.ogg'
grains = 921
velocity = 1000
@@ -133,6 +229,7 @@
velocity = 1200
/obj/item/projectile/bullet/rifle/a44rifle
fire_sound = 'sound/weapons/ballistics/a44rifle.ogg'
diam = 10.9
grains = 240
velocity = 536.448
@@ -147,6 +244,171 @@
grains = 181
velocity = 820
/obj/item/projectile/bullet/rifle/a762x54
fire_sound = 'sound/weapons/ballistics/a762x54.ogg'
diam = 7.62
grains = 151
velocity = 830
hitscan = 1
/obj/item/projectile/bullet/rifle/a762x54/ap
armor_penetration = 50
//Time to replace projectiles with their proper counterparts now that we have added them.
/obj/item/ammo_casing/a10mm
projectile_type = /obj/item/projectile/bullet/a10mm
/obj/item/ammo_casing/a38
projectile_type = /obj/item/projectile/bullet/a38
/obj/item/ammo_casing/a380
projectile_type = /obj/item/projectile/bullet/a380
/obj/item/ammo_casing/a357
projectile_type = /obj/item/projectile/bullet/a357
/obj/item/ammo_casing/a57
desc = "A standard 5.7x28mm round"
caliber = "5.7x28mm"
projectile_type = /obj/item/projectile/bullet/a57
matter = list(DEFAULT_WALL_MATERIAL = 60)
/obj/item/ammo_casing/a57/ap
desc = "An armor piercing 5.7x28mm round"
projectile_type = /obj/item/projectile/bullet/a57/ap
/obj/item/ammo_casing/a57/hp
desc = "A hollow point 5.7x28mm round"
projectile_type = /obj/item/projectile/bullet/a57/ap
/obj/item/ammo_casing/a57/rubber
desc = "A rubber 5.7x28mm round"
projectile_type = /obj/item/projectile/bullet/pistol/rubber
/obj/item/ammo_magazine/m9mmp90 //congratulations you are now being converted 5.7x28mm, a.k.a the round the p90 actually uses.
name = "large capacity top mounted magazine (5.7x28mm armor-piercing)" //Ugh, we'll leave it AP I guess
ammo_type = /obj/item/ammo_casing/a57/ap
caliber = "5.7x28mm"
/obj/item/ammo_casing/a762x54
desc = "A standard 7.62x54mmR round"
caliber = "7.62x54mmR"
projectile_type = /obj/item/projectile/bullet/rifle/a762x54
matter = list(DEFAULT_WALL_MATERIAL = 160)
/obj/item/ammo_casing/a762x54/ap
desc = "An armor piercing 7.62x54mmR round"
projectile_type = /obj/item/projectile/bullet/rifle/a762x54/ap
/obj/item/ammo_magazine/m762svd //You are now being converted to 7.62x54mmR :3
name = "\improper SVD magazine (7.62x54mmR)"
caliber = "7.62x54mmR"
ammo_type = /obj/item/ammo_casing/a762x54
/obj/item/ammo_magazine/m762svd/ap
name = "\improper SVD magazine (7.62x54mmR armor-piercing)"
ammo_type = /obj/item/ammo_casing/a762x54/ap
//New magazines
/obj/item/ammo_magazine/a57
name = "five-seven magazine(5.7x28mm standard)"
icon_state = "fiveseven"
max_ammo = 20
mag_type = MAGAZINE
caliber= "5.7x28mm"
matter = list(DEFAULT_WALL_MATERIAL = 800)
multiple_sprites = 0
ammo_type = /obj/item/ammo_casing/a57
/obj/item/ammo_magazine/a57/ap
name = "five-seven magazine(5.7x28mm armor-piercing)"
ammo_type = /obj/item/ammo_casing/a57/ap
/obj/item/ammo_magazine/a57/hp
name = "five-seven magazine(5.7x28mm hollow-point)"
ammo_type = /obj/item/ammo_casing/a57/hp
/obj/item/ammo_magazine/a57/rubber
name = "five-seven magazine(5.7x28mm rubber)"
ammo_type = /obj/item/ammo_casing/a57/rubber
/obj/item/ammo_magazine/mp5mag
name = "mp5 magazine(9x19mm standard)"
icon = 'icons/obj/ammo_vr.dmi'
icon_state = "smg"
max_ammo = 30
mag_type = MAGAZINE
caliber = "9mm"
matter = list(DEFAULT_WALL_MATERIAL = 800)
multiple_sprites = 1
ammo_type = /obj/item/ammo_casing/a9mm
/obj/item/ammo_magazine/mp5mag/ap
name = "mp5 magazine(9x19mm armor-piercing)"
ammo_type = /obj/item/ammo_casing/a9mm/ap
/obj/item/ammo_magazine/mp5mag/hp
name = "mp5 magazine(9x19mm hollow-point)"
ammo_type = /obj/item/ammo_casing/a9mm/ap
/obj/item/ammo_magazine/mp5mag/rubber
name = "mp5 magazine(9x19mm rubber)"
ammo_type = /obj/item/ammo_casing/a9mm/rubber
//Add some autolathe entries for the new converted mags
/datum/category_item/autolathe/arms/smg_mp5
name = "mp5 magazine(9x19mm standard)"
path = /obj/item/ammo_magazine/mp5mag
hidden = 1
/datum/category_item/autolathe/arms/smg_mp5_ap
name = "mp5 magazine(9x19mm armor-piercing)"
path = /obj/item/ammo_magazine/mp5mag/ap
hidden = 1
/datum/category_item/autolathe/arms/smg_mp5_hp
name = "mp5 magazine(9x19mm hollow-point)"
path = /obj/item/ammo_magazine/mp5mag/hp
hidden = 1
/datum/category_item/autolathe/arms/smg_mp5_rubber
name = "mp5 magazine(9x19mm rubber)"
path = /obj/item/ammo_magazine/mp5mag/rubber
/datum/category_item/autolathe/arms/pistol_fiveseven
name = "five-seven magazine(5.7x28mm standard)"
path = /obj/item/ammo_magazine/a57
hidden = 1
/datum/category_item/autolathe/arms/pistol_fiveseven_ap
name = "five-seven magazine(5.7x28mm armor-piercing)"
path = /obj/item/ammo_magazine/a57/ap
hidden = 1
/datum/category_item/autolathe/arms/pistol_fiveseven_hp
name = "five-seven magazine(5.7x28mm hollow-point)"
path = /obj/item/ammo_magazine/a57/hp
hidden = 1
/datum/category_item/autolathe/arms/pistol_fiveseven_rubber
name = "five-seven magazine(5.7x28mm rubber)"
path = /obj/item/ammo_magazine/a57/rubber
/datum/category_item/autolathe/arms/smg_p90
name = "large capacity top mounted magazine (5.7x28mm armor-piercing)"
path = /obj/item/ammo_magazine/m9mmp90
hidden = 1
/datum/category_item/autolathe/arms/svd_762
name = "SVD magazine (7.62x54mmR)"
path = /obj/item/ammo_magazine/m762svd
hidden = 1
/datum/category_item/autolathe/arms/svd_762_ap
name = "SVD magazine (7.62x54mmR armor-piercing)"
path = /obj/item/ammo_magazine/m762svd/ap
hidden = 1
//Various "We're not dealing with this shit because of how bad it is" (Some of these may be implemented into the new system with later updates)
/obj/item/projectile/bullet/magnetic
old_bullet_act = TRUE