mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +01:00
Optmizes handle_mutations_and_radiation
Saving about 90% CPU power on blank humanoids
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
var/mutation_active = M.dna.GetSEState(mutation.block)
|
||||
|
||||
// Sanity checks, don't skip.
|
||||
if(!mutation.can_activate(M, flags) && mutation_active)
|
||||
if(mutation_active && !mutation.can_activate(M, flags))
|
||||
//testing("[M] - Failed to activate [gene.name] (can_activate fail).")
|
||||
return FALSE
|
||||
|
||||
@@ -46,11 +46,7 @@
|
||||
if(mutation_active)
|
||||
//testing("[gene.name] activated!")
|
||||
mutation.activate(M)
|
||||
if(M)
|
||||
M.active_mutations |= mutation.type
|
||||
// If Gene is NOT active:
|
||||
else
|
||||
//testing("[gene.name] deactivated!")
|
||||
mutation.deactivate(M)
|
||||
if(M)
|
||||
M.active_mutations -= mutation.type
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
// Called when the gene activates. Do your magic here.
|
||||
/datum/mutation/proc/activate(mob/living/M)
|
||||
M.gene_stability -= instability
|
||||
M.active_mutations |= type // |= is probably not required but just in case
|
||||
for(var/thing in traits_to_add)
|
||||
ADD_TRAIT(M, thing, GENETIC_MUTATION)
|
||||
if(length(activation_messages))
|
||||
@@ -43,6 +44,7 @@
|
||||
// Only called when the block is deactivated.
|
||||
/datum/mutation/proc/deactivate(mob/living/M)
|
||||
M.gene_stability += instability
|
||||
M.active_mutations -= type
|
||||
for(var/thing in traits_to_add)
|
||||
REMOVE_TRAIT(M, thing, GENETIC_MUTATION)
|
||||
if(length(deactivation_messages))
|
||||
|
||||
Reference in New Issue
Block a user