Files
CHOMPStation2/code/modules/projectiles/projectile/bullets_ch.dm
2021-08-12 22:20:36 -07:00

406 lines
10 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#define GRAINS_PER_KG 15432.4
/obj/item/projectile/bullet
var/diam = 9 //mm
var/energy_add = 0 //See note below. Adds velocity, basically.
var/velocity = 500 //Meters per second
var/hollow_point = FALSE //Determines if the round leaves additional shrapnel in the wound
var/grains = 115 //I hope the unit is obvious
var/energy //Joules
var/old_bullet_act = TRUE //This makes it so that the game ignores the new ballistic stuff and uses old damage system for the bullet.
/*energy_add
Pretty much, when a bullet is a fired from a gun, it replaces the default muzzle velocity of the round with it's own muzzle velocity,
so if you want a certain round to have extra velocity, you have the option to add energy. For example,
if I have an AP round that shoots 650 m/s and the base round only shoots 600 m/s, I need to take the weight of the round in grains (say 60),
convert it to kilograms (divide by 15432 or some wacky number like that, just google grains to kilograms), then multiply the weight in kilograms by
the velocity squared for both the 650, and 600, and subtract the result for 650 from the result for 600, then that number is what I would put there.
If you want to be lazy, or you can't find more specific numbers for the AP/HP versions of a round, then just don't bother with changing any of that and
only use the hollow_point and armor_penetration values.*/
/obj/item/projectile/bullet/launch_projectile(atom/target, target_zone, mob/user, params, angle_override, forced_spread = 0)
energy = 0.5 * velocity * velocity * (grains / GRAINS_PER_KG) + energy_add
sub_energy(0)
return ..()
/obj/item/projectile/bullet/proc/sub_velocity(var/amount)
velocity = max(0,velocity - amount)
energy = 0.5 * velocity * velocity * (grains / GRAINS_PER_KG)
/obj/item/projectile/bullet/proc/sub_energy(var/amount)
energy = max(0,energy - amount)
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
/obj/item/projectile/bullet/pistol/ap
grains = 66
energy_add = 893
velocity = 595
armor_penetration = 15
/obj/item/projectile/bullet/pistol/hp
grains = 131
velocity = 350
energy_add = -96.18
hollow_point = TRUE
armor_penetration = -10
/obj/item/projectile/bullet/pistol/medium //.45
fire_sound = 'sound/weapons/ballistics/a45.ogg'
diam = 11.43
grains = 230
velocity = 295
/obj/item/projectile/bullet/pistol/medium/ap
grains = 173
energy_add = 374
velocity = 347
armor_penetration = 15
/obj/item/projectile/bullet/pistol/medium/hp
grains = 230
velocity = 286
armor_penetration = -10
/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
armor_penetration = 15 //Unfortunately my penetration code doesn't recognize the glory of 5.7x28 FN, so we must show it the wae.
/obj/item/projectile/bullet/a57/ap
grains = 23
energy_add = 312.75
velocity = 850
armor_penetration = 25 //Also, no, this isn't as high as it looks because of the formulas I was using. This would have around a 35% chance of piercing combat armor(50 bullet armor)
/obj/item/projectile/bullet/a57/hp
hollow_point = TRUE
armor_penetration = -10
/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 = 15
/obj/item/projectile/bullet/a357/hp
hollow_point = TRUE
armor_penetration = -10
/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 = 15
/obj/item/projectile/bullet/a38/hp
grains = 158
energy_add = 175.07
velocity = 297
hollow_point = TRUE
armor_penetration = -10
/obj/item/projectile/bullet/a762x25
fire_sound = 'sound/weapons/gunshot2.ogg'
diam = 7.92
grains = 85
velocity = 469
/obj/item/projectile/bullet/a9x18
fire_sound = 'sound/weapons/gunshot2.ogg'
diam = 9.27
grains = 95
velocity = 319
/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 = 15
/obj/item/projectile/bullet/a10mm/hp
grains = 135
energy_add = 700.7
velocity = 490
armor_penetration = -10
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 = 15
/obj/item/projectile/bullet/a380/hp
grains = 95
energy_add = 170
velocity = 343
armor_penetration = -10
hollow_point = TRUE
/obj/item/projectile/bullet/a22lr
fire_sound = 'sound/weapons/gunshot_pathetic.ogg'
grains = 40
diam = 5.7
velocity = 370
/obj/item/projectile/bullet/a22lr/ap
grains = 31
velocity = 530
armor_penetration = 15
/obj/item/projectile/bullet/a22lr/hp
grains = 38
velocity = 380
hollow_point = TRUE
armor_penetration = -5
//Shotgun projectiles
/obj/item/projectile/bullet/shotgun //Slug
fire_sound = 'sound/weapons/ballistics/a12g.ogg'
grains = 657
velocity = 489
armor_penetration = -15 //Slugs needed a nerf. Will probably fix the stats for shotguns in general in future updates.
/obj/item/projectile/bullet/shotgun/buckshot //#00 Buckshot
damage = 13
name = "buckshot pellet"
diam = 8.38
grains = 53.8
velocity = 489
armor_penetration = 0
/obj/item/projectile/bullet/shotgun/buckshot/shell
use_submunitions = TRUE
submunition_spread_max = 67.5
submunitions = list(/obj/item/projectile/bullet/shotgun/buckshot = 8)
//Rifle projectiles
/obj/item/projectile/bullet/rifle
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.82
grains = 147
velocity = 850
/obj/item/projectile/bullet/rifle/a762/ap
grains = 150.5
velocity = 854.6
armor_penetration = 25
/obj/item/projectile/bullet/rifle/a762/hp
grains = 175
energy_add = -539.978
velocity = 792
armor_penetration = -10
hollow_point = TRUE
/obj/item/projectile/bullet/rifle/a762x39 //7.62x39 Soviet
fire_sound = 'sound/weapons/ballistics/a762.ogg'
diam = 7.85
grains = 122
velocity = 730
/obj/item/projectile/bullet/rifle/a762x39/ap
grains = 123
velocity = 740
energy_add = 117.16
armor_penetration = 25
/obj/item/projectile/bullet/rifle/a762x39/hp
hollow_point = TRUE
armor_penetration = -10
/obj/item/projectile/bullet/rifle/a545
fire_sound = 'sound/weapons/ballistics/a545.ogg'
diam = 5.6
grains = 53
velocity = 880
/obj/item/projectile/bullet/rifle/a545/ap
grains = 57
velocity = 890
armor_penetration = 15
/obj/item/projectile/bullet/rifle/a545/hp
hollow_point = TRUE
armor_penetration = -10
/obj/item/projectile/bullet/rifle/a556 //5.56x45mm NATO
diam = 5.7
grains = 62
velocity = 961
/obj/item/projectile/bullet/rifle/a556/ap
grains = 52
velocity = 1030
energy_add = 462.92
armor_penetration = 25
/obj/item/projectile/bullet/rifle/a556/hp
hollow_point = TRUE
armor_penetration = -10
/obj/item/projectile/bullet/rifle/a145 // 14.5×114mm
fire_sound = 'sound/weapons/ballistics/a145.ogg'
diam = 14.88
grains = 921
velocity = 1000
/obj/item/projectile/bullet/rifle/a145/highvel
grains = 700
energy_add = 9979
velocity = 1200
/obj/item/projectile/bullet/rifle/a44rifle
fire_sound = 'sound/weapons/ballistics/a44rifle.ogg'
diam = 10.9
grains = 240
velocity = 536.448
/obj/item/projectile/bullet/rifle/a95 //I hate you. There is no real world analog for 9.5x40mm, I will guestimate from the 9x39mm russian round and give it some bonus for future points or whatever
diam = 9.5
grains = 310
velocity = 365
/obj/item/projectile/bullet/rifle/a9x39 //We also have actual 9x39mm
fire_sound = 'sound/weapons/ballistics/a545.ogg'
diam = 9.25
grains = 259
velocity = 280
/obj/item/projectile/bullet/rifle/a9x39/ap
grains = 267
armor_penetration = 25
/obj/item/projectile/bullet/rifle/a10x24
fire_sound = 'sound/weapons/ballistics/a762.ogg'
grains = 210
diam = 10.2
velocity = 840
/obj/item/projectile/bullet/rifle/a762/lmg //This is actually 7.92x57 ffs
diam = 7.92
grains = 181
velocity = 820
/obj/item/projectile/bullet/rifle/a762x54
fire_sound = 'sound/weapons/ballistics/a762x54.ogg'
diam = 7.92
grains = 151
velocity = 830
hitscan = 1
/obj/item/projectile/bullet/rifle/a762x54/ap
armor_penetration = 35
/obj/item/projectile/bullet/rifle/a338
fire_sound = 'sound/weapons/ballistics/a762x54.ogg'
damage = 45
diam = 8.61
grains = 250
velocity = 921
hitscan = 1
penetrating = 2
/obj/item/projectile/bullet/rifle/a338/ap
armor_penetration = 50
/obj/item/projectile/bullet/rifle/a50bmg
fire_sound = 'sound/weapons/ballistics/a145.ogg'
damage = 65
diam = 13
grains = 750
velocity = 860
hitscan = 1
penetrating = 2
/obj/item/projectile/bullet/rifle/a50bmg/ap
armor_penetration = 50
//NOTE: Ammo casings and magazines used to be in this part of the file. They have been moved to respective files in the projectiles/ammunition folder.
//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
/obj/item/projectile/bullet/pellet
old_bullet_act = TRUE
/obj/item/projectile/bullet/pellet/shotgun/flak
old_bullet_act = TRUE
/obj/item/projectile/bullet/rifle/a762/hunter
old_bullet_act = TRUE
/obj/item/projectile/bullet/rifle/a545/hunter
old_bullet_act = TRUE
/obj/item/projectile/bullet/suffocationbullet
old_bullet_act = TRUE
/obj/item/projectile/bullet/cyanideround
old_bullet_act = TRUE
/obj/item/projectile/bullet/burstbullet
old_bullet_act = TRUE
/obj/item/projectile/bullet/incendiary
old_bullet_act = TRUE
/obj/item/projectile/bullet/practice
old_bullet_act = TRUE
/obj/item/projectile/bullet/blank
old_bullet_act = TRUE
/obj/item/projectile/bullet/srmrocket
old_bullet_act = TRUE
/obj/item/projectile/bullet/chemdart
old_bullet_act = TRUE
/obj/item/projectile/bullet/gyro
old_bullet_act = TRUE