Skip to content

Commit

Permalink
Merge pull request Civ13#2929 from SepuIka/master
Browse files Browse the repository at this point in the history
Reduced recoil for bursts. Rocket launchers accuracy update. Tracer effects update.
savethetreez authored Jun 7, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 6517636 + 4a07d63 commit df0fb20
Showing 5 changed files with 52 additions and 7 deletions.
22 changes: 18 additions & 4 deletions code/modules/1713/weapons/guns/rocket.dm
Original file line number Diff line number Diff line change
@@ -39,9 +39,20 @@

/obj/item/weapon/gun/launcher/process_projectile(obj/item/projectile, mob/user, atom/target, var/target_zone, var/params=null, var/pointblank=0, var/reflex=0)
projectile.loc = get_turf(user)

var/shot_accuracy = rand(-accuracy, accuracy)
var/dt_movement = world.time - user.last_movement
if (dt_movement <= 6)
shot_accuracy = rand(-20, 20)
else if (dt_movement < 10)
var/accuracy_range = 20 / sqrt(dt_movement - 6)
shot_accuracy = rand(-accuracy_range, accuracy_range)
if (abs(shot_accuracy) < 5) // even RNjesus won’t help you get there right away
shot_accuracy += 5
if(user.m_intent != "run")
shot_accuracy *= 0.75
if(istype(projectile, /obj/item/projectile/shell))
var/obj/item/projectile/shell/P = projectile
P.dispersion = clamp(shot_accuracy, -40, 40)
P.dir = SOUTH
P.launch(target, user, src, 0, 0)
playsound(get_turf(user), fire_sound, 100, TRUE,100)
@@ -582,8 +593,12 @@
tracer_type = null
caliber = 90

/obj/item/projectile/shell/missile/update_icon()
return
/obj/item/projectile/shell/missile/tracer_effect()
if(permutated.len < 3)
return
for(var/i = 1, i <= 5, i++)
var/obj/effect/projectile/tracer/missile/P = new/obj/effect/projectile/tracer/missile(loc)
P.activate(get_angle(), pixel_x, pixel_y)

/obj/item/projectile/shell/missile/heat
atype = "HEAT"
@@ -670,7 +685,6 @@
trajectory.setup(loc, new_target)
trajectory.angle = new_angle
transform = turn(transform, -(trajectory.angle + 90))
new/obj/effect/effect/smoke/small/fast(loc)
..()

/obj/item/projectile/shell/missile/atgm/he
33 changes: 32 additions & 1 deletion code/modules/projectiles/effects.dm
Original file line number Diff line number Diff line change
@@ -135,4 +135,35 @@

/obj/effect/projectile/tracer/shell
icon_state = "shell_tracer_white"
life_time = 10
life_time = 10

/obj/effect/projectile/tracer/missile
icon_state = "dust_cloud_generic"
life_time = 8
alpha_modifier = 0.8
update_time = 0.2
var/speed_modifier

/obj/effect/projectile/tracer/missile/activate(var/direction, var/x_offset, var/y_offset)
pixel_x = x_offset - (cos(direction) * 32)
pixel_y = y_offset - (sin(direction) * 32)
call_time = world.time
var/dispersion = rand(-20, 20)
angle = direction + dispersion - 180
speed_modifier = rand(1, 2)
update()

/obj/effect/projectile/tracer/missile/update()
var/dt = world.time - call_time
if(dt > life_time)
loc = null
qdel(src)
return
alpha *= alpha_modifier
var/ds = 20
if(dt != 0)
ds /= dt * speed_modifier
pixel_x += cos(angle) * sqrt(ds)
pixel_y += sin(angle) * sqrt(ds)
spawn(update_time)
update()
2 changes: 1 addition & 1 deletion code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
@@ -465,7 +465,7 @@

var/shot_recoil = next_shot_recoil / ergonomics

if(dt > firemodes[sel_mode].burst_delay)
if(dt >= firemodes[sel_mode].burst_delay)
shot_recoil /= sqrt(dt) * 2
if(dt * 0.5 < abs(shot_recoil) )
shot_recoil -= sign(shot_recoil) * dt * 0.5
2 changes: 1 addition & 1 deletion code/modules/projectiles/projectile.dm
Original file line number Diff line number Diff line change
@@ -712,7 +712,7 @@
--penetrating

if (istype(src, /obj/item/projectile/shell))
if (loc == trajectory.target)
if (permutated.len > get_dist(starting, trajectory.target) + rand(0, 3))
var/obj/item/projectile/shell/S = src
on_impact(T)
S.initiate(loc)
Binary file modified icons/obj/projectiles.dmi
Binary file not shown.

0 comments on commit df0fb20

Please sign in to comment.