diff --git a/code/modules/projectiles/guns/ballistic.dm b/code/modules/projectiles/guns/ballistic.dm index a8e85840c19..52b66ab4444 100644 --- a/code/modules/projectiles/guns/ballistic.dm +++ b/code/modules/projectiles/guns/ballistic.dm @@ -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) . = ..()