Ports reagents id removal and typepath usage.

This commit is contained in:
Lin
2020-01-10 01:34:39 +00:00
committed by Archie
parent 228192fd62
commit a7c539ac32
323 changed files with 31959 additions and 32469 deletions
@@ -19,7 +19,7 @@
implements = list(/obj/item/hemostat = 100, TOOL_SCREWDRIVER = 35, /obj/item/pen = 15)
implements = list(/obj/item/reagent_containers/syringe = 100, /obj/item/pen = 30)
time = 50
chems_needed = list("zombiepowder", "rezadone")
chems_needed = list(/datum/reagent/toxin/zombiepowder, /datum/reagent/medicine/rezadone)
require_all_chems = FALSE
/datum/surgery_step/bionecrosis/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
@@ -19,7 +19,7 @@
name = "viral bond"
implements = list(/obj/item/cautery = 100, TOOL_WELDER = 50, /obj/item = 30) // 30% success with any hot item.
time = 100
chems_needed = list("spaceacillin","virusfood","formaldehyde")
chems_needed = list(/datum/reagent/medicine/spaceacillin, /datum/reagent/consumable/virus_food,/datum/reagent/toxin/formaldehyde)
/datum/surgery_step/viral_bond/tool_check(mob/user, obj/item/tool)
if(implement_type == TOOL_WELDER || implement_type == /obj/item)
+1 -1
View File
@@ -13,7 +13,7 @@
name = "embalming body"
implements = list(/obj/item/hemostat = 100)
time = 10
chems_needed = list("drying_agent","formaldehyde")
chems_needed = list(/datum/reagent/drying_agent, /datum/reagent/space_cleaner/sterilizine)
require_all_chems = FALSE
/datum/surgery_step/embalming/preop(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
+3 -3
View File
@@ -22,7 +22,7 @@
implements = list(/obj/item/hemostat = 100, TOOL_SCREWDRIVER = 35, /obj/item/pen = 15)
repeatable = TRUE
time = 75
chems_needed = list("synthtissue")
chems_needed = list(/datum/reagent/synthtissue)
var/obj/item/organ/chosen_organ
var/health_restored = 10
@@ -41,7 +41,7 @@
chosen_organ = organs[chosen_organ]
if(!chosen_organ)
return -1
if(!target.reagents.has_reagent("synthtissue"))
if(!target.reagents.has_reagent(/datum/reagent/synthtissue))
to_chat(user, "<span class='notice'>There's no synthtissue available for use on [chosen_organ]</span>")
return -1
var/datum/reagent/synthtissue/Sf = locate(/datum/reagent/synthtissue) in target.reagents.reagent_list
@@ -58,7 +58,7 @@
health_restored += (Sf.data["grown_volume"]/10)
user.visible_message("[user] begins to graft synthtissue onto [chosen_organ].</span>")
target.reagents.remove_reagent("synthtissue", 10)
target.reagents.remove_reagent(/datum/reagent/synthtissue, 10)
/datum/surgery_step/graft_synthtissue/success(mob/user, mob/living/carbon/target, target_zone, obj/item/tool, datum/surgery/surgery)
user.visible_message("[user] successfully repairs part of [chosen_organ].", "<span class='notice'>You succeed in repairing parts of [chosen_organ].</span>")
+1 -1
View File
@@ -44,5 +44,5 @@
/obj/item/organ/appendix/prepare_eat()
var/obj/S = ..()
if(inflamed)
S.reagents.add_reagent("bad_food", 5)
S.reagents.add_reagent(/datum/reagent/toxin/bad_food, 5)
return S
@@ -32,7 +32,7 @@
. = ..()
if(!owner || . & EMP_PROTECT_SELF)
return
owner.reagents.add_reagent("bad_food", poison_amount / severity)
owner.reagents.add_reagent(/datum/reagent/toxin/bad_food, poison_amount / severity)
to_chat(owner, "<span class='warning'>You feel like your insides are burning.</span>")
+2 -2
View File
@@ -244,5 +244,5 @@ obj/item/organ/heart/cybernetic/upgraded/on_life()
min_next_adrenaline = world.time + rand(250, 600) //anywhere from 4.5 to 10 minutes
to_chat(owner, "<span class='userdanger'>You feel yourself dying, but you refuse to give up!</span>")
owner.heal_overall_damage(15, 15)
if(owner.reagents.get_reagent_amount("ephedrine") < 20)
owner.reagents.add_reagent("ephedrine", 10)
if(owner.reagents.get_reagent_amount(/datum/reagent/medicine/ephedrine) < 20)
owner.reagents.add_reagent(/datum/reagent/medicine/ephedrine, 10)
+126 -128
View File
@@ -1,128 +1,126 @@
#define LIVER_DEFAULT_HEALTH 100 //amount of damage required for liver failure
#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
#define LIVER_SWELLING_MOVE_MODIFY "pharma"
/obj/item/organ/liver
name = "liver"
icon_state = "liver"
w_class = WEIGHT_CLASS_NORMAL
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/failing //is this liver failing?
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
var/swelling = 0
var/cachedmoveCalc = 1
/obj/item/organ/liver/on_life()
var/mob/living/carbon/C = owner
if(istype(C))
if(!(organ_flags & ORGAN_FAILING))//can't process reagents with a failing liver
//slowly heal liver damage
damage = max(0, damage - 0.1)
if(filterToxins && !HAS_TRAIT(owner, TRAIT_TOXINLOVER))
//handle liver toxin filtration
for(var/I in C.reagents.reagent_list)
var/datum/reagent/pickedreagent = I
if(istype(pickedreagent, /datum/reagent/toxin))
var/thisamount = C.reagents.get_reagent_amount(initial(pickedreagent.id))
if (thisamount <= toxTolerance && thisamount)
C.reagents.remove_reagent(initial(pickedreagent.id), 1)
else
damage += (thisamount*toxLethality)
//metabolize reagents
C.reagents.metabolize(C, can_overdose=TRUE)
if(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>")
if(damage > maxHealth)//cap liver damage
damage = maxHealth
if(swelling >= 10)
pharmacokinesis()
/obj/item/organ/liver/prepare_eat()
var/obj/S = ..()
S.reagents.add_reagent("iron", 5)
return S
//Just in case
/obj/item/organ/liver/Remove(mob/living/carbon/M, special = 0)
..()
if(!QDELETED(M))
M.remove_movespeed_modifier(LIVER_SWELLING_MOVE_MODIFY)
M.ResetBloodVol() //At the moment, this shouldn't allow application twice. You either have this OR a thirsty ferret.
sizeMoveMod(1, M)
//Applies some of the effects to the patient.
/obj/item/organ/liver/proc/pharmacokinesis()
var/moveCalc = 1+((round(swelling) - 9)/3)
if(moveCalc == cachedmoveCalc)//reduce calculations
return
if(prob(5))
to_chat(owner, "<span class='notice'>You feel a stange ache in your side, almost like a stitch. This pain is affecting your movements and making you feel lightheaded.</span>")
var/mob/living/carbon/human/H = owner
H.add_movespeed_modifier(LIVER_SWELLING_MOVE_MODIFY, TRUE, 100, NONE, override = TRUE, multiplicative_slowdown = moveCalc)
H.AdjustBloodVol(moveCalc/3)
sizeMoveMod(moveCalc, H)
/obj/item/organ/liver/proc/sizeMoveMod(var/value, mob/living/carbon/human/H)
if(cachedmoveCalc == value)
return
H.next_move_modifier /= cachedmoveCalc
H.next_move_modifier *= value
cachedmoveCalc = value
/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/ipc
name = "reagent processing liver"
icon_state = "liver-c"
/obj/item/organ/liver/cybernetic
name = "cybernetic liver"
icon_state = "liver-c"
desc = "An electronic device designed to mimic the functions of a human liver. It has no benefits over an organic liver, but is easy to produce."
organ_flags = ORGAN_SYNTHETIC
maxHealth = 1.1 * STANDARD_ORGAN_THRESHOLD
/obj/item/organ/liver/cybernetic/upgraded
name = "upgraded cybernetic liver"
icon_state = "liver-c-u"
desc = "An upgraded version of the cybernetic liver, designed to improve 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 = 15 //can shrug off up to 15u of toxins
toxLethality = 0.008 //20% less damage than a normal liver
/obj/item/organ/liver/cybernetic/emp_act(severity)
. = ..()
if(. & EMP_PROTECT_SELF)
return
switch(severity)
if(1)
damage+=100
if(2)
damage+=50
#define LIVER_DEFAULT_HEALTH 100 //amount of damage required for liver failure
#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
#define LIVER_SWELLING_MOVE_MODIFY "pharma"
/obj/item/organ/liver
name = "liver"
icon_state = "liver"
w_class = WEIGHT_CLASS_NORMAL
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/failing //is this liver failing?
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
var/swelling = 0
var/cachedmoveCalc = 1
/obj/item/organ/liver/on_life()
var/mob/living/carbon/C = owner
if(istype(C))
if(!(organ_flags & ORGAN_FAILING))//can't process reagents with a failing liver
//slowly heal liver damage
damage = max(0, damage - 0.1)
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)
//metabolize reagents
C.reagents.metabolize(C, can_overdose=TRUE)
if(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>")
if(damage > maxHealth)//cap liver damage
damage = maxHealth
if(swelling >= 10)
pharmacokinesis()
/obj/item/organ/liver/prepare_eat()
var/obj/S = ..()
S.reagents.add_reagent(/datum/reagent/iron, 5)
return S
//Just in case
/obj/item/organ/liver/Remove(mob/living/carbon/M, special = 0)
..()
if(!QDELETED(M))
M.remove_movespeed_modifier(LIVER_SWELLING_MOVE_MODIFY)
M.ResetBloodVol() //At the moment, this shouldn't allow application twice. You either have this OR a thirsty ferret.
sizeMoveMod(1, M)
//Applies some of the effects to the patient.
/obj/item/organ/liver/proc/pharmacokinesis()
var/moveCalc = 1+((round(swelling) - 9)/3)
if(moveCalc == cachedmoveCalc)//reduce calculations
return
if(prob(5))
to_chat(owner, "<span class='notice'>You feel a stange ache in your side, almost like a stitch. This pain is affecting your movements and making you feel lightheaded.</span>")
var/mob/living/carbon/human/H = owner
H.add_movespeed_modifier(LIVER_SWELLING_MOVE_MODIFY, TRUE, 100, NONE, override = TRUE, multiplicative_slowdown = moveCalc)
H.AdjustBloodVol(moveCalc/3)
sizeMoveMod(moveCalc, H)
/obj/item/organ/liver/proc/sizeMoveMod(var/value, mob/living/carbon/human/H)
if(cachedmoveCalc == value)
return
H.next_move_modifier /= cachedmoveCalc
H.next_move_modifier *= value
cachedmoveCalc = value
/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/ipc
name = "reagent processing liver"
icon_state = "liver-c"
/obj/item/organ/liver/cybernetic
name = "cybernetic liver"
icon_state = "liver-c"
desc = "An electronic device designed to mimic the functions of a human liver. It has no benefits over an organic liver, but is easy to produce."
organ_flags = ORGAN_SYNTHETIC
maxHealth = 1.1 * STANDARD_ORGAN_THRESHOLD
/obj/item/organ/liver/cybernetic/upgraded
name = "upgraded cybernetic liver"
icon_state = "liver-c-u"
desc = "An upgraded version of the cybernetic liver, designed to improve 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 = 15 //can shrug off up to 15u of toxins
toxLethality = 0.008 //20% less damage than a normal liver
/obj/item/organ/liver/cybernetic/emp_act(severity)
. = ..()
if(. & EMP_PROTECT_SELF)
return
switch(severity)
if(1)
damage+=100
if(2)
damage+=50
+7 -8
View File
@@ -68,7 +68,7 @@
var/heat_level_3_damage = HEAT_GAS_DAMAGE_LEVEL_3
var/heat_damage_type = BURN
var/crit_stabilizing_reagent = "epinephrine"
var/crit_stabilizing_reagent = /datum/reagent/medicine/epinephrine
@@ -300,13 +300,13 @@
var/bz_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/bz])
if(bz_pp > BZ_trip_balls_min)
H.hallucination += 10
H.reagents.add_reagent("bz_metabolites",5)
H.reagents.add_reagent(/datum/reagent/bz_metabolites,5)
if(prob(33))
H.adjustOrganLoss(ORGAN_SLOT_BRAIN, 3, 150)
else if(bz_pp > 0.01)
H.hallucination += 5
H.reagents.add_reagent("bz_metabolites",1)
H.reagents.add_reagent(/datum/reagent/bz_metabolites,1)
// Tritium
@@ -330,16 +330,15 @@
H.adjustFireLoss(nitryl_pp/4)
gas_breathed = breath_gases[/datum/gas/nitryl]
if (gas_breathed > gas_stimulation_min)
var/existing = H.reagents.get_reagent_amount("no2")
H.reagents.add_reagent("no2", max(0, 5 - existing))
H.reagents.add_reagent(/datum/reagent/nitryl,1)
breath_gases[/datum/gas/nitryl]-=gas_breathed
// Stimulum
gas_breathed = breath_gases[/datum/gas/stimulum]
if (gas_breathed > gas_stimulation_min)
var/existing = H.reagents.get_reagent_amount("stimulum")
H.reagents.add_reagent("stimulum", max(0, 5 - existing))
var/existing = H.reagents.get_reagent_amount(/datum/reagent/stimulum)
H.reagents.add_reagent(/datum/reagent/stimulum, max(0, 5 - existing))
breath_gases[/datum/gas/stimulum]-=gas_breathed
// Miasma
@@ -459,7 +458,7 @@
/obj/item/organ/lungs/prepare_eat()
var/obj/S = ..()
S.reagents.add_reagent("salbutamol", 5)
S.reagents.add_reagent(/datum/reagent/medicine/salbutamol, 5)
return S
/obj/item/organ/lungs/ipc
@@ -164,7 +164,7 @@
name = "appendix"
icon_state = "appendix"
icon = 'icons/obj/surgery.dmi'
list_reagents = list("nutriment" = 5)
list_reagents = list(/datum/reagent/consumable/nutriment = 5)
foodtype = RAW | MEAT | GROSS