mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 02:34:00 +00:00
Ballistics v2 draft
This commit is contained in:
@@ -105,6 +105,7 @@
|
||||
bolt_name="charging handle"
|
||||
auto_loading_type = CLOSED_BOLT | LOCK_OPEN_EMPTY | CHAMBER_ON_RELOAD
|
||||
bolt_release = null
|
||||
muzzle_velocity = 853
|
||||
|
||||
/obj/item/weapon/gun/projectile/revolvingrifle
|
||||
manual_chamber = FALSE
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
#define BOLT_CASING_EJECTED 16
|
||||
#define BOLT_CASING_CHAMBERED 32
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////// CADYN'S BALLISTICS ////////////////////////////////////////////////////////////////////////// ORIGINAL FROM CHOMPSTATION ////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/obj/item/weapon/gun/projectile
|
||||
var/manual_chamber = TRUE
|
||||
var/auto_loading_type = CLOSED_BOLT | LOCK_MANUAL_LOCK | LOCK_SLAPPABLE
|
||||
@@ -21,6 +25,7 @@
|
||||
var/bolt_open = FALSE
|
||||
var/bolt_locked = FALSE
|
||||
var/bolt_release = "bolt release"
|
||||
var/muzzle_velocity = 500 // meters per second
|
||||
|
||||
/obj/item/weapon/gun/projectile/handle_post_fire(mob/user, atom/target, var/pointblank=0, var/reflex=0)
|
||||
if(fire_anim)
|
||||
@@ -415,4 +420,11 @@
|
||||
set category = "Object"
|
||||
set src in view(1)
|
||||
|
||||
switch_firemodes(usr)
|
||||
switch_firemodes(usr)
|
||||
|
||||
/obj/item/weapon/gun/projectile/process_accuracy(obj/projectile, mob/living/user, atom/target, var/burst, var/held_twohanded)
|
||||
. = ..()
|
||||
var/obj/item/projectile/bullet/P = projectile
|
||||
if(!istype(P))
|
||||
return
|
||||
P.velocity = muzzle_velocity
|
||||
@@ -581,6 +581,13 @@
|
||||
if(check_penetrate(A))
|
||||
passthrough = TRUE
|
||||
penetrating--
|
||||
//CHOMPEdit Begin
|
||||
var/obj/item/projectile/bullet/this = src
|
||||
if(istype(this))
|
||||
if(!this.velocity)
|
||||
passthrough = FALSE
|
||||
penetrating = 0
|
||||
//CHOMPEdit End
|
||||
|
||||
if(passthrough)
|
||||
trajectory_ignore_forcemove = TRUE
|
||||
|
||||
25
code/modules/projectiles/projectile/bullets_ch.dm
Normal file
25
code/modules/projectiles/projectile/bullets_ch.dm
Normal file
@@ -0,0 +1,25 @@
|
||||
#define GRAINS_PER_KG 15432.4
|
||||
|
||||
/obj/item/projectile/bullet
|
||||
var/diam = 9 //mm
|
||||
var/velocity = 500 //Meters per second
|
||||
var/hollow_point = FALSE
|
||||
var/grains = 115 //I hope the unit is obvious
|
||||
var/energy //Joules
|
||||
|
||||
/obj/item/projectile/bullet/launch_projectile(atom/target, target_zone, mob/user, params, angle_override, forced_spread = 0)
|
||||
energy = velocity * velocity * (grains / GRAINS_PER_KG)
|
||||
return ..()
|
||||
|
||||
/obj/item/projectile/bullet/proc/sub_velocity(var/amount)
|
||||
velocity = max(0,velocity - amount)
|
||||
energy = 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))
|
||||
|
||||
/obj/item/projectile/bullet/rifle/a762
|
||||
diam = 7.62
|
||||
velocity = 700
|
||||
grains = 123
|
||||
Reference in New Issue
Block a user