mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-29 16:18:01 +01:00
[MIRROR] [s] Caps misfire probability to prevent infinite recursive procs (#5511)
* Caps misfire probability (#58902) Not the proper fix for this but it at least prevents the exploitative behaviour. This'll do for now, prevents infinite recursive loops * [s] Caps misfire probability to prevent infinite recursive procs Co-authored-by: necromanceranne <40847847+necromanceranne@users.noreply.github.com>
This commit is contained in:
co-authored by
necromanceranne
parent
680a6d1213
commit
7c0f9f8512
@@ -104,12 +104,17 @@
|
||||
var/alternative_fire_sound
|
||||
///If only our alternative ammuntion misfires and not our main ammunition, we set this to TRUE
|
||||
var/alternative_ammo_misfires = FALSE
|
||||
|
||||
/// Misfire Variables ///
|
||||
|
||||
/// Whether our ammo misfires now or when it's set by the wrench_act. TRUE means it misfires.
|
||||
var/can_misfire = FALSE
|
||||
///How likely is our gun to misfire?
|
||||
var/misfire_probability = 0
|
||||
///How much does shooting the gun increment the misfire probability?
|
||||
var/misfire_percentage_increment = 0
|
||||
///What is the cap on our misfire probability? Do not set this to 100.
|
||||
var/misfire_probability_cap = 25
|
||||
|
||||
/obj/item/gun/ballistic/Initialize()
|
||||
. = ..()
|
||||
@@ -358,6 +363,7 @@
|
||||
/obj/item/gun/ballistic/shoot_live_shot(mob/living/user, pointblank = 0, atom/pbtarget = null, message = 1)
|
||||
if(can_misfire)
|
||||
misfire_probability += misfire_percentage_increment
|
||||
misfire_probability = clamp(misfire_probability, 0, misfire_probability_cap)
|
||||
|
||||
. = ..()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user