This commit is contained in:
Hatterhat
2022-08-03 06:01:35 -05:00
parent 4665229e16
commit 670bda0e29
2 changed files with 14 additions and 1 deletions

View File

@@ -250,7 +250,20 @@ It's fairly easy to fix if dealing with single letters but not so much with comp
animate(pixel_x=rand(min,max), pixel_y=rand(min,max), time=1)
animate(pixel_x=oldx, pixel_y=oldy, time=1)
/proc/directional_recoil(mob/M, strength=1, angle = 0)
if(!M || !M.client)
return
var/client/C = M.client
var/recoil_x = -sin(angle)*4*strength + rand(-strength, strength)
var/recoil_y = -cos(angle)*4*strength + rand(-strength, strength)
animate(C, pixel_x=recoil_x, pixel_y=recoil_y, time=1, easing=SINE_EASING|EASE_OUT, flags=ANIMATION_PARALLEL|ANIMATION_RELATIVE)
addtimer(CALLBACK(GLOBAL_PROC, /proc/recoil_recover, M), 2)
/proc/recoil_recover(mob/M)
if(!M || !M.client)
return
var/client/C = M.client
animate(C, pixel_x=0, pixel_y=0, time=3, easing=SINE_EASING|EASE_IN)
/proc/findname(msg)
if(!istext(msg))

View File

@@ -159,7 +159,7 @@
/obj/item/gun/proc/shoot_live_shot(mob/living/user, pointblank = FALSE, mob/pbtarget, message = 1, stam_cost = 0)
if(recoil)
shake_camera(user, recoil + 1, recoil)
directional_recoil(user, recoil*5, Get_Angle(user, pbtarget)) // the *5 is a placeholder. the recoil goes hard
if(stam_cost) //CIT CHANGE - makes gun recoil cause staminaloss
var/safe_cost = clamp(stam_cost, 0, user.stamina_buffer)*(firing && burst_size >= 2 ? 1/burst_size : 1)