Ports Polaris #6492

Fixes a divide by zero issue with brain damage and pulse.
This commit is contained in:
Unknown
2019-10-22 21:13:25 -04:00
parent 105cb3748c
commit 6333e7ab72
3 changed files with 4 additions and 9 deletions

View File

@@ -131,12 +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)
return .
. = max(0, 1 - (round(damage / max_damage * 10) / 10))
/obj/item/organ/internal/brain/pariah_brain
name = "brain remnants"

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)