Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minimum recoil for ballistics #3330

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@
///this is how much deviation the gun recoil can have, recoil pushes the screen towards the reverse angle you shot + some deviation which this is the max.
var/recoil_deviation = 22.5

///Used if the guns recoil is lower then the min, it clamps the highest recoil
var/min_recoil = 0

var/gunslinger_recoil_bonus = 0
var/gunslinger_spread_bonus = 0

/// how many shots per burst, Ex: most machine pistols, M90, some ARs are 3rnd burst, while others like the GAR and laser minigun are 2 round burst.
var/burst_size = 3
///The rate of fire when firing in a burst. Not the delay between bursts
Expand Down Expand Up @@ -316,9 +322,6 @@
///This prevents gun from firing until the coodown is done, affected by lag
var/current_cooldown = 0

var/gunslinger_recoil_bonus = 0
var/gunslinger_spread_bonus = 0

/obj/item/gun/Initialize()
. = ..()
RegisterSignal(src, COMSIG_TWOHANDED_WIELD, PROC_REF(on_wield))
Expand Down Expand Up @@ -808,7 +811,7 @@
/obj/item/gun/proc/calculate_recoil(mob/user, recoil_bonus = 0)
if(HAS_TRAIT(user, TRAIT_GUNSLINGER))
recoil_bonus += gunslinger_recoil_bonus
return clamp(recoil_bonus, 0 , INFINITY)
return clamp(recoil_bonus, min_recoil , INFINITY)

/obj/item/gun/proc/calculate_spread(mob/user, bonus_spread)
var/final_spread = 0
Expand Down
2 changes: 2 additions & 0 deletions code/modules/projectiles/guns/ballistic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
has_safety = TRUE
safety = TRUE

min_recoil = 0.1

valid_attachments = list(
/obj/item/attachment/silencer,
/obj/item/attachment/laser_sight,
Expand Down
Loading