mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 07:08:00 +01:00
Rework appendicitis: not event-based, not a disease (#60331)
Adds a new trait that "simulates" a medium-like disease according to health HUDs. Organs now control their own "status text" for health scanners, for all except the appendix, this is the same as before. Appendicitis has a low chance of occuring on each life tick of an appendix, it is no longer a disease.
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
// A 10% chance that out of a group of 25 people, one person will get appendicitis in 1 hour.
|
||||
#define APPENDICITIS_PROB 100 * (0.1 * (1 / 25) / 3600)
|
||||
#define INFLAMATION_ADVANCEMENT_PROB 2
|
||||
|
||||
/obj/item/organ/appendix
|
||||
name = "appendix"
|
||||
icon_state = "appendix"
|
||||
@@ -12,35 +16,77 @@
|
||||
now_failing = "<span class='warning'>An explosion of pain erupts in your lower right abdomen!</span>"
|
||||
now_fixed = "<span class='info'>The pain in your abdomen has subsided.</span>"
|
||||
|
||||
var/inflamed
|
||||
var/inflamation_stage = 0
|
||||
|
||||
/obj/item/organ/appendix/update_name()
|
||||
. = ..()
|
||||
name = "[inflamed ? "inflamed " : null][initial(name)]"
|
||||
name = "[inflamation_stage ? "inflamed " : null][initial(name)]"
|
||||
|
||||
/obj/item/organ/appendix/update_icon_state()
|
||||
icon_state = "[base_icon_state][inflamed ? "inflamed" : ""]"
|
||||
icon_state = "[base_icon_state][inflamation_stage ? "inflamed" : ""]"
|
||||
return ..()
|
||||
|
||||
/obj/item/organ/appendix/on_life(delta_time, times_fired)
|
||||
..()
|
||||
if(!(organ_flags & ORGAN_FAILING))
|
||||
return
|
||||
var/mob/living/carbon/organ_owner = owner
|
||||
if(organ_owner)
|
||||
organ_owner.adjustToxLoss(2 * delta_time, TRUE, TRUE) //forced to ensure people don't use it to gain tox as slime person
|
||||
if(!organ_owner)
|
||||
return
|
||||
|
||||
if(organ_flags & ORGAN_FAILING)
|
||||
// forced to ensure people don't use it to gain tox as slime person
|
||||
organ_owner.adjustToxLoss(2 * delta_time, updating_health = TRUE, forced = TRUE)
|
||||
else if(inflamation_stage)
|
||||
inflamation(delta_time)
|
||||
else if(DT_PROB(APPENDICITIS_PROB, delta_time))
|
||||
become_inflamed()
|
||||
|
||||
/obj/item/organ/appendix/proc/become_inflamed()
|
||||
inflamation_stage = 1
|
||||
update_appearance()
|
||||
if(owner)
|
||||
ADD_TRAIT(owner, TRAIT_DISEASELIKE_SEVERITY_MEDIUM, type)
|
||||
owner.med_hud_set_status()
|
||||
|
||||
/obj/item/organ/appendix/proc/inflamation(delta_time)
|
||||
var/mob/living/carbon/organ_owner = owner
|
||||
if(inflamation_stage < 3 && DT_PROB(INFLAMATION_ADVANCEMENT_PROB, delta_time))
|
||||
inflamation_stage += 1
|
||||
|
||||
switch(inflamation_stage)
|
||||
if(1)
|
||||
if(DT_PROB(2.5, delta_time))
|
||||
organ_owner.emote("cough")
|
||||
if(2)
|
||||
if(DT_PROB(1.5, delta_time))
|
||||
to_chat(organ_owner, span_warning("You feel a stabbing pain in your abdomen!"))
|
||||
organ_owner.adjustOrganLoss(ORGAN_SLOT_APPENDIX, 5)
|
||||
organ_owner.Stun(rand(40, 60))
|
||||
organ_owner.adjustToxLoss(1, updating_health = TRUE, forced = TRUE)
|
||||
if(3)
|
||||
if(DT_PROB(0.5, delta_time))
|
||||
organ_owner.vomit(95)
|
||||
organ_owner.adjustOrganLoss(ORGAN_SLOT_APPENDIX, 15)
|
||||
|
||||
|
||||
/obj/item/organ/appendix/get_availability(datum/species/owner_species)
|
||||
return !(TRAIT_NOHUNGER in owner_species.inherent_traits)
|
||||
|
||||
/obj/item/organ/appendix/Remove(mob/living/carbon/organ_owner, special = 0)
|
||||
for(var/datum/disease/appendicitis/appendicitis in organ_owner.diseases)
|
||||
appendicitis.cure()
|
||||
inflamed = TRUE
|
||||
update_appearance()
|
||||
/obj/item/organ/appendix/Remove(mob/living/carbon/organ_owner, special = FALSE)
|
||||
REMOVE_TRAIT(organ_owner, TRAIT_DISEASELIKE_SEVERITY_MEDIUM, type)
|
||||
organ_owner.med_hud_set_status()
|
||||
..()
|
||||
|
||||
/obj/item/organ/appendix/Insert(mob/living/carbon/organ_owner, special = 0)
|
||||
/obj/item/organ/appendix/Insert(mob/living/carbon/organ_owner, special = FALSE)
|
||||
..()
|
||||
if(inflamed)
|
||||
organ_owner.ForceContractDisease(new /datum/disease/appendicitis(), FALSE, TRUE)
|
||||
if(inflamation_stage)
|
||||
ADD_TRAIT(organ_owner, TRAIT_DISEASELIKE_SEVERITY_MEDIUM, type)
|
||||
organ_owner.med_hud_set_status()
|
||||
|
||||
/obj/item/organ/appendix/get_status_text()
|
||||
if((!(organ_flags & ORGAN_FAILING)) && inflamation_stage)
|
||||
return "<font color='#ff9933'>Inflamed</font>"
|
||||
else
|
||||
return ..()
|
||||
|
||||
#undef APPENDICITIS_PROB
|
||||
#undef INFLAMATION_ADVANCEMENT_PROB
|
||||
|
||||
@@ -279,3 +279,17 @@
|
||||
/// Called before organs are replaced in regenerate_organs with new ones
|
||||
/obj/item/organ/proc/before_organ_replacement(obj/item/organ/replacement)
|
||||
return
|
||||
|
||||
/// Called by medical scanners to get a simple summary of how healthy the organ is. Returns an empty string if things are fine.
|
||||
/obj/item/organ/proc/get_status_text()
|
||||
var/status = ""
|
||||
if(owner.has_reagent(/datum/reagent/inverse/technetium))
|
||||
status = "<font color='#E42426'> organ is [round((damage/maxHealth)*100, 1)]% damaged.</font>"
|
||||
else if(organ_flags & ORGAN_FAILING)
|
||||
status = "<font color='#cc3333'>Non-Functional</font>"
|
||||
else if(damage > high_threshold)
|
||||
status = "<font color='#ff9933'>Severely Damaged</font>"
|
||||
else if (damage > low_threshold)
|
||||
status = "<font color='#ffcc33'>Mildly Damaged</font>"
|
||||
|
||||
return status
|
||||
|
||||
Reference in New Issue
Block a user