Crit Rework Final Submission

This commit is contained in:
Fox McCloud
2019-03-28 17:28:00 -04:00
parent 290e9135d0
commit d0ea5ee8b9
87 changed files with 797 additions and 480 deletions
+25 -2
View File
@@ -160,6 +160,7 @@
/obj/item/organ/internal/heart/cybernetic/upgraded/on_life()
if(!ishuman(owner))
return
if(!(status & ORGAN_DEAD) && !attempted_restart && !beating)
to_chat(owner, "<span class='warning'>Your [name] detects a cardiac event and attempts to return to its normal rhythm!</span>")
if(prob(20) && emagged)
@@ -180,6 +181,28 @@
addtimer(CALLBACK(src, .proc/recharge), 300)
addtimer(CALLBACK(src, .proc/message_to_owner, owner, "<span class='warning'>Your [name] fails to return to its normal rhythm!</span>"), 30)
if(!(status & ORGAN_DEAD) && !attempted_restart && owner.HasDisease(new /datum/disease/critical/heart_failure(0)))
to_chat(owner, "<span class='warning'>Your [name] detects a cardiac event and attempts to return to its normal rhythm!</span>")
if(prob(40) && emagged)
attempted_restart = TRUE
for(var/datum/disease/critical/heart_failure/HF in owner.viruses)
HF.cure()
addtimer(CALLBACK(src, .proc/message_to_owner, owner, "<span class='warning'>Your [name] returns to its normal rhythm!</span>"), 30)
addtimer(CALLBACK(src, .proc/recharge), 200)
else if(prob(25))
attempted_restart = TRUE
for(var/datum/disease/critical/heart_failure/HF in owner.viruses)
HF.cure()
addtimer(CALLBACK(src, .proc/message_to_owner, owner, "<span class='warning'>Your [name] returns to its normal rhythm!</span>"), 30)
addtimer(CALLBACK(src, .proc/recharge), 200)
else
attempted_restart = TRUE
if(emagged)
addtimer(CALLBACK(src, .proc/recharge), 200)
else
addtimer(CALLBACK(src, .proc/recharge), 300)
addtimer(CALLBACK(src, .proc/message_to_owner, owner, "<span class='warning'>Your [name] fails to return to its normal rhythm!</span>"), 30)
if(!(status & ORGAN_DEAD))
var/boost = emagged ? 2 : 1
owner.AdjustDrowsy(-4 * boost)
@@ -230,7 +253,7 @@
owner.adjustFireLoss(numHigh)
if(prob(numMid))
to_chat(owner, "<span class='warning'>Your [name] lurches awkwardly!</span>")
Stop()
owner.ForceContractDisease(new /datum/disease/critical/heart_failure(0))
if(prob(numMid))
to_chat(owner, "<span class='danger'>Your [name] stops beating!</span>")
Stop()
@@ -246,4 +269,4 @@
owner.adjustFireLoss(numMid)
if(prob(numLow))
to_chat(owner, "<span class='warning'>Your [name] lurches awkwardly!</span>")
Stop()
owner.ForceContractDisease(new /datum/disease/critical/heart_failure(0))
+27 -33
View File
@@ -19,20 +19,16 @@
var/safe_toxins_max = 0.05
var/SA_para_min = 1 //Sleeping agent
var/SA_sleep_min = 5 //Sleeping agent
var/gas_toxicity_multiplier = 100
var/oxy_breath_dam_min = MIN_TOXIC_GAS_DAMAGE
var/oxy_breath_dam_max = MAX_TOXIC_GAS_DAMAGE
var/oxy_damage_type = OXY
var/nitro_breath_dam_min = MIN_TOXIC_GAS_DAMAGE
var/nitro_breath_dam_max = MAX_TOXIC_GAS_DAMAGE
var/oxy_breath_dam_multiplier = 1
var/nitro_damage_type = OXY
var/co2_breath_dam_min = MIN_TOXIC_GAS_DAMAGE
var/co2_breath_dam_max = MAX_TOXIC_GAS_DAMAGE
var/nitro_breath_dam_multiplier = 1
var/co2_damage_type = OXY
var/tox_breath_dam_min = MIN_TOXIC_GAS_DAMAGE
var/tox_breath_dam_max = MAX_TOXIC_GAS_DAMAGE
var/co2_breath_dam_multiplier = 1
var/tox_damage_type = TOX
var/tox_breath_dam_multiplier = 1
var/cold_message = "your face freezing and an icicle forming"
var/cold_level_1_threshold = 260
@@ -88,12 +84,11 @@
return
if(!breath || (breath.total_moles() == 0))
if(H.health >= config.health_threshold_crit)
H.adjustOxyLoss(HUMAN_MAX_OXYLOSS)
else if(!(NOCRITDAMAGE in H.dna.species.species_traits))
H.adjustOxyLoss(HUMAN_CRIT_MAX_OXYLOSS)
if(isspaceturf(loc))
H.adjustOxyLoss(10)
else
H.adjustOxyLoss(5)
H.failed_last_breath = TRUE
if(safe_oxygen_min)
H.throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy)
else if(safe_toxins_min)
@@ -104,6 +99,10 @@
H.throw_alert("not_enough_nitro", /obj/screen/alert/not_enough_nitro)
return FALSE
if(H.health < HEALTH_THRESHOLD_CRIT)
return FALSE
var/gas_breathed = 0
//Partial pressures in our breath
@@ -118,8 +117,8 @@
//Too much oxygen! //Yes, some species may not like it.
if(safe_oxygen_max)
if(O2_pp > safe_oxygen_max)
var/ratio = (breath.oxygen/safe_oxygen_max) * gas_toxicity_multiplier
H.apply_damage_type(Clamp(ratio, oxy_breath_dam_min, oxy_breath_dam_max), oxy_damage_type)
var/ratio = breath.oxygen/safe_oxygen_max
H.apply_damage_type(ratio * 325 * oxy_breath_dam_multiplier, oxy_damage_type)
H.throw_alert("too_much_oxy", /obj/screen/alert/too_much_oxy)
else
H.clear_alert("too_much_oxy")
@@ -130,8 +129,7 @@
gas_breathed = handle_too_little_breath(H, O2_pp, safe_oxygen_min, breath.oxygen)
H.throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy)
else
H.failed_last_breath = FALSE
H.adjustOxyLoss(-5)
H.adjustOxyLoss(-HUMAN_MAX_OXYLOSS)
gas_breathed = breath.oxygen
H.clear_alert("not_enough_oxy")
@@ -145,8 +143,8 @@
//Too much nitrogen!
if(safe_nitro_max)
if(N2_pp > safe_nitro_max)
var/ratio = (breath.nitrogen/safe_nitro_max) * gas_toxicity_multiplier
H.apply_damage_type(Clamp(ratio, nitro_breath_dam_min, nitro_breath_dam_max), nitro_damage_type)
var/ratio = breath.nitrogen/safe_nitro_max
H.apply_damage_type(ratio * 325 * nitro_breath_dam_multiplier, nitro_damage_type)
H.throw_alert("too_much_nitro", /obj/screen/alert/too_much_nitro)
else
H.clear_alert("too_much_nitro")
@@ -157,8 +155,7 @@
gas_breathed = handle_too_little_breath(H, N2_pp, safe_nitro_min, breath.nitrogen)
H.throw_alert("not_enough_nitro", /obj/screen/alert/not_enough_nitro)
else
H.failed_last_breath = FALSE
H.adjustOxyLoss(-5)
H.adjustOxyLoss(-HUMAN_MAX_OXYLOSS)
gas_breathed = breath.nitrogen
H.clear_alert("not_enough_nitro")
@@ -176,9 +173,9 @@
H.co2overloadtime = world.time
else if(world.time - H.co2overloadtime > 120)
H.Paralyse(3)
H.apply_damage_type(3, co2_damage_type) // Lets hurt em a little, let them know we mean business
H.apply_damage_type(HUMAN_MAX_OXYLOSS * co2_breath_dam_multiplier, co2_damage_type) // Lets hurt em a little, let them know we mean business
if(world.time - H.co2overloadtime > 300) // They've been in here 30s now, lets start to kill them for their own good!
H.apply_damage_type(8, co2_damage_type)
H.apply_damage_type(15 * co2_breath_dam_multiplier, co2_damage_type)
H.throw_alert("too_much_co2", /obj/screen/alert/too_much_co2)
if(prob(20)) // Lets give them some chance to know somethings not right though I guess.
H.emote("cough")
@@ -193,8 +190,7 @@
gas_breathed = handle_too_little_breath(H, CO2_pp, safe_co2_min, breath.carbon_dioxide)
H.throw_alert("not_enough_co2", /obj/screen/alert/not_enough_co2)
else
H.failed_last_breath = FALSE
H.adjustOxyLoss(-5)
H.adjustOxyLoss(-HUMAN_MAX_OXYLOSS)
gas_breathed = breath.carbon_dioxide
H.clear_alert("not_enough_co2")
@@ -209,8 +205,8 @@
//Too much toxins!
if(safe_toxins_max)
if(Toxins_pp > safe_toxins_max)
var/ratio = (breath.toxins/safe_toxins_max) * gas_toxicity_multiplier
H.apply_damage_type(Clamp(ratio, tox_breath_dam_min, tox_breath_dam_max), tox_damage_type)
var/ratio = breath.toxins/safe_toxins_max
H.apply_damage_type(ratio * 325 * tox_breath_dam_multiplier, tox_damage_type)
H.throw_alert("too_much_tox", /obj/screen/alert/too_much_tox)
else
H.clear_alert("too_much_tox")
@@ -222,8 +218,7 @@
gas_breathed = handle_too_little_breath(H, Toxins_pp, safe_toxins_min, breath.toxins)
H.throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox)
else
H.failed_last_breath = FALSE
H.adjustOxyLoss(-5)
H.adjustOxyLoss(-HUMAN_MAX_OXYLOSS)
gas_breathed = breath.toxins
H.clear_alert("not_enough_tox")
@@ -261,11 +256,9 @@
if(breath_pp > 0)
var/ratio = safe_breath_min/breath_pp
H.adjustOxyLoss(min(5*ratio, HUMAN_MAX_OXYLOSS)) // Don't fuck them up too fast (space only does HUMAN_MAX_OXYLOSS after all!
H.failed_last_breath = TRUE
. = true_pp*ratio/6
else
H.adjustOxyLoss(HUMAN_MAX_OXYLOSS)
H.failed_last_breath = TRUE
/obj/item/organ/internal/lungs/proc/handle_breath_temperature(datum/gas_mixture/breath, mob/living/carbon/human/H) // called by human/life, handles temperatures
@@ -332,6 +325,7 @@
safe_oxygen_max = 0.05 //This is toxic to us
safe_nitro_min = 16 //We breathe THIS!
oxy_damage_type = TOX //And it poisons us
oxy_breath_dam_multiplier = 0.16
/obj/item/organ/internal/lungs/drask
icon = 'icons/obj/species_organs/drask.dmi'
@@ -341,7 +335,7 @@
cold_level_1_damage = -COLD_GAS_DAMAGE_LEVEL_1 //They heal when the air is cold
cold_level_2_damage = -COLD_GAS_DAMAGE_LEVEL_2
cold_level_3_damage = -COLD_GAS_DAMAGE_LEVEL_3
cold_damage_types = list(BRUTE = 1, BURN = 0.5)
cold_damage_types = list(BRUTE = 0.5, BURN = 0.25)
/obj/item/organ/internal/lungs/cybernetic
name = "cybernetic lungs"