mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 03:33:21 +00:00
Ports Polaris #6492
Fixes a divide by zero issue with brain damage and pulse.
This commit is contained in:
@@ -1641,7 +1641,7 @@
|
|||||||
if(R.volume >= R.overdose)
|
if(R.volume >= R.overdose)
|
||||||
temp = PULSE_NONE
|
temp = PULSE_NONE
|
||||||
|
|
||||||
return round(temp * brain_modifier)
|
return max(0, round(temp * brain_modifier))
|
||||||
|
|
||||||
/mob/living/carbon/human/proc/handle_heartbeat()
|
/mob/living/carbon/human/proc/handle_heartbeat()
|
||||||
if(pulse == PULSE_NONE)
|
if(pulse == PULSE_NONE)
|
||||||
|
|||||||
@@ -131,12 +131,7 @@ GLOBAL_LIST_BOILERPLATE(all_brain_organs, /obj/item/organ/internal/brain)
|
|||||||
..()
|
..()
|
||||||
|
|
||||||
/obj/item/organ/internal/brain/proc/get_control_efficiency()
|
/obj/item/organ/internal/brain/proc/get_control_efficiency()
|
||||||
. = 0
|
. = max(0, 1 - (round(damage / max_damage * 10) / 10))
|
||||||
|
|
||||||
if(!is_broken())
|
|
||||||
. = 1 - (round(damage / max_damage * 10) / 10)
|
|
||||||
|
|
||||||
return .
|
|
||||||
|
|
||||||
/obj/item/organ/internal/brain/pariah_brain
|
/obj/item/organ/internal/brain/pariah_brain
|
||||||
name = "brain remnants"
|
name = "brain remnants"
|
||||||
|
|||||||
@@ -24,9 +24,9 @@
|
|||||||
if(owner.internal_organs_by_name[O_BRAIN]) // As the brain starts having Trouble, the lungs start malfunctioning.
|
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]
|
var/obj/item/organ/internal/brain/Brain = owner.internal_organs_by_name[O_BRAIN]
|
||||||
if(Brain.get_control_efficiency() <= 0.8)
|
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!")
|
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()
|
/obj/item/organ/internal/lungs/proc/rupture()
|
||||||
var/obj/item/organ/external/parent = owner.get_organ(parent_organ)
|
var/obj/item/organ/external/parent = owner.get_organ(parent_organ)
|
||||||
|
|||||||
Reference in New Issue
Block a user