Merge pull request #6492 from Mechoid/FixDivbyZeroSeriouslyHowDidIDoThat

Fix The Zeros
This commit is contained in:
Atermonera
2019-10-23 15:19:24 -08:00
committed by GitHub
3 changed files with 4 additions and 7 deletions

View File

@@ -1630,7 +1630,7 @@
if(R.volume >= R.overdose)
temp = PULSE_NONE
return round(temp * brain_modifier)
return max(0, round(temp * brain_modifier))
/mob/living/carbon/human/proc/handle_heartbeat()
if(pulse == PULSE_NONE)

View File

@@ -131,10 +131,7 @@ GLOBAL_LIST_BOILERPLATE(all_brain_organs, /obj/item/organ/internal/brain)
..()
/obj/item/organ/internal/brain/proc/get_control_efficiency()
. = 0
if(!is_broken())
. = 1 - (round(damage / max_damage * 10) / 10)
. = max(0, 1 - (round(damage / max_damage * 10) / 10))
return .

View File

@@ -24,9 +24,9 @@
if(owner.internal_organs_by_name[O_BRAIN]) // As the brain starts having Trouble, the lungs start malfunctioning.
var/obj/item/organ/internal/brain/Brain = owner.internal_organs_by_name[O_BRAIN]
if(Brain.get_control_efficiency() <= 0.8)
if(prob(4 / Brain.get_control_efficiency()))
if(prob(4 / max(0.1,Brain.get_control_efficiency())))
spawn owner.emote("me", 1, "gasps for air!")
owner.AdjustLosebreath(round(3 / Brain.get_control_efficiency()))
owner.AdjustLosebreath(round(3 / max(0.1,Brain.get_control_efficiency())))
/obj/item/organ/internal/lungs/proc/rupture()
var/obj/item/organ/external/parent = owner.get_organ(parent_organ)