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 16:25:19 -05:00
committed by GitHub
parent 324af7454c
commit 02b9445b9b
223 changed files with 2908 additions and 3049 deletions
+1 -1
View File
@@ -21,7 +21,7 @@
var/use_sound = 'sound/weapons/flash.ogg'
/obj/item/flash/proc/clown_check(mob/user)
if(user && (CLUMSY in user.mutations) && prob(50))
if(user && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
flash_carbon(user, user, 15, 0)
return 0
return 1
@@ -48,7 +48,7 @@
add_fingerprint(user)
if(on && user.zone_selected == "eyes")
if(((CLUMSY in user.mutations) || user.getBrainLoss() >= 60) && prob(50)) //too dumb to use flashlight properly
if((HAS_TRAIT(user, TRAIT_CLUMSY) || user.getBrainLoss() >= 60) && prob(50)) //too dumb to use flashlight properly
return ..() //just hit them in the head
if(!(istype(user, /mob/living/carbon/human) || SSticker) && SSticker.mode.name != "monkey") //don't have dexterity
@@ -74,9 +74,9 @@
if(istype(H)) //robots and aliens are unaffected
var/obj/item/organ/internal/eyes/eyes = H.get_int_organ(/obj/item/organ/internal/eyes)
if(M.stat == DEAD || !eyes || (BLINDNESS in M.mutations)) //mob is dead or fully blind
if(M.stat == DEAD || !eyes || HAS_TRAIT(M, TRAIT_BLIND)) //mob is dead or fully blind
to_chat(user, "<span class='notice'>[M]'s pupils are unresponsive to the light!</span>")
else if((XRAY in M.mutations) || eyes.see_in_dark >= 8) //The mob's either got the X-RAY vision or has a tapetum lucidum (extreme nightvision, i.e. Vulp/Tajara with COLOURBLIND & their monkey forms).
else if(HAS_TRAIT(M, TRAIT_XRAY_VISION) || eyes.see_in_dark >= 8) //The mob's either got the X-RAY vision or has a tapetum lucidum (extreme nightvision, i.e. Vulp/Tajara with COLOURBLIND & their monkey forms).
to_chat(user, "<span class='notice'>[M]'s pupils glow eerily!</span>")
else //they're okay!
if(M.flash_eyes(visual = 1))
@@ -79,11 +79,9 @@
if(!user.IsAdvancedToolUser())
to_chat(user, "<span class='warning'>You don't have the dexterity to do this!</span>")
return
if(ishuman(user))
var/mob/living/carbon/human/H = user
if((HULK in H.mutations) || (NOGUNS in H.dna.species.species_traits))
user << "<span class='warning'>Your fingers can't press the button!</span>"
return
if(HAS_TRAIT(user, TRAIT_CHUNKYFINGERS))
to_chat(user, "<span class='warning'>Your fingers can't press the button!</span>")
return
add_fingerprint(user)
+1 -1
View File
@@ -32,7 +32,7 @@
if(H && H.mind && H.mind.miming)
to_chat(user, "<span class='warning'>Your vow of silence prevents you from speaking.</span>")
return
if((COMIC in H.mutations) || H.get_int_organ(/obj/item/organ/internal/cyberimp/brain/clown_voice))
if(HAS_TRAIT(H, TRAIT_COMIC_SANS))
span = "sans"
if(spamcheck)
to_chat(user, "<span class='warning'>\The [src] needs to recharge!</span>")
+7 -7
View File
@@ -98,7 +98,7 @@ REAGENT SCANNER
var/advanced = FALSE
/obj/item/healthanalyzer/attack(mob/living/M, mob/living/user)
if(((CLUMSY in user.mutations) || user.getBrainLoss() >= 60) && prob(50))
if((HAS_TRAIT(user, TRAIT_CLUMSY) || user.getBrainLoss() >= 60) && prob(50))
user.visible_message("<span class='warning'>[user] analyzes the floor's vitals!</span>", "<span class='notice'>You stupidly try to analyze the floor's vitals!</span>")
to_chat(user, "<span class='info'>Analyzing results for The floor:\n\tOverall status: <b>Healthy</b></span>")
to_chat(user, "<span class='info'>Key: <font color='blue'>Suffocation</font>/<font color='green'>Toxin</font>/<font color='#FF8000'>Burn</font>/<font color='red'>Brute</font></span>")
@@ -130,7 +130,7 @@ REAGENT SCANNER
var/TX = H.getToxLoss() > 50 ? "<b>[H.getToxLoss()]</b>" : H.getToxLoss()
var/BU = H.getFireLoss() > 50 ? "<b>[H.getFireLoss()]</b>" : H.getFireLoss()
var/BR = H.getBruteLoss() > 50 ? "<b>[H.getBruteLoss()]</b>" : H.getBruteLoss()
if(H.status_flags & FAKEDEATH)
if(HAS_TRAIT(H, TRAIT_FAKEDEATH))
OX = fake_oxy > 50 ? "<b>[fake_oxy]</b>" : fake_oxy
to_chat(user, "<span class='notice'>Analyzing Results for [H]:\n\t Overall Status: dead</span>")
else
@@ -138,7 +138,7 @@ REAGENT SCANNER
to_chat(user, "\t Key: <font color='blue'>Suffocation</font>/<font color='green'>Toxin</font>/<font color='#FFA500'>Burns</font>/<font color='red'>Brute</font>")
to_chat(user, "\t Damage Specifics: <font color='blue'>[OX]</font> - <font color='green'>[TX]</font> - <font color='#FFA500'>[BU]</font> - <font color='red'>[BR]</font>")
to_chat(user, "<span class='notice'>Body Temperature: [H.bodytemperature-T0C]&deg;C ([H.bodytemperature*1.8-459.67]&deg;F)</span>")
if(H.timeofdeath && (H.stat == DEAD || (H.status_flags & FAKEDEATH)))
if(H.timeofdeath && (H.stat == DEAD || (HAS_TRAIT(H, TRAIT_FAKEDEATH))))
to_chat(user, "<span class='notice'>Time of Death: [station_time_timestamp("hh:mm:ss", H.timeofdeath)]</span>")
var/tdelta = round(world.time - H.timeofdeath)
if(tdelta < DEFIB_TIME_LIMIT)
@@ -155,7 +155,7 @@ REAGENT SCANNER
TX = H.getToxLoss() > 50 ? "<font color='green'><b>Dangerous amount of toxins detected</b></font>" : "Subject bloodstream toxin level minimal"
BU = H.getFireLoss() > 50 ? "<font color='#FFA500'><b>Severe burn damage detected</b></font>" : "Subject burn injury status O.K"
BR = H.getBruteLoss() > 50 ? "<font color='red'><b>Severe anatomical damage detected</b></font>" : "Subject brute-force injury status O.K"
if(H.status_flags & FAKEDEATH)
if(HAS_TRAIT(H, TRAIT_FAKEDEATH))
OX = fake_oxy > 50 ? "<span class='danger'>Severe oxygen deprivation detected</span>" : "<span class='notice'>Subject bloodstream oxygen level normal</span>"
to_chat(user, "[OX] | [TX] | [BU] | [BR]")
@@ -837,11 +837,11 @@ REAGENT SCANNER
dat += "<td>[i.name]</td><td>N/A</td><td>[i.damage]</td><td>[infection]:[mech]</td><td></td>"
dat += "</tr>"
dat += "</table>"
if(BLINDNESS in target.mutations)
if(HAS_TRAIT(target, TRAIT_BLIND))
dat += "<font color='red'>Cataracts detected.</font><BR>"
if(COLOURBLIND in target.mutations)
if(HAS_TRAIT(target, TRAIT_COLORBLIND))
dat += "<font color='red'>Photoreceptor abnormalities detected.</font><BR>"
if(NEARSIGHTED in target.mutations)
if(HAS_TRAIT(target, TRAIT_NEARSIGHT))
dat += "<font color='red'>Retinal misalignment detected.</font><BR>"
return dat
+1 -1
View File
@@ -45,7 +45,7 @@
return ..()
if(user.zone_selected != "eyes" && user.zone_selected != "head")
return ..()
if((CLUMSY in user.mutations) && prob(50))
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
M = user
return eyestab(M,user)
+1 -1
View File
@@ -35,7 +35,7 @@
return ..()
add_fingerprint(user)
if((CLUMSY in user.mutations) && prob(50))
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
user.visible_message("<span class='danger'>[user] accidentally clubs [user.p_them()]self with [src]!</span>", \
"<span class='userdanger'>You accidentally club yourself with [src]!</span>")
user.Weaken(force * 3)
+2 -2
View File
@@ -419,7 +419,7 @@
for(var/obj/item/organ/external/O in H.bodyparts)
total_brute += O.brute_dam
total_burn += O.burn_dam
if(total_burn <= 180 && total_brute <= 180 && !H.suiciding && !ghost && tplus < tlimit && !(NOCLONE in H.mutations) && (H.mind && H.mind.is_revivable()) && (H.get_int_organ(/obj/item/organ/internal/heart) || H.get_int_organ(/obj/item/organ/internal/brain/slime)))
if(total_burn <= 180 && total_brute <= 180 && !H.suiciding && !ghost && tplus < tlimit && !HAS_TRAIT(H, TRAIT_HUSK) && !HAS_TRAIT(H, TRAIT_BADDNA) && (H.mind && H.mind.is_revivable()) && (H.get_int_organ(/obj/item/organ/internal/heart) || H.get_int_organ(/obj/item/organ/internal/brain/slime)))
tobehealed = min(health + threshold, 0) // It's HILARIOUS without this min statement, let me tell you
tobehealed -= 5 //They get 5 of each type of damage healed so excessive combined damage will not immediately kill them after they get revived
H.adjustOxyLoss(tobehealed)
@@ -538,7 +538,7 @@
for(var/obj/item/organ/external/O in H.bodyparts)
total_brute += O.brute_dam
total_burn += O.burn_dam
if(total_burn <= 180 && total_brute <= 180 && !H.suiciding && !ghost && tplus < tlimit && !(NOCLONE in H.mutations) && (H.mind && H.mind.is_revivable()))
if(total_burn <= 180 && total_brute <= 180 && !H.suiciding && !ghost && tplus < tlimit && !HAS_TRAIT(H, TRAIT_HUSK) && (H.mind && H.mind.is_revivable()))
tobehealed = min(health + threshold, 0) // It's HILARIOUS without this min statement, let me tell you
tobehealed -= 5 //They get 5 of each type of damage healed so excessive combined damage will not immediately kill them after they get revived
H.adjustOxyLoss(tobehealed)
@@ -80,7 +80,7 @@
return
spawn(0) //Some mutations have sleeps in them, like monkey
if(!(NOCLONE in M.mutations) && !(H && (NO_DNA in H.dna.species.species_traits))) // prevents drained people from having their DNA changed
if(!HAS_TRAIT(M, TRAIT_BADDNA) && !HAS_TRAIT(M, TRAIT_GENELESS)) // prevents drained people from having their DNA changed
var/prev_ue = M.dna.unique_enzymes
// UI in syringe.
if(buf.types & DNA2_BUF_UI)
@@ -103,7 +103,7 @@
M.dna.UpdateSE()
else
M.dna.SetSEValue(block,src.GetValue())
domutcheck(M, null, forcedmutation ? MUTCHK_FORCED : 0)
domutcheck(M, forcedmutation ? MUTCHK_FORCED : FALSE)
M.update_mutations()
if(H)
H.sync_organ_dna(assimilate = 0, old_ue = prev_ue)
@@ -112,14 +112,9 @@
if(used)
to_chat(user, "<span class='warning'>This injector is used up!</span>")
return
if(!M.dna) //You know what would be nice? If the mob you're injecting has DNA, and so doesn't cause runtimes.
if(!M.dna || HAS_TRAIT(M, TRAIT_GENELESS) || HAS_TRAIT(M, TRAIT_BADDNA)) //You know what would be nice? If the mob you're injecting has DNA, and so doesn't cause runtimes.
return FALSE
if(ishuman(M)) // Would've done this via species instead of type, but the basic mob doesn't have a species, go figure.
var/mob/living/carbon/human/H = M
if(NO_DNA in H.dna.species.species_traits)
return FALSE
if(!user.IsAdvancedToolUser())
return FALSE
@@ -22,11 +22,9 @@
if(used)
return
if(ishuman(M))
var/mob/living/carbon/human/H = M
if(NO_DNA in H.dna.species.species_traits)
to_chat(user, "<span class='warning'>You failed to inject [M], as [M.p_they()] [M.p_have()] no DNA to scramble, nor flesh to inject.</span>")
return
if(HAS_TRAIT(M, TRAIT_GENELESS))
to_chat(user, "<span class='warning'>You failed to inject [M], as [M.p_they()] [M.p_have()] no DNA to scramble, nor flesh to inject.</span>")
return
if(M == user)
user.visible_message("<span class='danger'>[user] injects [user.p_them()]self with [src]!</span>")
@@ -74,7 +74,7 @@
if(!ear_safety)
M.Stun(stun_amount)
M.Weaken(stun_amount)
M.AdjustEarDamage(rand(0, 5), 15)
M.AdjustEarDamage(5, 15)
if(iscarbon(M))
var/mob/living/carbon/C = M
var/obj/item/organ/internal/ears/ears = C.get_int_organ(/obj/item/organ/internal/ears)
@@ -83,6 +83,5 @@
to_chat(M, "<span class='warning'>Your ears start to ring badly!</span>")
if(prob(ears.ear_damage - 5))
to_chat(M, "<span class='warning'>You can't hear anything!</span>")
M.BecomeDeaf()
else if(ears.ear_damage >= 5)
to_chat(M, "<span class='warning'>Your ears start to ring!</span>")
@@ -22,7 +22,7 @@
qdel(src)
/obj/item/grenade/proc/clown_check(var/mob/living/user)
if((CLUMSY in user.mutations) && prob(50))
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
to_chat(user, "<span class='warning'>Huh? How does this thing work?</span>")
active = 1
icon_state = initial(icon_state) + "_active"
+1 -1
View File
@@ -29,7 +29,7 @@
to_chat(user, "<span class='warning'>[src] is stuck to your hand!</span>")
return
if((CLUMSY in user.mutations) && prob(50) && (!ignoresClumsy))
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50) && (!ignoresClumsy))
to_chat(user, "<span class='warning'>Uh... how do those things work?!</span>")
apply_cuffs(user, user)
return
+1 -1
View File
@@ -48,7 +48,7 @@
if(user.a_intent != INTENT_HELP)
if(user.zone_selected == "head" || user.zone_selected == "eyes")
if((CLUMSY in user.mutations) && prob(50))
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
C = user
return eyestab(C, user)
else
@@ -37,7 +37,7 @@
return BRUTELOSS|FIRELOSS
/obj/item/melee/energy/attack_self(mob/living/carbon/user)
if((CLUMSY in user.mutations) && prob(50))
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
to_chat(user, "<span class='warning'>You accidentally cut yourself with [src], like a doofus!</span>")
user.take_organ_damage(5,5)
active = !active
@@ -291,7 +291,7 @@
if(ishuman(user))
var/mob/living/carbon/human/H = user
if((CLUMSY in H.mutations) && prob(50))
if(HAS_TRAIT(H, TRAIT_CLUMSY) && prob(50))
to_chat(H, "<span class='warning'>You accidentally cut yourself with [src], like a doofus!</span>")
H.take_organ_damage(10,10)
active = !active
@@ -101,7 +101,7 @@
if(tank && !tank.air_contents.remove(gasPerThrow * pressureSetting))
to_chat(user, "<span class='warning'>\The [src] lets out a weak hiss and doesn't react!</span>")
return
if(user && (CLUMSY in user.mutations) && prob(75))
if(user && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(75))
user.visible_message("<span class='warning'>[user] loses [user.p_their()] grip on [src], causing it to go off!</span>", "<span class='userdanger'>[src] slips out of your hands and goes off!</span>")
user.drop_item()
if(prob(10))
+1 -1
View File
@@ -51,7 +51,7 @@
return
if(ishuman(user))
var/mob/living/carbon/human/H = user
if(!H.gloves && !(PIERCEIMMUNE in H.dna.species.species_traits))
if(!H.gloves && !HAS_TRAIT(H, TRAIT_PIERCEIMMUNE))
var/obj/item/organ/external/affecting = H.get_organ("[user.hand ? "l" : "r" ]_hand")
if(affecting.is_robotic())
return
+1 -1
View File
@@ -76,7 +76,7 @@
return (active)
/obj/item/shield/energy/attack_self(mob/living/carbon/human/user)
if((CLUMSY in user.mutations) && prob(50))
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
to_chat(user, "<span class='warning'>You beat yourself in the head with [src].</span>")
user.take_organ_damage(5)
active = !active
@@ -82,7 +82,7 @@
user.take_organ_damage(0, 10)
return
if((CLUMSY in user.mutations) && prob(50))
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
to_chat(user, "<span class='warning'>The [src] slips out of your hand and hits your head.</span>")
user.take_organ_damage(10)
user.Paralyse(20)
@@ -56,7 +56,7 @@
to_chat(user, "<span class='warning'>The [I] is too big to fit in the false bottom!</span>")
return
if(!user.drop_item(I))
user << "<span class='warning'>The [I] is stuck to your hands!</span>"
to_chat(user, "<span class='warning'>The [I] is stuck to your hands!</span>")
return
stored_item = I
+1 -1
View File
@@ -135,7 +135,7 @@
add_fingerprint(user)
/obj/item/melee/baton/attack(mob/M, mob/living/user)
if(status && (CLUMSY in user.mutations) && prob(50))
if(status && HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
user.visible_message("<span class='danger'>[user] accidentally hits [user.p_them()]self with [src]!</span>", \
"<span class='userdanger'>You accidentally hit yourself with [src]!</span>")
user.Weaken(stunforce*3)
+1 -1
View File
@@ -9,7 +9,7 @@
/obj/item/melee/baton/cattleprod/teleprod/attack(mob/living/carbon/M, mob/living/carbon/user)//handles making things teleport when hit
..()
if(status)
if((CLUMSY in user.mutations) && prob(50))
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(50))
user.visible_message("<span class='danger'>[user] accidentally hits [user.p_them()]self with [src]!</span>", \
"<span class='userdanger'>You accidentally hit yourself with [src]!</span>")
user.Weaken(stunforce*3)
+3 -3
View File
@@ -300,12 +300,12 @@
..()
/obj/item/twohanded/dualsaber/attack(mob/target, mob/living/user)
if(HULK in user.mutations)
if(HAS_TRAIT(user, TRAIT_HULK))
to_chat(user, "<span class='warning'>You grip the blade too hard and accidentally close it!</span>")
unwield()
return
..()
if((CLUMSY in user.mutations) && (wielded) && prob(40))
if(HAS_TRAIT(user, TRAIT_CLUMSY) && (wielded) && prob(40))
to_chat(user, "<span class='warning'>You twirl around a bit before losing your balance and impaling yourself on the [src].</span>")
user.take_organ_damage(20, 25)
return
@@ -353,7 +353,7 @@
return TRUE
/obj/item/twohanded/dualsaber/wield(mob/living/carbon/M) //Specific wield () hulk checks due to reflection chance for balance issues and switches hitsounds.
if(HULK in M.mutations)
if(HAS_TRAIT(M, TRAIT_HULK))
to_chat(M, "<span class='warning'>You lack the grace to wield this!</span>")
return
. = ..()