Refactors DNA Mutations; Refactors Mutations to use Traits (#15483)

* Refactors Mutations

* traits

* more work

* styling fix

* yet even more work

* oh hush

* almost there

* it continues yet further

* and that's genetics done

* and that's it folks

* last bit and golem fixup

* oof

* oops

* tweaks and fixes

* styling
This commit is contained in:
Fox McCloud
2021-02-21 21:25:19 +00:00
committed by GitHub
parent 324af7454c
commit 02b9445b9b
223 changed files with 2908 additions and 3049 deletions
@@ -215,6 +215,14 @@
slot = "brain_clownvoice"
origin_tech = "materials=2;biotech=2"
/obj/item/organ/internal/cyberimp/brain/clown_voice/insert(mob/living/carbon/M, special = FALSE)
..()
ADD_TRAIT(M, TRAIT_COMIC_SANS, "augment")
/obj/item/organ/internal/cyberimp/brain/clown_voice/remove(mob/living/carbon/M, special = FALSE)
REMOVE_TRAIT(M, TRAIT_COMIC_SANS, "augment")
return ..()
/obj/item/organ/internal/cyberimp/brain/speech_translator //actual translating done in human/handle_speech_problems
name = "Speech translator implant"
desc = "While known as a translator, this implant actually generates speech based on the user's thoughts when activated, completely bypassing the need to speak."
+4 -4
View File
@@ -22,7 +22,7 @@
bleed_rate = 0
return
if(bodytemperature >= TCRYO && !(NOCLONE in mutations)) //cryosleep or husked people do not pump the blood.
if(bodytemperature >= TCRYO && !HAS_TRAIT(src, TRAIT_BADDNA)) //cryosleep or husked people do not pump the blood.
if(blood_volume < BLOOD_VOLUME_NORMAL)
blood_volume += 0.1 // regenerate blood VERY slowly
@@ -74,10 +74,10 @@
var/additional_bleed = round(clamp((reagents.get_reagent_amount("heparin") / 10), 0, 2), 1) //Heparin worsens existing bleeding
if(internal_bleeding_rate && !(status_flags & FAKEDEATH))
if(internal_bleeding_rate && !HAS_TRAIT(src, TRAIT_FAKEDEATH))
bleed_internal(internal_bleeding_rate + additional_bleed)
if(bleed_rate && !bleedsuppress && !(status_flags & FAKEDEATH))
if(bleed_rate && !bleedsuppress && !HAS_TRAIT(src, TRAIT_FAKEDEATH))
bleed(bleed_rate + additional_bleed)
//Makes a blood drop, leaking amt units of blood from the mob
@@ -224,7 +224,7 @@
/mob/living/carbon/human/get_blood_id()
if(dna.species.exotic_blood)//some races may bleed water..or kethcup..
return dna.species.exotic_blood
else if((NO_BLOOD in dna.species.species_traits) || (NOCLONE in mutations))
else if((NO_BLOOD in dna.species.species_traits) || HAS_TRAIT(src, TRAIT_HUSK))
return
return "blood"
+6 -6
View File
@@ -12,19 +12,19 @@
/obj/item/organ/internal/body_egg/insert(var/mob/living/carbon/M, special = 0)
..()
owner.status_flags |= XENO_HOST
ADD_TRAIT(owner, TRAIT_XENO_HOST, TRAIT_GENERIC)
ADD_TRAIT(owner, TRAIT_XENO_IMMUNE, "xeno immune")
START_PROCESSING(SSobj, src)
owner.med_hud_set_status()
spawn(0)
AddInfectionImages(owner)
INVOKE_ASYNC(src, .proc/AddInfectionImages, owner)
/obj/item/organ/internal/body_egg/remove(var/mob/living/carbon/M, special = 0)
STOP_PROCESSING(SSobj, src)
if(owner)
owner.status_flags &= ~(XENO_HOST)
REMOVE_TRAIT(owner, TRAIT_XENO_HOST, TRAIT_GENERIC)
REMOVE_TRAIT(owner, TRAIT_XENO_IMMUNE, "xeno immune")
owner.med_hud_set_status()
spawn(0)
RemoveInfectionImages(owner)
INVOKE_ASYNC(src, .proc/RemoveInfectionImages, owner)
. = ..()
/obj/item/organ/internal/body_egg/process()
+25 -27
View File
@@ -13,39 +13,41 @@
// the person will not have either `deaf` or `ear_damage` decrease
// without external aid (earmuffs, drugs)
var/ear_damage = 0
// Multiplier for both long term and short term ear damage
var/damage_multiplier = 1
/obj/item/organ/internal/ears/on_life()
if(!iscarbon(owner))
return
var/mob/living/carbon/C = owner
// genetic deafness prevents the body from using the ears, even if healthy
if(DEAF in C.mutations)
deaf = max(deaf, 1)
if(ear_damage < 100)
AdjustEarDamage(-0.1)
// if we have non-damage related deafness like mutations, quirks or clothing (earmuffs), don't bother processing here. Ear healing from earmuffs or chems happen elsewhere
if(HAS_TRAIT_NOT_FROM(C, TRAIT_DEAF, EAR_DAMAGE))
return
if(ear_damage >= 100)
deaf = max(deaf, 1) // if we're failing we always have at least 1 deaf stack (and thus deafness)
else
if(ishuman(C))
var/mob/living/carbon/human/H = C
if((H.l_ear && H.l_ear.flags_2 & HEALS_EARS_2) || (H.r_ear && H.r_ear.flags_2 & HEALS_EARS_2))
deaf = max(deaf - 1, 1)
ear_damage = max(ear_damage - 0.10, 0)
// if higher than UNHEALING_EAR_DAMAGE, no natural healing occurs.
if(ear_damage < UNHEALING_EAR_DAMAGE)
ear_damage = max(ear_damage - 0.05, 0)
deaf = max(deaf - 1, 0)
deaf = max(deaf - 1, 0)
if((ear_damage > 10) && prob(ear_damage / 30))
AdjustEarDamage(0, 4)
SEND_SOUND(owner, sound('sound/weapons/flash_ring.ogg'))
if(deaf)
ADD_TRAIT(owner, TRAIT_DEAF, EAR_DAMAGE)
else
REMOVE_TRAIT(owner, TRAIT_DEAF, EAR_DAMAGE)
/obj/item/organ/internal/ears/proc/RestoreEars()
deaf = 0
ear_damage = 0
var/mob/living/carbon/C = owner
if(istype(C) && (DEAF in C.mutations))
deaf = 1
/obj/item/organ/internal/ears/proc/AdjustEarDamage(ddmg, ddeaf)
ear_damage = max(ear_damage + ddmg, 0)
deaf = max(deaf + ddeaf, 0)
/obj/item/organ/internal/ears/proc/MinimumDeafTicks(value)
deaf = max(deaf, value)
ear_damage = clamp(ear_damage + (ddmg * damage_multiplier), 0, 100)
deaf = max(deaf + (ddeaf * damage_multiplier), 0)
/obj/item/organ/internal/ears/surgeryize()
RestoreEars()
@@ -61,20 +63,16 @@
if(ears)
ears.AdjustEarDamage(ddmg, ddeaf)
/mob/living/carbon/MinimumDeafTicks(value)
var/obj/item/organ/internal/ears/ears = get_int_organ(/obj/item/organ/internal/ears)
if(ears)
ears.MinimumDeafTicks(value)
/obj/item/organ/internal/ears/cybernetic
name = "cybernetic ears"
icon_state = "ears-c"
desc = "a basic cybernetic designed to mimic the operation of ears."
origin_tech = "biotech=4"
status = ORGAN_ROBOT
damage_multiplier = 0.9
/obj/item/organ/internal/ears/cybernetic/emp_act(severity)
if(emp_proof)
return
..()
AdjustEarDamage(30, 120)
ear_damage += 40 / severity
+12 -12
View File
@@ -30,7 +30,7 @@
return eyes_icon
/obj/item/organ/internal/eyes/proc/get_colourmatrix() //Returns a special colour matrix if the eyes are organic and the mob is colourblind, otherwise it uses the current one.
if(!is_robotic() && (COLOURBLIND in owner.mutations))
if(!is_robotic() && HAS_TRAIT(owner, TRAIT_COLORBLIND))
return colourblind_matrix
else
return colourmatrix
@@ -44,26 +44,26 @@
if(istype(M) && eye_colour)
M.update_body() //Apply our eye colour to the target.
if(!(COLOURBLIND in M.mutations) && (COLOURBLIND in dependent_disabilities)) //If the eyes are colourblind and we're not, carry over the gene.
dependent_disabilities -= COLOURBLIND
M.dna.SetSEState(GLOB.colourblindblock,1)
genemutcheck(M,GLOB.colourblindblock,null,MUTCHK_FORCED)
if(!HAS_TRAIT(M, TRAIT_COLORBLIND) && (TRAIT_COLORBLIND in dependent_disabilities)) //If the eyes are colourblind and we're not, carry over the gene.
dependent_disabilities -= TRAIT_COLORBLIND
M.dna.SetSEState(GLOB.colourblindblock, TRUE)
singlemutcheck(M, GLOB.colourblindblock, MUTCHK_FORCED)
else
M.update_client_colour() //If we're here, that means the mob acquired the colourblindness gene while they didn't have eyes. Better handle it.
/obj/item/organ/internal/eyes/remove(mob/living/carbon/human/M, special = 0)
if(!special && (COLOURBLIND in M.mutations)) //If special is set, that means these eyes are getting deleted (i.e. during set_species())
if(!(COLOURBLIND in dependent_disabilities)) //We only want to change COLOURBLINDBLOCK and such it the eyes are being surgically removed.
dependent_disabilities |= COLOURBLIND
M.dna.SetSEState(GLOB.colourblindblock,0)
genemutcheck(M,GLOB.colourblindblock,null,MUTCHK_FORCED)
if(!special && HAS_TRAIT(M, TRAIT_COLORBLIND)) //If special is set, that means these eyes are getting deleted (i.e. during set_species())
if(!(TRAIT_COLORBLIND in dependent_disabilities)) //We only want to change COLOURBLINDBLOCK and such it the eyes are being surgically removed.
dependent_disabilities |= TRAIT_COLORBLIND
M.dna.SetSEState(GLOB.colourblindblock, FALSE)
singlemutcheck(M, GLOB.colourblindblock, MUTCHK_FORCED)
. = ..()
/obj/item/organ/internal/eyes/surgeryize()
if(!owner)
return
owner.CureNearsighted()
owner.CureBlind()
owner.cure_nearsighted(EYE_DAMAGE)
owner.cure_blind(EYE_DAMAGE)
owner.SetEyeBlurry(0)
owner.SetEyeBlind(0)
+5 -6
View File
@@ -87,6 +87,9 @@
if((H.status_flags & GODMODE))
return
if(HAS_TRAIT(H, TRAIT_NOBREATH))
return
if(!breath || (breath.total_moles() == 0))
if(isspaceturf(loc))
H.adjustOxyLoss(10)
@@ -267,11 +270,7 @@
/obj/item/organ/internal/lungs/proc/handle_breath_temperature(datum/gas_mixture/breath, mob/living/carbon/human/H) // called by human/life, handles temperatures
var/breath_temperature = breath.temperature
var/species_traits = list()
if(H && H.dna.species && H.dna.species.species_traits)
species_traits = H.dna.species.species_traits
if(!(COLDRES in H.mutations) && !(RESISTCOLD in species_traits)) // COLD DAMAGE
if(!HAS_TRAIT(H, TRAIT_RESISTCOLD)) // COLD DAMAGE
var/CM = abs(H.dna.species.coldmod)
var/TC = 0
if(breath_temperature < cold_level_3_threshold)
@@ -287,7 +286,7 @@
if(prob(20))
to_chat(H, "<span class='warning'>You feel [cold_message] in your [name]!</span>")
if(!(HEATRES in H.mutations) && !(RESISTHOT in species_traits)) // HEAT DAMAGE
if(!HAS_TRAIT(H, TRAIT_RESISTHEAT)) // HEAT DAMAGE
var/HM = abs(H.dna.species.heatmod)
var/TH = 0
if(breath_temperature > heat_level_1_threshold && breath_temperature < heat_level_2_threshold)
+1 -1
View File
@@ -100,7 +100,7 @@
return
//Process infections
if(is_robotic() || sterile || (owner && (NO_GERMS in owner.dna.species.species_traits)))
if(is_robotic() || sterile || (owner && HAS_TRAIT(owner, TRAIT_NOGERMS)))
germ_level = 0
return
@@ -616,7 +616,7 @@ Note that amputating the affected organ does in fact remove the infection from t
"<span class='danger'>Something feels like it shattered in your [name]!</span>",\
"You hear a sickening crack.")
playsound(owner, "bonebreak", 150, 1)
if(owner.dna.species && !(NO_PAIN in owner.dna.species.species_traits))
if(!HAS_TRAIT(owner, TRAIT_NOPAIN))
owner.emote("scream")
status |= ORGAN_BROKEN
+9 -14
View File
@@ -239,25 +239,20 @@
/obj/item/organ/internal/honktumor/insert(mob/living/carbon/M, special = 0)
..()
M.mutations.Add(CLUMSY)
M.mutations.Add(GLOB.comicblock)
M.dna.SetSEState(GLOB.clumsyblock,1,1)
M.dna.SetSEState(GLOB.comicblock,1,1)
genemutcheck(M,GLOB.clumsyblock,null,MUTCHK_FORCED)
genemutcheck(M,GLOB.comicblock,null,MUTCHK_FORCED)
M.dna.SetSEState(GLOB.clumsyblock, TRUE, TRUE)
M.dna.SetSEState(GLOB.comicblock, TRUE, TRUE)
singlemutcheck(M, GLOB.clumsyblock, MUTCHK_FORCED)
singlemutcheck(M, GLOB.comicblock, MUTCHK_FORCED)
organhonked = world.time
M.AddElement(/datum/element/waddling)
squeak = M.AddComponent(/datum/component/squeak, list('sound/items/bikehorn.ogg' = 1), 50)
/obj/item/organ/internal/honktumor/remove(mob/living/carbon/M, special = 0)
. = ..()
M.mutations.Remove(CLUMSY)
M.mutations.Remove(GLOB.comicblock)
M.dna.SetSEState(GLOB.clumsyblock,0)
M.dna.SetSEState(GLOB.comicblock,0)
genemutcheck(M,GLOB.clumsyblock,null,MUTCHK_FORCED)
genemutcheck(M,GLOB.comicblock,null,MUTCHK_FORCED)
M.dna.SetSEState(GLOB.clumsyblock, FALSE)
M.dna.SetSEState(GLOB.comicblock, FALSE)
singlemutcheck(M, GLOB.clumsyblock, MUTCHK_FORCED)
singlemutcheck(M, GLOB.comicblock, MUTCHK_FORCED)
M.RemoveElement(/datum/element/waddling)
QDEL_NULL(squeak)
qdel(src)
@@ -268,7 +263,7 @@
to_chat(owner, "<font color='red' size='7'>HONK</font>")
owner.SetSleeping(0)
owner.Stuttering(20)
owner.MinimumDeafTicks(30)
owner.AdjustEarDamage(0, 30)
owner.Weaken(3)
owner << 'sound/items/airhorn.ogg'
if(prob(30))
+2 -2
View File
@@ -34,7 +34,7 @@
if(stat >= UNCONSCIOUS)
return
if(NO_PAIN in dna.species.species_traits)
if(HAS_TRAIT(src, TRAIT_NOPAIN))
return
if(reagents.has_reagent("morphine"))
return
@@ -54,7 +54,7 @@
if(stat >= UNCONSCIOUS)
return
if(NO_PAIN in dna.species.species_traits)
if(HAS_TRAIT(src, TRAIT_NOPAIN))
return
if(reagents.has_reagent("morphine"))
return
@@ -125,11 +125,13 @@
M.faction |= "alien"
M.add_language("Hivemind")
M.add_language("Xenomorph")
ADD_TRAIT(M, TRAIT_XENO_IMMUNE, "xeno immune")
/obj/item/organ/internal/xenos/hivenode/remove(mob/living/carbon/M, special = 0)
M.faction -= "alien"
M.remove_language("Hivemind")
M.remove_language("Xenomorph")
REMOVE_TRAIT(M, TRAIT_XENO_IMMUNE, "xeno immune")
. = ..()
/obj/item/organ/internal/xenos/neurotoxin