Edible component; be gone vile organ code (#48596)

* component

* progress

* stuff

* Makes minor progress on edible component

* Finishes component and applies it to organs

* newline

* forgot to send signal

* domob addition

* wave that organ flag

* return adde

* fixes some minor issues

* fixes

* done

* done

* done

* added last one

* done

* done

* fix
This commit is contained in:
Qustinnus
2020-02-04 01:05:55 -05:00
committed by GitHub
parent 72677dd024
commit 48de09b7a4
20 changed files with 395 additions and 197 deletions
+5 -6
View File
@@ -68,7 +68,7 @@
time = 64
name = "manipulate organs"
repeatable = 1
implements = list(/obj/item/organ = 100, /obj/item/reagent_containers/food/snacks/organ = 0, /obj/item/organ_storage = 100)
implements = list(/obj/item/organ = 100, /obj/item/organ_storage = 100)
var/implements_extract = list(TOOL_HEMOSTAT = 100, TOOL_CROWBAR = 55)
var/current_type
var/obj/item/organ/I = null
@@ -94,7 +94,10 @@
if(target_zone != I.zone || target.getorganslot(I.slot))
to_chat(user, "<span class='warning'>There is no room for [I] in [target]'s [parse_zone(target_zone)]!</span>")
return -1
var/obj/item/organ/meatslab = tool
if(!meatslab.useable)
to_chat(user, "<span class='warning'>[I] seems to have been chewed on, you can't use this!</span>")
return -1
display_results(user, target, "<span class='notice'>You begin to insert [tool] into [target]'s [parse_zone(target_zone)]...</span>",
"<span class='notice'>[user] begins to insert [tool] into [target]'s [parse_zone(target_zone)].</span>",
"<span class='notice'>[user] begins to insert something into [target]'s [parse_zone(target_zone)].</span>")
@@ -122,10 +125,6 @@
else
return -1
else if(istype(tool, /obj/item/reagent_containers/food/snacks/organ))
to_chat(user, "<span class='warning'>[tool] was bitten by someone! It's too damaged to use!</span>")
return -1
/datum/surgery_step/manipulate_organs/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery, default_display_results)
if(current_type == "insert")
if(istype(tool, /obj/item/organ_storage))
-6
View File
@@ -39,9 +39,3 @@
..()
if(inflamed)
M.ForceContractDisease(new /datum/disease/appendicitis(), FALSE, TRUE)
/obj/item/organ/appendix/prepare_eat()
var/obj/S = ..()
if(inflamed)
S.reagents.add_reagent(/datum/reagent/toxin/bad_food, 5)
return S
+4 -4
View File
@@ -54,10 +54,10 @@
update_icon()
return 1
/obj/item/organ/heart/prepare_eat()
var/obj/S = ..()
S.icon_state = "heart-off"
return S
/obj/item/organ/heart/OnEatFrom(eater, feeder)
. = ..()
beating = FALSE
update_icon()
/obj/item/organ/heart/on_life()
..()
+117 -120
View File
@@ -1,120 +1,117 @@
#define LIVER_DEFAULT_TOX_TOLERANCE 3 //amount of toxins the liver can filter out
#define LIVER_DEFAULT_TOX_LETHALITY 0.01 //lower values lower how harmful toxins are to the liver
/obj/item/organ/liver
name = "liver"
icon_state = "liver"
w_class = WEIGHT_CLASS_SMALL
zone = BODY_ZONE_CHEST
slot = ORGAN_SLOT_LIVER
desc = "Pairing suggestion: chianti and fava beans."
maxHealth = STANDARD_ORGAN_THRESHOLD
healing_factor = STANDARD_ORGAN_HEALING
decay_factor = STANDARD_ORGAN_DECAY
var/alcohol_tolerance = ALCOHOL_RATE //affects how much damage the liver takes from alcohol
var/toxTolerance = LIVER_DEFAULT_TOX_TOLERANCE //maximum amount of toxins the liver can just shrug off
var/toxLethality = LIVER_DEFAULT_TOX_LETHALITY //affects how much damage toxins do to the liver
var/filterToxins = TRUE //whether to filter toxins
#define HAS_SILENT_TOXIN 0 //don't provide a feedback message if this is the only toxin present
#define HAS_NO_TOXIN 1
#define HAS_PAINFUL_TOXIN 2
/obj/item/organ/liver/on_life()
var/mob/living/carbon/C = owner
..() //perform general on_life()
if(istype(C))
if(!(organ_flags & ORGAN_FAILING) && !HAS_TRAIT(C, TRAIT_NOMETABOLISM))//can't process reagents with a failing liver
var/provide_pain_message = HAS_NO_TOXIN
if(filterToxins && !HAS_TRAIT(owner, TRAIT_TOXINLOVER))
//handle liver toxin filtration
for(var/datum/reagent/toxin/T in C.reagents.reagent_list)
var/thisamount = C.reagents.get_reagent_amount(T.type)
if (thisamount && thisamount <= toxTolerance)
C.reagents.remove_reagent(T.type, 1)
else
damage += (thisamount*toxLethality)
if(provide_pain_message != HAS_PAINFUL_TOXIN)
provide_pain_message = T.silent_toxin ? HAS_SILENT_TOXIN : HAS_PAINFUL_TOXIN
//metabolize reagents
C.reagents.metabolize(C, can_overdose=TRUE)
if(provide_pain_message && damage > 10 && prob(damage/3))//the higher the damage the higher the probability
to_chat(C, "<span class='warning'>You feel a dull pain in your abdomen.</span>")
else //for when our liver's failing
C.liver_failure()
if(damage > maxHealth)//cap liver damage
damage = maxHealth
#undef HAS_SILENT_TOXIN
#undef HAS_NO_TOXIN
#undef HAS_PAINFUL_TOXIN
/obj/item/organ/liver/prepare_eat()
var/obj/S = ..()
S.reagents.add_reagent(/datum/reagent/iron, 5)
return S
/obj/item/organ/liver/fly
name = "insectoid liver"
icon_state = "liver-x" //xenomorph liver? It's just a black liver so it fits.
desc = "A mutant liver designed to handle the unique diet of a flyperson."
alcohol_tolerance = 0.007 //flies eat vomit, so a lower alcohol tolerance is perfect!
/obj/item/organ/liver/plasmaman
name = "reagent processing crystal"
icon_state = "liver-p"
desc = "A large crystal that is somehow capable of metabolizing chemicals, these are found in plasmamen."
/obj/item/organ/liver/alien
name = "alien liver" // doesnt matter for actual aliens because they dont take toxin damage
icon_state = "liver-x" // Same sprite as fly-person liver.
desc = "A liver that used to belong to a killer alien, who knows what it used to eat."
toxLethality = LIVER_DEFAULT_TOX_LETHALITY * 2.5 // rejects its owner early after too much punishment
toxTolerance = 15 // complete toxin immunity like xenos have would be too powerful
/obj/item/organ/liver/cybernetic
name = "basic cybernetic liver"
icon_state = "liver-c"
desc = "A very basic device designed to mimic the functions of a human liver. Handles toxins slightly worse than an organic liver."
organ_flags = ORGAN_SYNTHETIC
toxTolerance = 2
toxLethality = 0.011
maxHealth = STANDARD_ORGAN_THRESHOLD*0.5
var/emp_vulnerability = 80 //Chance of permanent effects if emp-ed.
/obj/item/organ/liver/cybernetic/tier2
name = "cybernetic liver"
icon_state = "liver-c-u"
desc = "An electronic device designed to mimic the functions of a human liver. Handles toxins slightly better than an organic liver."
maxHealth = 1.5 * STANDARD_ORGAN_THRESHOLD
toxTolerance = 5 //can shrug off up to 5u of toxins
toxLethality = 0.008 //20% less damage than a normal liver
emp_vulnerability = 40
/obj/item/organ/liver/cybernetic/tier3
name = "upgraded cybernetic liver"
icon_state = "liver-c-u2"
desc = "An upgraded version of the cybernetic liver, designed to improve further upon organic livers. It is resistant to alcohol poisoning and is very robust at filtering toxins."
alcohol_tolerance = 0.001
maxHealth = 2 * STANDARD_ORGAN_THRESHOLD
toxTolerance = 10 //can shrug off up to 10u of toxins
toxLethality = 0.008 //20% less damage than a normal liver
emp_vulnerability = 20
/obj/item/organ/liver/cybernetic/emp_act(severity)
. = ..()
if(. & EMP_PROTECT_SELF)
return
if(world.time > severe_cooldown) //So we cant just spam emp to kill people.
owner.adjustToxLoss(10)
severe_cooldown = world.time + 10 SECONDS
if(prob(emp_vulnerability/severity)) //Chance of permanent effects
organ_flags = ORGAN_SYNTHETIC_EMP //Starts organ faliure - gonna need replacing soon.
#define LIVER_DEFAULT_TOX_TOLERANCE 3 //amount of toxins the liver can filter out
#define LIVER_DEFAULT_TOX_LETHALITY 0.01 //lower values lower how harmful toxins are to the liver
/obj/item/organ/liver
name = "liver"
icon_state = "liver"
w_class = WEIGHT_CLASS_SMALL
zone = BODY_ZONE_CHEST
slot = ORGAN_SLOT_LIVER
desc = "Pairing suggestion: chianti and fava beans."
maxHealth = STANDARD_ORGAN_THRESHOLD
healing_factor = STANDARD_ORGAN_HEALING
decay_factor = STANDARD_ORGAN_DECAY
food_reagents = list(/datum/reagent/consumable/nutriment = 5, /datum/reagent/iron = 5)
var/alcohol_tolerance = ALCOHOL_RATE//affects how much damage the liver takes from alcohol
var/toxTolerance = LIVER_DEFAULT_TOX_TOLERANCE//maximum amount of toxins the liver can just shrug off
var/toxLethality = LIVER_DEFAULT_TOX_LETHALITY//affects how much damage toxins do to the liver
var/filterToxins = TRUE //whether to filter toxins
#define HAS_SILENT_TOXIN 0 //don't provide a feedback message if this is the only toxin present
#define HAS_NO_TOXIN 1
#define HAS_PAINFUL_TOXIN 2
/obj/item/organ/liver/on_life()
var/mob/living/carbon/C = owner
..() //perform general on_life()
if(istype(C))
if(!(organ_flags & ORGAN_FAILING) && !HAS_TRAIT(C, TRAIT_NOMETABOLISM))//can't process reagents with a failing liver
var/provide_pain_message = HAS_NO_TOXIN
if(filterToxins && !HAS_TRAIT(owner, TRAIT_TOXINLOVER))
//handle liver toxin filtration
for(var/datum/reagent/toxin/T in C.reagents.reagent_list)
var/thisamount = C.reagents.get_reagent_amount(T.type)
if (thisamount && thisamount <= toxTolerance)
C.reagents.remove_reagent(T.type, 1)
else
damage += (thisamount*toxLethality)
if(provide_pain_message != HAS_PAINFUL_TOXIN)
provide_pain_message = T.silent_toxin ? HAS_SILENT_TOXIN : HAS_PAINFUL_TOXIN
//metabolize reagents
C.reagents.metabolize(C, can_overdose=TRUE)
if(provide_pain_message && damage > 10 && prob(damage/3))//the higher the damage the higher the probability
to_chat(C, "<span class='warning'>You feel a dull pain in your abdomen.</span>")
else //for when our liver's failing
C.liver_failure()
if(damage > maxHealth)//cap liver damage
damage = maxHealth
#undef HAS_SILENT_TOXIN
#undef HAS_NO_TOXIN
#undef HAS_PAINFUL_TOXIN
/obj/item/organ/liver/fly
name = "insectoid liver"
icon_state = "liver-x" //xenomorph liver? It's just a black liver so it fits.
desc = "A mutant liver designed to handle the unique diet of a flyperson."
alcohol_tolerance = 0.007 //flies eat vomit, so a lower alcohol tolerance is perfect!
/obj/item/organ/liver/plasmaman
name = "reagent processing crystal"
icon_state = "liver-p"
desc = "A large crystal that is somehow capable of metabolizing chemicals, these are found in plasmamen."
/obj/item/organ/liver/alien
name = "alien liver" // doesnt matter for actual aliens because they dont take toxin damage
icon_state = "liver-x" // Same sprite as fly-person liver.
desc = "A liver that used to belong to a killer alien, who knows what it used to eat."
toxLethality = LIVER_DEFAULT_TOX_LETHALITY * 2.5 // rejects its owner early after too much punishment
toxTolerance = 15 // complete toxin immunity like xenos have would be too powerful
/obj/item/organ/liver/cybernetic
name = "basic cybernetic liver"
icon_state = "liver-c"
desc = "A very basic device designed to mimic the functions of a human liver. Handles toxins slightly worse than an organic liver."
organ_flags = ORGAN_SYNTHETIC
toxTolerance = 2
toxLethality = 0.011
maxHealth = STANDARD_ORGAN_THRESHOLD*0.5
var/emp_vulnerability = 80 //Chance of permanent effects if emp-ed.
/obj/item/organ/liver/cybernetic/tier2
name = "cybernetic liver"
icon_state = "liver-c-u"
desc = "An electronic device designed to mimic the functions of a human liver. Handles toxins slightly better than an organic liver."
maxHealth = 1.5 * STANDARD_ORGAN_THRESHOLD
toxTolerance = 5 //can shrug off up to 5u of toxins
toxLethality = 0.008 //20% less damage than a normal liver
emp_vulnerability = 40
/obj/item/organ/liver/cybernetic/tier3
name = "upgraded cybernetic liver"
icon_state = "liver-c-u2"
desc = "An upgraded version of the cybernetic liver, designed to improve further upon organic livers. It is resistant to alcohol poisoning and is very robust at filtering toxins."
alcohol_tolerance = 0.001
maxHealth = 2 * STANDARD_ORGAN_THRESHOLD
toxTolerance = 10 //can shrug off up to 10u of toxins
toxLethality = 0.008 //20% less damage than a normal liver
emp_vulnerability = 20
/obj/item/organ/liver/cybernetic/emp_act(severity)
. = ..()
if(. & EMP_PROTECT_SELF)
return
if(world.time > severe_cooldown) //So we cant just spam emp to kill people.
owner.adjustToxLoss(10)
severe_cooldown = world.time + 10 SECONDS
if(prob(emp_vulnerability/severity)) //Chance of permanent effects
organ_flags = ORGAN_SYNTHETIC_EMP //Starts organ faliure - gonna need replacing soon.
+3 -4
View File
@@ -15,6 +15,9 @@
now_fixed = "<span class='warning'>Your lungs seem to once again be able to hold air.</span>"
high_threshold_cleared = "<span class='info'>The constriction around your chest loosens as your breathing calms down.</span>"
food_reagents = list(/datum/reagent/consumable/nutriment = 5, /datum/reagent/medicine/salbutamol = 5)
//Breath damage
var/safe_oxygen_min = 16 // Minimum safe partial pressure of O2, in kPa
@@ -402,10 +405,6 @@
failed = FALSE
return
/obj/item/organ/lungs/prepare_eat()
var/obj/S = ..()
S.reagents.add_reagent(/datum/reagent/medicine/salbutamol, 5)
return S
/obj/item/organ/lungs/plasmaman
name = "plasma filter"
+12 -30
View File
@@ -8,7 +8,7 @@
var/zone = BODY_ZONE_CHEST
var/slot
// DO NOT add slots with matching names to different zones - it will break internal_organs_slot list!
var/organ_flags = 0
var/organ_flags = ORGAN_EDIBLE
var/maxHealth = STANDARD_ORGAN_THRESHOLD
var/damage = 0 //total damage this organ has sustained
///Healing factor and decay factor function on % of maxhealth, and do not work by applying a static number per tick
@@ -26,6 +26,15 @@
var/high_threshold_cleared
var/low_threshold_cleared
///When you take a bite you cant jam it in for surgery anymore.
var/useable = TRUE
var/list/food_reagents = list(/datum/reagent/consumable/nutriment = 5)
/obj/item/organ/Initialize()
. = ..()
if(organ_flags & ORGAN_EDIBLE)
AddComponent(/datum/component/edible, food_reagents, null, RAW | MEAT | GROSS, null, 10, null, null, null, CALLBACK(src, .proc/OnEatFrom))
/obj/item/organ/proc/Insert(mob/living/carbon/M, special = 0, drop_if_replaced = TRUE)
if(!iscarbon(M) || owner == M)
return
@@ -101,24 +110,6 @@
if(damage > high_threshold)
. += "<span class='warning'>[src] is starting to look discolored.</span>"
/obj/item/organ/proc/prepare_eat()
var/obj/item/reagent_containers/food/snacks/organ/S = new
S.name = name
S.desc = desc
S.icon = icon
S.icon_state = icon_state
S.w_class = w_class
return S
/obj/item/reagent_containers/food/snacks/organ
name = "appendix"
icon_state = "appendix"
icon = 'icons/obj/surgery.dmi'
list_reagents = list(/datum/reagent/consumable/nutriment = 5)
foodtype = RAW | MEAT | GROSS
/obj/item/organ/Initialize()
. = ..()
START_PROCESSING(SSobj, src)
@@ -132,17 +123,8 @@
STOP_PROCESSING(SSobj, src)
return ..()
/obj/item/organ/attack(mob/living/carbon/M, mob/user)
if(M == user && ishuman(user))
var/mob/living/carbon/human/H = user
if(status == ORGAN_ORGANIC)
var/obj/item/reagent_containers/food/snacks/S = prepare_eat(H)
if(S)
qdel(src)
if(H.put_in_active_hand(S))
S.attack(H, H)
else
..()
/obj/item/organ/proc/OnEatFrom(eater, feeder)
useable = FALSE //You can't use it anymore after eating it you spaztic
/obj/item/organ/item_action_slot_check(slot,mob/user)
return //so we don't grant the organ's action to mobs who pick up the organ.
+1
View File
@@ -248,6 +248,7 @@
name = "robotic voicebox"
desc = "A voice synthesizer that can interface with organic lifeforms."
status = ORGAN_ROBOTIC
organ_flags = NONE
icon_state = "tonguerobot"
say_mod = "states"
attack_verb = list("beeped", "booped")