///////////////////////////// // Helpers for DNA2 ///////////////////////////// // Pads 0s to t until length == u /proc/add_zero2(t, u) var/temp1 while (length(t) < u) t = "0[t]" temp1 = t if (length(t) > u) temp1 = copytext(t,2,u+1) return temp1 // DNA Gene activation boundaries, see dna2.dm. // Returns a list object with 4 numbers. /proc/GetDNABounds(var/block) var/list/BOUNDS=dna_activity_bounds[block] if(!istype(BOUNDS)) return DNA_DEFAULT_BOUNDS return BOUNDS // Give Random Bad Mutation to M /proc/randmutb(var/mob/living/M) if(!M || !(M.dna)) return // Traitgenes NO_DNA and Synthetics cannot be mutated if(M.isSynthetic()) return if(ishuman(M)) var/mob/living/carbon/human/H = M if(!H.species || H.species.flags & NO_DNA) return M.dna.check_integrity() // Traitgenes Pick from bad traitgenes var/datum/gene/trait/T = pick(GLOB.dna_genes_bad + (prob(10) ? GLOB.dna_genes_neutral : list()) ) // Chance for neutrals as well M.dna.SetSEState(T.block, TRUE) // Give Random Good Mutation to M /proc/randmutg(var/mob/living/M) if(!M || !(M.dna)) return // Traitgenes NO_DNA and Synthetics cannot be mutated if(M.isSynthetic()) return if(ishuman(M)) var/mob/living/carbon/human/H = M if(!H.species || H.species.flags & NO_DNA) return M.dna.check_integrity() // Traitgenes Pick from good traitgenes var/datum/gene/trait/T = pick(GLOB.dna_genes_good + (prob(10) ? GLOB.dna_genes_neutral : list()) ) // Chance for neutrals as well M.dna.SetSEState(T.block, TRUE) // Scramble UI or SE. /proc/scramble(var/UI, var/mob/M, var/prob) if(!M || !(M.dna)) return // Traitgenes edit begin - NO_DNA and Synthetics cannot be mutated if(M.isSynthetic()) return if(ishuman(M)) var/mob/living/carbon/human/H = M if(!H.species || H.species.flags & NO_DNA) return // Traitgenes edit end M.dna.check_integrity() for(var/i = 1, i <= DNA_SE_LENGTH-1, i++) if(prob(prob)) M.dna.SetSEValue(i,rand(1,4095),1) M.dna.UpdateSE() domutcheck(M, null, MUTCHK_FORCED|MUTCHK_HIDEMSG) M.UpdateAppearance() return // I haven't yet figured out what the fuck this is supposed to do. /proc/miniscramble(input,rs,rd) var/output output = null if (input == "C" || input == "D" || input == "E" || input == "F") output = pick(prob((rs*10));"4",prob((rs*10));"5",prob((rs*10));"6",prob((rs*10));"7",prob((rs*5)+(rd));"0",prob((rs*5)+(rd));"1",prob((rs*10)-(rd));"2",prob((rs*10)-(rd));"3") if (input == "8" || input == "9" || input == "A" || input == "B") output = pick(prob((rs*10));"4",prob((rs*10));"5",prob((rs*10));"A",prob((rs*10));"B",prob((rs*5)+(rd));"C",prob((rs*5)+(rd));"D",prob((rs*5)+(rd));"2",prob((rs*5)+(rd));"3") if (input == "4" || input == "5" || input == "6" || input == "7") output = pick(prob((rs*10));"4",prob((rs*10));"5",prob((rs*10));"A",prob((rs*10));"B",prob((rs*5)+(rd));"C",prob((rs*5)+(rd));"D",prob((rs*5)+(rd));"2",prob((rs*5)+(rd));"3") if (input == "0" || input == "1" || input == "2" || input == "3") output = pick(prob((rs*10));"8",prob((rs*10));"9",prob((rs*10));"A",prob((rs*10));"B",prob((rs*10)-(rd));"C",prob((rs*10)-(rd));"D",prob((rs*5)+(rd));"E",prob((rs*5)+(rd));"F") if (!output) output = "5" return output // HELLO I MAKE BELL CURVES AROUND YOUR DESIRED TARGET // So a shitty way of replacing gaussian noise. // input: YOUR TARGET // rs: RAD STRENGTH // rd: DURATION /proc/miniscrambletarget(input,rs,rd) var/output = null switch(input) if("0") output = pick(prob((rs*10)+(rd));"0",prob((rs*10)+(rd));"1",prob((rs*10));"2",prob((rs*10)-(rd));"3") if("1") output = pick(prob((rs*10)+(rd));"0",prob((rs*10)+(rd));"1",prob((rs*10)+(rd));"2",prob((rs*10));"3",prob((rs*10)-(rd));"4") if("2") output = pick(prob((rs*10));"0",prob((rs*10)+(rd));"1",prob((rs*10)+(rd));"2",prob((rs*10)+(rd));"3",prob((rs*10));"4",prob((rs*10)-(rd));"5") if("3") output = pick(prob((rs*10)-(rd));"0",prob((rs*10));"1",prob((rs*10)+(rd));"2",prob((rs*10)+(rd));"3",prob((rs*10)+(rd));"4",prob((rs*10));"5",prob((rs*10)-(rd));"6") if("4") output = pick(prob((rs*10)-(rd));"1",prob((rs*10));"2",prob((rs*10)+(rd));"3",prob((rs*10)+(rd));"4",prob((rs*10)+(rd));"5",prob((rs*10));"6",prob((rs*10)-(rd));"7") if("5") output = pick(prob((rs*10)-(rd));"2",prob((rs*10));"3",prob((rs*10)+(rd));"4",prob((rs*10)+(rd));"5",prob((rs*10)+(rd));"6",prob((rs*10));"7",prob((rs*10)-(rd));"8") if("6") output = pick(prob((rs*10)-(rd));"3",prob((rs*10));"4",prob((rs*10)+(rd));"5",prob((rs*10)+(rd));"6",prob((rs*10)+(rd));"7",prob((rs*10));"8",prob((rs*10)-(rd));"9") if("7") output = pick(prob((rs*10)-(rd));"4",prob((rs*10));"5",prob((rs*10)+(rd));"6",prob((rs*10)+(rd));"7",prob((rs*10)+(rd));"8",prob((rs*10));"9",prob((rs*10)-(rd));"A") if("8") output = pick(prob((rs*10)-(rd));"5",prob((rs*10));"6",prob((rs*10)+(rd));"7",prob((rs*10)+(rd));"8",prob((rs*10)+(rd));"9",prob((rs*10));"A",prob((rs*10)-(rd));"B") if("9") output = pick(prob((rs*10)-(rd));"6",prob((rs*10));"7",prob((rs*10)+(rd));"8",prob((rs*10)+(rd));"9",prob((rs*10)+(rd));"A",prob((rs*10));"B",prob((rs*10)-(rd));"C") if("10")//A output = pick(prob((rs*10)-(rd));"7",prob((rs*10));"8",prob((rs*10)+(rd));"9",prob((rs*10)+(rd));"A",prob((rs*10)+(rd));"B",prob((rs*10));"C",prob((rs*10)-(rd));"D") if("11")//B output = pick(prob((rs*10)-(rd));"8",prob((rs*10));"9",prob((rs*10)+(rd));"A",prob((rs*10)+(rd));"B",prob((rs*10)+(rd));"C",prob((rs*10));"D",prob((rs*10)-(rd));"E") if("12")//C output = pick(prob((rs*10)-(rd));"9",prob((rs*10));"A",prob((rs*10)+(rd));"B",prob((rs*10)+(rd));"C",prob((rs*10)+(rd));"D",prob((rs*10));"E",prob((rs*10)-(rd));"F") if("13")//D output = pick(prob((rs*10)-(rd));"A",prob((rs*10));"B",prob((rs*10)+(rd));"C",prob((rs*10)+(rd));"D",prob((rs*10)+(rd));"E",prob((rs*10));"F") if("14")//E output = pick(prob((rs*10)-(rd));"B",prob((rs*10));"C",prob((rs*10)+(rd));"D",prob((rs*10)+(rd));"E",prob((rs*10)+(rd));"F") if("15")//F output = pick(prob((rs*10)-(rd));"C",prob((rs*10));"D",prob((rs*10)+(rd));"E",prob((rs*10)+(rd));"F") if(!input || !output) //How did this happen? output = "8" return output // Use mob.UpdateAppearance() /mob/proc/UpdateAppearance(var/list/UI=null) return FALSE // Simpler. Don't specify UI in order for the mob to use its own. /mob/living/carbon/human/UpdateAppearance(var/list/UI=null) // Rebuild off UI arg if not null if(UI!=null) src.dna.UI=UI src.dna.UpdateUI() // Setup dna dna.check_integrity() dna.ApplyToMob(src) // Apply dna changes to organ icons force_update_organs() force_update_limbs() //H.update_body(0) //Done in force_update_limbs already update_eyes() update_hair() return TRUE /mob/living/carbon/human/proc/force_update_organs() for(var/obj/item/organ/O as anything in organs + internal_organs) O.data.setup_from_species(species) species.post_spawn_special(src) // Used below, simple injection modifier. /proc/probinj(var/pr, var/inj) return prob(pr+inj*pr)