Merge pull request #15996 from farie82/genes-optimization

Optimizes handle_mutations_and_radiation. No more looping 55 times per human to do nothing
This commit is contained in:
Fox McCloud
2021-05-15 10:13:31 -04:00
committed by GitHub
8 changed files with 26 additions and 27 deletions
+4 -5
View File
@@ -170,11 +170,10 @@
emote("drool")
/mob/living/carbon/human/handle_mutations_and_radiation()
for(var/datum/mutation/mutation in GLOB.dna_mutations)
if(!mutation.block)
continue
if(mutation.is_active(src))
mutation.on_life(src)
for(var/mutation_type in active_mutations)
var/datum/mutation/mutation = GLOB.dna_mutations[mutation_type]
mutation.on_life(src)
if(!ignore_gene_stability && gene_stability < GENETIC_DAMAGE_STAGE_1)
var/instability = DEFAULT_GENE_STABILITY - gene_stability
if(prob(instability * 0.1))
+3 -5
View File
@@ -152,11 +152,9 @@
verb = pick("whinnies", "neighs", "says")
if(dna)
for(var/datum/mutation/mutation in GLOB.dna_mutations)
if(!mutation.block)
continue
if(mutation.is_active(src))
S.message = mutation.on_say(src, S.message)
for(var/mutation_type in active_mutations)
var/datum/mutation/mutation = GLOB.dna_mutations[mutation_type]
S.message = mutation.on_say(src, S.message)
var/braindam = getBrainLoss()
if(braindam >= 60)
@@ -450,14 +450,13 @@ GLOBAL_LIST_EMPTY(damage_icon_parts)
if(gender == FEMALE)
g = "f"
// DNA2 - Drawing underlays.
for(var/datum/mutation/mutation in GLOB.dna_mutations)
if(!mutation.block)
continue
if(mutation.is_active(src))
var/underlay = mutation.on_draw_underlays(src, g)
if(underlay)
standing.underlays += underlay
add_image = 1
for(var/mutation_type in active_mutations)
var/datum/mutation/mutation = GLOB.dna_mutations[mutation_type]
var/underlay = mutation.on_draw_underlays(src, g)
if(underlay)
standing.underlays += underlay
add_image = TRUE
if(HAS_TRAIT(src, TRAIT_LASEREYES))
standing.overlays += "lasereyes_s"
add_image = 1
+1
View File
@@ -174,6 +174,7 @@
var/stance_damage = 0 //Whether this mob's ability to stand has been affected
/// List of the active mutation types
var/list/active_mutations = list()
var/last_movement = -100 // Last world.time the mob actually moved of its own accord.