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
+4 -4
View File
@@ -227,24 +227,24 @@
return update_flags
/datum/reagent/proc/fakedeath(mob/living/M)
if(M.status_flags & FAKEDEATH)
if(HAS_TRAIT(M, TRAIT_FAKEDEATH))
return
if(!(M.status_flags & CANPARALYSE))
return
if(M.mind && M.mind.changeling && M.mind.changeling.regenerating) //no messing with changeling's fake death
return
M.emote("deathgasp")
M.status_flags |= FAKEDEATH
ADD_TRAIT(M, TRAIT_FAKEDEATH, id)
M.updatehealth("fakedeath reagent")
/datum/reagent/proc/fakerevive(mob/living/M)
if(!(M.status_flags & FAKEDEATH))
if(!HAS_TRAIT(M, TRAIT_FAKEDEATH))
return
if(M.mind && M.mind.changeling && M.mind.changeling.regenerating)
return
if(M.resting)
M.StopResting()
M.status_flags &= ~(FAKEDEATH)
REMOVE_TRAIT(M, TRAIT_FAKEDEATH, id)
if(M.healthdoll)
M.healthdoll.cached_healthdoll_overlays.Cut()
M.updatehealth("fakedeath reagent end")
@@ -25,8 +25,8 @@
E.mend_fracture()
E.internal_bleeding = FALSE
M.SetEyeBlind(0, FALSE)
M.CureNearsighted(FALSE)
M.CureBlind(FALSE)
M.cure_nearsighted(null, FALSE)
M.cure_blind(null, FALSE)
M.CureMute()
M.CureDeaf()
M.CureEpilepsy()
@@ -73,11 +73,11 @@
update_flags |= M.Druggy(30, FALSE)
M.AdjustDizzy(5)
M.SetDrowsy(0)
M.status_flags |= GOTTAGONOTSOFAST
ADD_TRAIT(M, TRAIT_GOTTAGONOTSOFAST, id)
return ..() | update_flags
/datum/reagent/consumable/drink/cold/nuka_cola/on_mob_delete(mob/living/M)
M.status_flags &= ~GOTTAGONOTSOFAST
REMOVE_TRAIT(M, TRAIT_GOTTAGONOTSOFAST, id)
..()
/datum/reagent/consumable/drink/cold/spacemountainwind
@@ -74,8 +74,8 @@
if(1 to 20)
//nothing
if(21 to INFINITY)
if(prob(current_cycle-10))
update_flags |= M.CureNearsighted(FALSE)
if(prob(current_cycle - 10))
update_flags |= M.cure_nearsighted(EYE_DAMAGE, FALSE)
return ..() | update_flags
/datum/reagent/consumable/drink/doctor_delight
@@ -178,7 +178,7 @@
/datum/reagent/consumable/drink/banana/on_mob_life(mob/living/M)
var/update_flags = STATUS_UPDATE_NONE
if((ishuman(M) && (COMIC in M.mutations)) || issmall(M))
if(HAS_TRAIT(M, TRAIT_COMIC_SANS) || issmall(M))
update_flags |= M.adjustBruteLoss(-1, FALSE)
update_flags |= M.adjustFireLoss(-1, FALSE)
return ..() | update_flags
@@ -409,7 +409,7 @@
/datum/reagent/consumable/drink/bananahonk/on_mob_life(mob/living/M)
var/update_flags = STATUS_UPDATE_NONE
if((ishuman(M) && (COMIC in M.mutations)) || issmall(M))
if(HAS_TRAIT(M, TRAIT_COMIC_SANS) || issmall(M))
update_flags |= M.adjustBruteLoss(-1, FALSE)
update_flags |= M.adjustFireLoss(-1, FALSE)
return ..() | update_flags
@@ -517,7 +517,7 @@
description = "Beloved of children and teetotalers."
color = "#E6CDFF"
taste_description = "grape soda"
/datum/reagent/consumable/drink/coco/icecoco
name = "Iced Cocoa"
id = "icecoco"
@@ -290,7 +290,7 @@
H.visible_message("<span class='warning'>[M]'s skin is rotting away!</span>")
update_flags |= H.adjustBruteLoss(25, FALSE)
H.emote("scream")
H.ChangeToHusk()
H.become_husk("krokodil_overdose")
H.emote("faint")
else if(effect <= 7)
M.emote("shiver")
@@ -322,13 +322,13 @@
update_flags |= M.AdjustWeakened(-2.5, FALSE)
update_flags |= M.adjustStaminaLoss(-2, FALSE)
update_flags |= M.SetSleeping(0, FALSE)
M.status_flags |= GOTTAGOFAST
ADD_TRAIT(M, TRAIT_GOTTAGOFAST, id)
if(prob(50))
update_flags |= M.adjustBrainLoss(1, FALSE)
return ..() | update_flags
/datum/reagent/methamphetamine/on_mob_delete(mob/living/M)
M.status_flags &= ~GOTTAGOFAST
REMOVE_TRAIT(M, TRAIT_GOTTAGOFAST, id)
..()
/datum/reagent/methamphetamine/overdose_process(mob/living/M, severity)
@@ -684,7 +684,7 @@
update_flags |= M.AdjustStunned(-2, FALSE)
update_flags |= M.AdjustWeakened(-2, FALSE)
update_flags |= M.adjustStaminaLoss(-2, FALSE)
M.status_flags |= GOTTAGOFAST
ADD_TRAIT(M, TRAIT_GOTTAGOFAST, id)
M.Jitter(3)
update_flags |= M.adjustBrainLoss(0.5, FALSE)
if(prob(5))
@@ -692,7 +692,7 @@
return ..() | update_flags
/datum/reagent/lube/ultra/on_mob_delete(mob/living/M)
M.status_flags &= ~GOTTAGOFAST
REMOVE_TRAIT(M, TRAIT_GOTTAGOFAST, id)
..()
/datum/reagent/lube/ultra/overdose_process(mob/living/M, severity)
@@ -809,7 +809,7 @@
H.Weaken(2, FALSE)
H.update_canmove()
to_chat(H, "<span class='danger'>Ugh! Eating that was a terrible idea!</span>")
if(NO_HUNGER in H.dna.species.species_traits) //If you don't eat, then you can't get food poisoning
if(HAS_TRAIT(H, TRAIT_NOHUNGER)) //If you don't eat, then you can't get food poisoning
return
H.ForceContractDisease(new /datum/disease/food_poisoning(0))
@@ -295,6 +295,11 @@
M.adjustFireLoss(-1.5*volume)
if(show_message)
to_chat(M, "<span class='notice'>The synthetic flesh integrates itself into your wounds, healing you.</span>")
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(HAS_TRAIT_FROM(H, TRAIT_HUSK, BURN) && H.getFireLoss() < UNHUSK_DAMAGE_THRESHOLD && (H.reagents.get_reagent_amount("synthflesh") + volume >= SYNTHFLESH_UNHUSK_AMOUNT))
H.cure_husk(BURN)
H.visible_message("<span class='nicegreen'>The squishy liquid coats [H]'s burns. [H] looks a lot healthier!") //we're avoiding using the phrases "burnt flesh" and "burnt skin" here because humans could be a skeleton or a golem or something
..()
/datum/reagent/medicine/synthflesh/reaction_turf(turf/T, volume) //let's make a mess!
@@ -639,9 +644,9 @@
update_flags |= M.AdjustEyeBlurry(-1, FALSE)
update_flags |= M.AdjustEarDamage(-1)
if(prob(50))
update_flags |= M.CureNearsighted(FALSE)
update_flags |= M.cure_nearsighted(EYE_DAMAGE, FALSE)
if(prob(30))
update_flags |= M.CureBlind(FALSE)
update_flags |= M.cure_blind(EYE_DAMAGE, FALSE)
update_flags |= M.SetEyeBlind(0, FALSE)
return ..() | update_flags
@@ -769,7 +774,7 @@
if(M.getBruteLoss() + M.getFireLoss() + M.getCloneLoss() >= 150)
M.delayed_gib()
return
if(!M.suiciding && !(NOCLONE in M.mutations) && (!M.mind || M.mind && M.mind.is_revivable()))
if(!M.suiciding && !HAS_TRAIT(M, TRAIT_HUSK) && !HAS_TRAIT(M, TRAIT_BADDNA) && (!M.mind || M.mind && M.mind.is_revivable()))
var/time_dead = world.time - M.timeofdeath
M.visible_message("<span class='warning'>[M] seems to rise from the dead!</span>")
M.adjustCloneLoss(50)
@@ -820,13 +825,13 @@
..()
return
M.SetJitter(0)
var/needs_update = M.mutations.len > 0
var/needs_update = length(M.active_mutations)
if(needs_update)
for(var/block = 1; block<=DNA_SE_LENGTH; block++)
if(!(block in M.dna.default_blocks))
M.dna.SetSEState(block, FALSE, TRUE)
genemutcheck(M, block, null, MUTCHK_FORCED)
singlemutcheck(M, block, MUTCHK_FORCED)
M.dna.UpdateSE()
M.dna.struc_enzymes = M.dna.struc_enzymes_original
@@ -902,7 +907,7 @@
/datum/reagent/medicine/stimulative_agent/on_mob_life(mob/living/M)
var/update_flags = STATUS_UPDATE_NONE
M.status_flags |= GOTTAGOFAST
ADD_TRAIT(M, TRAIT_GOTTAGOFAST, id)
if(M.health < 50 && M.health > 0)
update_flags |= M.adjustOxyLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE)
update_flags |= M.adjustToxLoss(-1*REAGENTS_EFFECT_MULTIPLIER, FALSE)
@@ -915,7 +920,7 @@
return ..() | update_flags
/datum/reagent/medicine/stimulative_agent/on_mob_delete(mob/living/M)
M.status_flags &= ~GOTTAGOFAST
REMOVE_TRAIT(M, TRAIT_GOTTAGOFAST, id)
..()
/datum/reagent/medicine/stimulative_agent/overdose_process(mob/living/M, severity)
@@ -460,7 +460,7 @@
else
to_chat(C, "<span class='warning'>Something doesn't feel right...</span>")
C.AdjustDizzy(volume)
ADD_TRAIT(C, TRAIT_JESTER, id)
ADD_TRAIT(C, TRAIT_COMIC_SANS, id)
C.AddComponent(/datum/component/squeak, null, null, null, null, null, TRUE)
C.AddElement(/datum/element/waddling)
@@ -496,7 +496,7 @@
/datum/reagent/jestosterone/on_mob_delete(mob/living/M)
..()
REMOVE_TRAIT(M, TRAIT_JESTER, id)
REMOVE_TRAIT(M, TRAIT_COMIC_SANS, id)
qdel(M.GetComponent(/datum/component/squeak))
M.RemoveElement(/datum/element/waddling)
@@ -34,7 +34,7 @@
taste_description = "mint"
/datum/reagent/minttoxin/on_mob_life(mob/living/M)
if(FAT in M.mutations)
if(HAS_TRAIT(M, TRAIT_FAT))
M.gib()
return ..()
@@ -180,11 +180,11 @@
/datum/reagent/mutagen/reaction_mob(mob/living/M, method=REAGENT_TOUCH, volume)
if(!..())
return
if(!M.dna)
if(!M.dna || HAS_TRAIT(M, TRAIT_BADDNA) || HAS_TRAIT(M, TRAIT_GENELESS))
return //No robots, AIs, aliens, Ians or other mobs should be affected by this.
if((method==REAGENT_TOUCH && prob(33)) || method==REAGENT_INGEST)
randmutb(M)
domutcheck(M, null)
domutcheck(M)
M.UpdateAppearance()
/datum/reagent/mutagen/on_mob_life(mob/living/M)
@@ -213,7 +213,7 @@
return ..()
/datum/reagent/stable_mutagen/on_mob_life(mob/living/M)
if(!ishuman(M) || !M.dna)
if(!ishuman(M) || !M.dna || HAS_TRAIT(M, TRAIT_BADDNA) || HAS_TRAIT(M, TRAIT_GENELESS))
return
M.apply_effect(2 * REAGENTS_EFFECT_MULTIPLIER, IRRADIATE)
if(current_cycle == 10 && islist(data))
@@ -1113,12 +1113,12 @@
update_flags |= M.AdjustEyeBlurry(10, FALSE)
if(70 to INFINITY)
update_flags |= M.AdjustEyeBlurry(10, FALSE)
if(M.status_flags & FAKEDEATH)
if(HAS_TRAIT(M, TRAIT_FAKEDEATH))
fakerevive(M)
return ..() | update_flags
/datum/reagent/capulettium/on_mob_delete(mob/living/M)
if(M.status_flags & FAKEDEATH)
if(HAS_TRAIT(M, TRAIT_FAKEDEATH))
fakerevive(M)
..()
@@ -1133,14 +1133,14 @@
/datum/reagent/capulettium_plus/on_mob_life(mob/living/M)
M.Silence(2)
if((M.status_flags & FAKEDEATH) && !M.resting)
if((HAS_TRAIT(M, TRAIT_FAKEDEATH)) && !M.resting)
fakerevive(M)
else if(!(M.status_flags & FAKEDEATH) && M.resting)
else if(!HAS_TRAIT(M, TRAIT_FAKEDEATH) && M.resting)
fakedeath(M)
return ..()
/datum/reagent/capulettium_plus/on_mob_delete(mob/living/M)
if(M.status_flags & FAKEDEATH)
if(HAS_TRAIT(M, TRAIT_FAKEDEATH))
fakerevive(M)
..()
@@ -1178,7 +1178,7 @@
return //No robots, AIs, aliens, Ians or other mobs should be affected by this.
if((method==REAGENT_TOUCH && prob(50)) || method==REAGENT_INGEST)
randmutb(M)
domutcheck(M, null)
domutcheck(M)
M.UpdateAppearance()
/datum/reagent/glowing_slurry/on_mob_life(mob/living/M)
@@ -1193,7 +1193,7 @@
randmutg(M)
did_mutation = TRUE
if(did_mutation)
domutcheck(M, null)
domutcheck(M)
M.UpdateAppearance()
return ..()