diff --git a/baystation12.dme b/baystation12.dme index 2bc32743c89..5045d693c27 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -201,8 +201,8 @@ #include "code\game\area\ai_monitored.dm" #include "code\game\area\areas.dm" #include "code\game\area\Space Station 13 areas.dm" -#include "code\game\dna\dna.dm" -#include "code\game\dna\dna_misc.dm" +#include "code\game\dna\dna2.dm" +#include "code\game\dna\dna2_helpers.dm" #include "code\game\dna\dna_modifier.dm" #include "code\game\gamemodes\events.dm" #include "code\game\gamemodes\factions.dm" diff --git a/code/game/dna/dna2.dm b/code/game/dna/dna2.dm new file mode 100644 index 00000000000..0ed98732455 --- /dev/null +++ b/code/game/dna/dna2.dm @@ -0,0 +1,277 @@ +/** +* DNA 2: The Spaghetti Strikes Back +* +* @author N3X15 +*/ + +// What each index means: +#define DNA_OFF_LOWERBOUND 0 +#define DNA_OFF_UPPERBOUND 1 +#define DNA_ON_LOWERBOUND 2 +#define DNA_ON_UPPERBOUND 3 + +// Defines which values mean "on" or "off". +// This is to make some of the more OP superpowers a larger PITA to activate, +// and to tell our new DNA datum which values to set in order to turn something +// on or off. +var/global/list/dna_activity_bounds[STRUCDNASIZE] + +// Used to determine what each block means (admin hax, mostly) +var/global/list/assigned_blocks[STRUCDNASIZE] + +// UI Indices (can change to mutblock style, if desired) +#define DNA_UI_HAIR_R 0 +#define DNA_UI_HAIR_G 1 +#define DNA_UI_HAIR_B 2 +#define DNA_UI_BEARD_R 3 +#define DNA_UI_BEARD_G 4 +#define DNA_UI_BEARD_B 5 +#define DNA_UI_SKIN_TONE 6 +#define DNA_UI_EYES_R 7 +#define DNA_UI_EYES_G 8 +#define DNA_UI_EYES_B 9 +#define DNA_UI_GENDER 10 +#define DNA_UI_BEARD_STYLE 11 +#define DNA_UI_HAIR_STYLE 12 +#define DNA_UI_LENGTH 13 // Update this or you WILL break shit. + +/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 + +/datum/dna + // READ-ONLY, GETS OVERWRITTEN + // DO NOT FUCK WITH THESE OR BYOND WILL EAT YOUR FACE + var/uni_identity="" // Encoded UI + var/struc_enzymes="" // Encoded SE + var/unique_enzymes="" // MD5 of player name + + // Internal dirtiness checks + var/dirtyUI=0 + var/dirtySE=0 + + // Okay to read, but you're an idiot if you do. + // BLOCK = VALUE + var/list/SE[STRUCDNASIZE] + var/list/UI[DNA_UI_LENGTH] + + // From old dna. + var/b_type = "A+" // Should probably change to an integer => string map but I'm lazy. + var/mutantrace = null // The type of mutant race the player is, if applicable (i.e. potato-man) + var/real_name // Stores the real name of the person who originally got this dna datum. Used primarily for changelings, + +/////////////////////////////////////// +// UNIQUE IDENTITY +/////////////////////////////////////// + +/datum/dna/proc/ResetUIFrom(var/mob/living/carbon/human/character) + // INITIALIZE! + for(var/i=1,i<=DNA_UI_LENGTH,i++) + UI[i]=0 + // Hair + // FIXME: Species-specific defaults pls + if(!character.h_style) + character.h_style = "Skinhead" + var/hair = hair_styles_list.Find(character.h_style) + + // Facial Hair + if(!character.f_style) + character.f_style = "Shaved" + var/beard = facial_hair_styles_list.Find(character.f_style) + + var/gender + if(character.gender == MALE) + gender = rand(1,(2050+BLOCKADD)) + else + gender = rand((2051+BLOCKADD),4094) + + SetUIValue(DNA_UI_HAIR_R, character.r_hair, 1) + SetUIValue(DNA_UI_HAIR_G, character.g_hair, 1) + SetUIValue(DNA_UI_HAIR_B, character.b_hair, 1) + SetUIValue(DNA_UI_BEARD_R, character.r_facial, 1) + SetUIValue(DNA_UI_BEARD_G, character.g_facial, 1) + SetUIValue(DNA_UI_BEARD_B, character.b_facial, 1) + SetUIValue(DNA_UI_SKIN_TONE,(character.s_tone + 220) * 16, 1) + SetUIValue(DNA_UI_BEARD_R, character.r_eyes, 1) + SetUIValue(DNA_UI_BEARD_G, character.g_eyes, 1) + SetUIValue(DNA_UI_BEARD_B, character.b_eyes, 1) + SetUIValue(DNA_UI_GENDER, gender, 1) + + SetUIValueRange(DNA_UI_HAIR_STYLE, hair, hair_styles_list.len, 1) + SetUIValueRange(DNA_UI_BEARD_STYLE, beard, facial_hair_styles_list.len,1) + + UpdateUI() + +// Set a DNA UI block's raw value. +/datum/dna/proc/SetUIValue(var/block,var/value,var/defer=0) + ASSERT(value>0) + ASSERT(value<4095) + UI[block]=value + if(defer) + dirtyUI=1 + else + UpdateUI() + +// Get a DNA UI block's raw value. +/datum/dna/proc/GetUIValue(var/block) + return UI[block] + +// Set a DNA UI block's value, given a value and a max possible value. +// Used in hair and facial styles (value being the index and maxvalue being the len of the hairstyle list) +/datum/dna/proc/SetUIValueRange(var/block,var/value,var/maxvalue) + ASSERT(maxvalue<4095) + var/range = round(4095 / maxvalue) + if(value) + SetUIValue(block,value * range - rand(1,range-1)) + +/datum/dna/proc/GetUIValueRange(var/block,var/maxvalue) + var/value = GetUIValue(block) + return round(1 +(value / 4096)*maxvalue) + +/datum/dna/proc/GetUIState(var/block) + return UI[block] > 2050 + +/datum/dna/proc/SetUIState(var/block,var/on,var/defer=0) + var/val + if(on) + val=rand(2050,4095) + else + val=rand(1,2049) + SetUIValue(block,val,defer) + +/datum/dna/proc/GetUIBlock(var/block) + return EncodeBlockValue(GetUIValue(block)) + +// Do not use this unless you absolutely have to. +/datum/dna/proc/SetUIBlock(var/block,var/value,var/defer=0) + return SetUIValue(block,hex2num(value),defer) + +/datum/dna/proc/GetUISubBlock(var/block,var/subBlock) + return copytext(GetUIBlock(block),subBlock,subBlock+1) + +/datum/dna/proc/SetUISubBlock(var/block,var/subBlock, var/newSubBlock, var/defer=0) + var/oldBlock=GetUIBlock(block) + var/newBlock="" + for(var/i=1, i<=length(oldBlock), i++) + if(i==subBlock) + newBlock+=newSubBlock + else + newBlock+=copytext(oldBlock,i,i+1) + SetUIBlock(block,newBlock,defer) + +/////////////////////////////////////// +// STRUCTURAL ENZYMES +/////////////////////////////////////// + +// Zeroes out all of the blocks. +/datum/dna/proc/ResetSE() + for(var/i = 1, i <= STRUCDNASIZE, i++) + SetSEValue(i,rand(1,1024),1) + + UpdateSE() + +// Set a DNA SE block's raw value. +/datum/dna/proc/SetSEValue(var/block,var/value,var/defer=0) + ASSERT(value>0) + ASSERT(value<4095) + SE[block]=value + if(defer) + dirtySE=1 + else + UpdateSE() + +// Get a DNA SE block's raw value. +/datum/dna/proc/GetSEValue(var/block) + return UI[block] + +// Set a DNA SE block's value, given a value and a max possible value. +// Might be used for species? +/datum/dna/proc/SetSEValueRange(var/block,var/value,var/maxvalue) + ASSERT(maxvalue<4095) + var/range = round(4095 / maxvalue) + if(value) + SetSEValue(block, value * range - rand(1,range-1)) + +/datum/dna/proc/GetSEState(var/block) + var/list/BOUNDS=dna_activity_bounds[block] + var/value=GetSEValue(block) + return (value > BOUNDS[DNA_ON_LOWERBOUND]) + +/datum/dna/proc/SetSEState(var/block,var/on,var/defer=0) + var/list/BOUNDS=dna_activity_bounds[block] + var/val + if(on) + val=rand(BOUNDS[DNA_ON_LOWERBOUND],BOUNDS[DNA_ON_UPPERBOUND]) + else + val=rand(BOUNDS[DNA_OFF_LOWERBOUND],BOUNDS[DNA_OFF_UPPERBOUND]) + SetSEValue(block,val,defer) + +/datum/dna/proc/GetSEBlock(var/block) + return EncodeBlockValue(GetSEValue(block)) + +// Do not use this unless you absolutely have to. +/datum/dna/proc/SetSEBlock(var/block,var/value,var/defer=0) + return SetSEValue(block,hex2num(value),defer) + +/datum/dna/proc/GetSESubBlock(var/block,var/subBlock) + return copytext(GetSEBlock(block),subBlock,subBlock+1) + +/datum/dna/proc/SetSESubBlock(var/block,var/subBlock, var/newSubBlock, var/defer=0) + var/oldBlock=GetSEBlock(block) + var/newBlock="" + for(var/i=1, i<=length(oldBlock), i++) + if(i==subBlock) + newBlock+=newSubBlock + else + newBlock+=copytext(oldBlock,i,i+1) + SetSEBlock(block,newBlock,defer) + + +/datum/dna/proc/EncodeBlockValue(var/value) + return add_zero2(num2hex(value,1), 3) + +/datum/dna/proc/UpdateUI() + src.unique_enzymes="" + for(var/block in UI) + unique_enzymes += EncodeBlockValue(block) + dirtyUI=0 + +/datum/dna/proc/UpdateSE() + struc_enzymes="" + for(var/block in SE) + struc_enzymes += EncodeBlockValue(block) + dirtySE=0 + +// BACK-COMPAT! +// Just checks our character has all the crap it needs. +/datum/dna/proc/check_integrity(var/mob/living/carbon/human/character) + if(character) + if(UI.len != DNA_UI_LENGTH) + ResetUIFrom(character) + + if(length(struc_enzymes)!= 3*STRUCDNASIZE) + ResetSE() + + if(length(unique_enzymes) != 32) + unique_enzymes = md5(character.real_name) + else + if(length(uni_identity) != 3*DNA_UI_LENGTH) + uni_identity = "00600200A00E0110148FC01300B0095BD7FD3F4" + if(length(struc_enzymes)!= 3*STRUCDNASIZE) + struc_enzymes = "43359156756131E13763334D1C369012032164D4FE4CD61544B6C03F251B6C60A42821D26BA3B0FD6" + +// BACK-COMPAT! +// Initial DNA setup. I'm kind of wondering why the hell this doesn't just call the above. +/datum/dna/proc/ready_dna(mob/living/carbon/human/character) + ResetUIFrom(character) + + ResetSE() + + unique_enzymes = md5(character.real_name) + reg_dna[unique_enzymes] = character.real_name + diff --git a/code/game/dna/dna2_helpers.dm b/code/game/dna/dna2_helpers.dm new file mode 100644 index 00000000000..4910a9cf011 --- /dev/null +++ b/code/game/dna/dna2_helpers.dm @@ -0,0 +1,436 @@ + +// Random Bad Mutation +/proc/randmutb(var/mob/living/M) + if(!M) return + M.dna.check_integrity() + var/block = pick(GLASSESBLOCK,COUGHBLOCK,FAKEBLOCK,NERVOUSBLOCK,CLUMSYBLOCK,TWITCHBLOCK,HEADACHEBLOCK,BLINDBLOCK,DEAFBLOCK,HALLUCINATIONBLOCK) + M.dna.SetSEState(block, 1) + +// Random Good Mutation +/proc/randmutg(var/mob/living/M) + if(!M) return + M.dna.check_integrity() + var/block = pick(HULKBLOCK,XRAYBLOCK,FIREBLOCK,TELEBLOCK,NOBREATHBLOCK,REMOTEVIEWBLOCK,REGENERATEBLOCK,INCREASERUNBLOCK,REMOTETALKBLOCK,MORPHBLOCK,NOPRINTSBLOCK,SHOCKIMMUNITYBLOCK,SMALLSIZEBLOCK) + M.dna.SetSEState(block, 1) + +// Random Appearance Mutation +/proc/randmuti(var/mob/living/M) + if(!M) return + M.dna.check_integrity() + M.dna.SetUIValue(rand(1,UNIDNASIZE),rand(1,4095)) + +// Scramble UI or SE. +/proc/scramble(var/UI, var/mob/M, var/prob) + if(!M) return + M.dna.check_integrity() + if(UI) + for(var/i = 1, i <= DNA_UI_LENGTH-1, i++) + if(prob(prob)) + M.dna.SetUIValue(i,rand(1,4095),1) + M.dna.UpdateUI() + updateappearance(M, M.dna.uni_identity) + + else + for(var/i = 1, i <= STRUCDNASIZE-1, i++) + if(prob(prob)) + M.dna.SetSEValue(i,rand(1,4095),1) + M.dna.UpdateSE() + domutcheck(M, null) + 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 + + +/proc/updateappearance(var/mob/M, var/datum/dna/dna) + if(istype(M, /mob/living/carbon/human)) + M.dna.check_integrity() + var/mob/living/carbon/human/H = M + H.r_hair = dna.GetUIValue(DNA_UI_HAIR_R) + H.b_hair = dna.GetUIValue(DNA_UI_HAIR_B) + H.g_hair = dna.GetUIValue(DNA_UI_HAIR_G) + H.r_facial = dna.GetUIValue(DNA_UI_BEARD_R) + H.b_facial = dna.GetUIValue(DNA_UI_BEARD_B) + H.g_facial = dna.GetUIValue(DNA_UI_BEARD_G) + H.s_tone = round((dna.GetUIValue(DNA_UI_SKIN_TONE) / 16) - 220) + H.r_eyes = dna.GetUIValue(DNA_UI_EYES_R) + H.g_eyes = dna.GetUIValue(DNA_UI_EYES_G) + H.b_eyes = dna.GetUIValue(DNA_UI_EYES_B) + + if (dna.GetUIState(DNA_UI_GENDER)) + H.gender = FEMALE + else + H.gender = MALE + + //Hair + var/hair = dna.GetUIValueRange(DNA_UI_HAIR_STYLE,hair_styles_list.len) + if((0 < hair) && (hair <= hair_styles_list.len)) + H.h_style = hair_styles_list[hair] + + //Facial Hair + var/beard = dna.GetUIValueRange(DNA_UI_BEARD_STYLE,facial_hair_styles_list.len) + if((0 < beard) && (beard <= facial_hair_styles_list.len)) + H.f_style = facial_hair_styles_list[beard] + + H.update_body(0) + H.update_hair() + + return 1 + else + return 0 + +/proc/probinj(var/pr, var/inj) + return prob(pr+inj*pr) + +/proc/domutcheck(mob/living/M as mob, connected, inj) + if (!M) return + + M.dna.check_integrity() + + M.disabilities = 0 + M.sdisabilities = 0 + var/old_mutations = M.mutations + M.mutations = list() + M.pass_flags = 0 +// M.see_in_dark = 2 +// M.see_invisible = 0 + + if(PLANT in old_mutations) + M.mutations.Add(PLANT) + if(SKELETON in old_mutations) + M.mutations.Add(SKELETON) + if(FAT in old_mutations) + M.mutations.Add(FAT) + if(HUSK in old_mutations) + M.mutations.Add(HUSK) + + if(M.dna.GetSEState(NOBREATHBLOCK)) + if(probinj(45,inj) || (mNobreath in old_mutations)) + M << "\blue You feel no need to breathe." + M.mutations.Add(mNobreath) + if(M.dna.GetSEState(REMOTEVIEWBLOCK)) + if(probinj(45,inj) || (mRemote in old_mutations)) + M << "\blue Your mind expands" + M.mutations.Add(mRemote) + M.verbs += /mob/living/carbon/human/proc/remoteobserve + if(M.dna.GetSEState(REGENERATEBLOCK)) + if(probinj(45,inj) || (mRegen in old_mutations)) + M << "\blue You feel better" + M.mutations.Add(mRegen) + if(M.dna.GetSEState(INCREASERUNBLOCK)) + if(probinj(45,inj) || (mRun in old_mutations)) + M << "\blue Your leg muscles pulsate." + M.mutations.Add(mRun) + if(M.dna.GetSEState(REMOTETALKBLOCK)) + if(probinj(45,inj) || (mRemotetalk in old_mutations)) + M << "\blue You expand your mind outwards" + M.mutations.Add(mRemotetalk) + M.verbs += /mob/living/carbon/human/proc/remotesay + if(M.dna.GetSEState(MORPHBLOCK)) + if(probinj(45,inj) || (mMorph in old_mutations)) + M.mutations.Add(mMorph) + M << "\blue Your skin feels strange" + M.verbs += /mob/living/carbon/human/proc/morph + if(M.dna.GetSEState(HALLUCINATIONBLOCK)) + if(probinj(45,inj) || (mHallucination in old_mutations)) + M.mutations.Add(mHallucination) + M << "\red Your mind says 'Hello'" + if(M.dna.GetSEState(NOPRINTSBLOCK)) + if(probinj(45,inj) || (mFingerprints in old_mutations)) + M.mutations.Add(mFingerprints) + M << "\blue Your fingers feel numb" + if(M.dna.GetSEState(SHOCKIMMUNITYBLOCK)) + if(probinj(45,inj) || (mShock in old_mutations)) + M.mutations.Add(mShock) + M << "\blue Your skin feels strange" + if(M.dna.GetSEState(SMALLSIZEBLOCK)) + if(probinj(45,inj) || (mSmallsize in old_mutations)) + M << "\blue Your skin feels rubbery" + M.mutations.Add(mSmallsize) + M.pass_flags |= 1 + + + + if (M.dna.GetSEState(HULKBLOCK)) + if(probinj(5,inj) || (HULK in old_mutations)) + M << "\blue Your muscles hurt." + M.mutations.Add(HULK) + if (M.dna.GetSEState(HEADACHEBLOCK)) + M.disabilities |= EPILEPSY + M << "\red You get a headache." + if (M.dna.GetSEState(FAKEBLOCK)) + M << "\red You feel strange." + if (prob(95)) + if(prob(50)) + randmutb(M) + else + randmuti(M) + else + randmutg(M) + if (M.dna.GetSEState(COUGHBLOCK)) + M.disabilities |= COUGHING + M << "\red You start coughing." + if (M.dna.GetSEState(CLUMSYBLOCK)) + M << "\red You feel lightheaded." + M.mutations.Add(CLUMSY) + if (M.dna.GetSEState(TWITCHBLOCK)) + M.disabilities |= TOURETTES + M << "\red You twitch." + if (M.dna.GetSEState(XRAYBLOCK)) + if(probinj(30,inj) || (XRAY in old_mutations)) + M << "\blue The walls suddenly disappear." +// M.sight |= (SEE_MOBS|SEE_OBJS|SEE_TURFS) +// M.see_in_dark = 8 +// M.see_invisible = 2 + M.mutations.Add(XRAY) + if (M.dna.GetSEState(NERVOUSBLOCK)) + M.disabilities |= NERVOUS + M << "\red You feel nervous." + if (M.dna.GetSEState(FIREBLOCK)) + if(probinj(30,inj) || (COLD_RESISTANCE in old_mutations)) + M << "\blue Your body feels warm." + M.mutations.Add(COLD_RESISTANCE) + if (M.dna.GetSEState(BLINDBLOCK)) + M.sdisabilities |= BLIND + M << "\red You can't seem to see anything." + if (M.dna.GetSEState(TELEBLOCK)) + if(probinj(15,inj) || (TK in old_mutations)) + M << "\blue You feel smarter." + M.mutations.Add(TK) + if (M.dna.GetSEState(DEAFBLOCK)) + M.sdisabilities |= DEAF + M.ear_deaf = 1 + M << "\red Its kinda quiet.." + if (M.dna.GetSEState(GLASSESBLOCK)) + M.disabilities |= NEARSIGHTED + M << "Your eyes feel weird..." + + /* If you want the new mutations to work, UNCOMMENT THIS. + if(istype(M, /mob/living/carbon)) + for (var/datum/mutations/mut in global_mutations) + mut.check_mutation(M) + */ + +//////////////////////////////////////////////////////////// Monkey Block + if (M.dna.GetSEState(MONKEYBLOCK) && istype(M, /mob/living/carbon/human)) + // human > monkey + var/mob/living/carbon/human/H = M + H.monkeyizing = 1 + var/list/implants = list() //Try to preserve implants. + for(var/obj/item/weapon/implant/W in H) + implants += W + W.loc = null + + if(!connected) + for(var/obj/item/W in (H.contents-implants)) + if (W==H.w_uniform) // will be teared + continue + H.drop_from_inventory(W) + M.monkeyizing = 1 + M.canmove = 0 + M.icon = null + M.invisibility = 101 + var/atom/movable/overlay/animation = new( M.loc ) + animation.icon_state = "blank" + animation.icon = 'icons/mob/mob.dmi' + animation.master = src + flick("h2monkey", animation) + sleep(48) + del(animation) + + + var/mob/living/carbon/monkey/O = null + if(H.species.primitive) + O = new H.species.primitive(src) + else + H.gib() //Trying to change the species of a creature with no primitive var set is messy. + return + + if(M) + if (M.dna) + O.dna = M.dna + M.dna = null + + if (M.suiciding) + O.suiciding = M.suiciding + M.suiciding = null + + + for(var/datum/disease/D in M.viruses) + O.viruses += D + D.affected_mob = O + M.viruses -= D + + + for(var/obj/T in (M.contents-implants)) + del(T) + + O.loc = M.loc + + if(M.mind) + M.mind.transfer_to(O) //transfer our mind to the cute little monkey + + if (connected) //inside dna thing + var/obj/machinery/dna_scannernew/C = connected + O.loc = C + C.occupant = O + connected = null + O.real_name = text("monkey ([])",copytext(md5(M.real_name), 2, 6)) + O.take_overall_damage(M.getBruteLoss() + 40, M.getFireLoss()) + O.adjustToxLoss(M.getToxLoss() + 20) + O.adjustOxyLoss(M.getOxyLoss()) + O.stat = M.stat + O.a_intent = "hurt" + for (var/obj/item/weapon/implant/I in implants) + I.loc = O + I.implanted = O +// O.update_icon = 1 //queue a full icon update at next life() call + del(M) + return + + if (!M.dna.GetSEState(MONKEYBLOCK) && !istype(M, /mob/living/carbon/human)) + // monkey > human, + var/mob/living/carbon/monkey/Mo = M + Mo.monkeyizing = 1 + var/list/implants = list() //Still preserving implants + for(var/obj/item/weapon/implant/W in Mo) + implants += W + W.loc = null + if(!connected) + for(var/obj/item/W in (Mo.contents-implants)) + Mo.drop_from_inventory(W) + M.monkeyizing = 1 + M.canmove = 0 + M.icon = null + M.invisibility = 101 + var/atom/movable/overlay/animation = new( M.loc ) + animation.icon_state = "blank" + animation.icon = 'icons/mob/mob.dmi' + animation.master = src + flick("monkey2h", animation) + sleep(48) + del(animation) + + var/mob/living/carbon/human/O = new( src ) + if(Mo.greaterform) + O.set_species(Mo.greaterform) + + if (M.dna.GetUIState(DNA_UI_GENDER)) + O.gender = FEMALE + else + O.gender = MALE + + if (M) + if (M.dna) + O.dna = M.dna + M.dna = null + + if (M.suiciding) + O.suiciding = M.suiciding + M.suiciding = null + + for(var/datum/disease/D in M.viruses) + O.viruses += D + D.affected_mob = O + M.viruses -= D + + //for(var/obj/T in M) + // del(T) + + O.loc = M.loc + + if(M.mind) + M.mind.transfer_to(O) //transfer our mind to the human + + if (connected) //inside dna thing + var/obj/machinery/dna_scannernew/C = connected + O.loc = C + C.occupant = O + connected = null + + var/i + while (!i) + var/randomname + if (O.gender == MALE) + randomname = capitalize(pick(first_names_male) + " " + capitalize(pick(last_names))) + else + randomname = capitalize(pick(first_names_female) + " " + capitalize(pick(last_names))) + if (findname(randomname)) + continue + else + O.real_name = randomname + i++ + updateappearance(O,O.dna.uni_identity) + O.take_overall_damage(M.getBruteLoss(), M.getFireLoss()) + O.adjustToxLoss(M.getToxLoss()) + O.adjustOxyLoss(M.getOxyLoss()) + O.stat = M.stat + for (var/obj/item/weapon/implant/I in implants) + I.loc = O + I.implanted = O +// O.update_icon = 1 //queue a full icon update at next life() call + del(M) + return +//////////////////////////////////////////////////////////// Monkey Block + if(M) + M.update_icon = 1 //queue a full icon update at next life() call + return null +/////////////////////////// DNA MISC-PROCS \ No newline at end of file diff --git a/code/game/dna/dna_modifier.dm b/code/game/dna/dna_modifier.dm index f1aa2510d2c..e76862a9fe0 100644 --- a/code/game/dna/dna_modifier.dm +++ b/code/game/dna/dna_modifier.dm @@ -574,10 +574,7 @@ return 1 // return 1 forces an update to all Nano uis attached to src if (href_list["pulseUIRadiation"]) - var/block - var/newblock - var/tstructure2 - block = getblock(getblock(src.connected.occupant.dna.uni_identity,src.selected_ui_block,DNA_BLOCK_SIZE),src.selected_ui_subblock,1) + var/block = src.connected.occupant.dna.GetUISubBlock(src.selected_ui_block,src.selected_ui_subblock) irradiating = src.radiation_duration var/lock_state = src.connected.locked @@ -593,12 +590,7 @@ if (prob((80 + (src.radiation_duration / 2)))) block = miniscrambletarget(num2text(selected_ui_target), src.radiation_intensity, src.radiation_duration) - newblock = null - if (src.selected_ui_subblock == 1) newblock = block + getblock(getblock(src.connected.occupant.dna.uni_identity,src.selected_ui_block,DNA_BLOCK_SIZE),2,1) + getblock(getblock(src.connected.occupant.dna.uni_identity,src.selected_ui_block,DNA_BLOCK_SIZE),3,1) - if (src.selected_ui_subblock == 2) newblock = getblock(getblock(src.connected.occupant.dna.uni_identity,src.selected_ui_block,DNA_BLOCK_SIZE),1,1) + block + getblock(getblock(src.connected.occupant.dna.uni_identity,src.selected_ui_block,DNA_BLOCK_SIZE),3,1) - if (src.selected_ui_subblock == 3) newblock = getblock(getblock(src.connected.occupant.dna.uni_identity,src.selected_ui_block,DNA_BLOCK_SIZE),1,1) + getblock(getblock(src.connected.occupant.dna.uni_identity,src.selected_ui_block,DNA_BLOCK_SIZE),2,1) + block - tstructure2 = setblock(src.connected.occupant.dna.uni_identity, src.selected_ui_block, newblock,DNA_BLOCK_SIZE) - src.connected.occupant.dna.uni_identity = tstructure2 + src.connected.occupant.dna.SetUISubBlock(src.selected_ui_block,src.selected_ui_subblock,block) updateappearance(src.connected.occupant,src.connected.occupant.dna.uni_identity) src.connected.occupant.radiation += (src.radiation_intensity+src.radiation_duration) else @@ -639,11 +631,8 @@ if (href_list["pulseSERadiation"]) var/block - var/newblock - var/tstructure2 var/oldblock - - block = getblock(getblock(src.connected.occupant.dna.struc_enzymes,src.selected_se_block,DNA_BLOCK_SIZE),src.selected_se_subblock,1) + block = src.connected.occupant.dna.GetSESubBlock(src.selected_se_block,src.selected_se_subblock) irradiating = src.radiation_duration var/lock_state = src.connected.locked @@ -656,31 +645,22 @@ if(src.connected.occupant) if (prob((80 + (src.radiation_duration / 2)))) + // FIXME: Find out what these corresponded to and change them to the WHATEVERBLOCK they need to be. if ((src.selected_se_block != 2 || src.selected_se_block != 12 || src.selected_se_block != 8 || src.selected_se_block || 10) && prob (20)) oldblock = src.selected_se_block block = miniscramble(block, src.radiation_intensity, src.radiation_duration) - newblock = null if (src.selected_se_block > 1 && src.selected_se_block < STRUCDNASIZE/2) src.selected_se_block++ else if (src.selected_se_block > STRUCDNASIZE/2 && src.selected_se_block < STRUCDNASIZE) src.selected_se_block-- - if (src.selected_se_subblock == 1) newblock = block + getblock(getblock(src.connected.occupant.dna.struc_enzymes,src.selected_se_block,DNA_BLOCK_SIZE),2,1) + getblock(getblock(src.connected.occupant.dna.struc_enzymes,src.selected_se_block,DNA_BLOCK_SIZE),3,1) - if (src.selected_se_subblock == 2) newblock = getblock(getblock(src.connected.occupant.dna.struc_enzymes,src.selected_se_block,DNA_BLOCK_SIZE),1,1) + block + getblock(getblock(src.connected.occupant.dna.struc_enzymes,src.selected_se_block,DNA_BLOCK_SIZE),3,1) - if (src.selected_se_subblock == 3) newblock = getblock(getblock(src.connected.occupant.dna.struc_enzymes,src.selected_se_block,DNA_BLOCK_SIZE),1,1) + getblock(getblock(src.connected.occupant.dna.struc_enzymes,src.selected_se_block,DNA_BLOCK_SIZE),2,1) + block - tstructure2 = setblock(src.connected.occupant.dna.struc_enzymes, src.selected_se_block, newblock,DNA_BLOCK_SIZE) - src.connected.occupant.dna.struc_enzymes = tstructure2 + src.connected.occupant.dna.SetSESubBlock(src.selected_ui_block,src.selected_ui_subblock,block) domutcheck(src.connected.occupant,src.connected) src.connected.occupant.radiation += (src.radiation_intensity+src.radiation_duration) src.selected_se_block = oldblock else // block = miniscramble(block, src.radiation_intensity, src.radiation_duration) - newblock = null - if (src.selected_se_subblock == 1) newblock = block + getblock(getblock(src.connected.occupant.dna.struc_enzymes,src.selected_se_block,DNA_BLOCK_SIZE),2,1) + getblock(getblock(src.connected.occupant.dna.struc_enzymes,src.selected_se_block,DNA_BLOCK_SIZE),3,1) - if (src.selected_se_subblock == 2) newblock = getblock(getblock(src.connected.occupant.dna.struc_enzymes,src.selected_se_block,DNA_BLOCK_SIZE),1,1) + block + getblock(getblock(src.connected.occupant.dna.struc_enzymes,src.selected_se_block,DNA_BLOCK_SIZE),3,1) - if (src.selected_se_subblock == 3) newblock = getblock(getblock(src.connected.occupant.dna.struc_enzymes,src.selected_se_block,DNA_BLOCK_SIZE),1,1) + getblock(getblock(src.connected.occupant.dna.struc_enzymes,src.selected_se_block,DNA_BLOCK_SIZE),2,1) + block - tstructure2 = setblock(src.connected.occupant.dna.struc_enzymes, src.selected_se_block, newblock,DNA_BLOCK_SIZE) - src.connected.occupant.dna.struc_enzymes = tstructure2 + src.connected.occupant.dna.SetSESubBlock(src.selected_ui_block,src.selected_ui_subblock,block) domutcheck(src.connected.occupant,src.connected) src.connected.occupant.radiation += (src.radiation_intensity+src.radiation_duration) else diff --git a/code/game/gamemodes/changeling/changeling_powers.dm b/code/game/gamemodes/changeling/changeling_powers.dm index 64b8ba9dbea..8e1640e9056 100644 --- a/code/game/gamemodes/changeling/changeling_powers.dm +++ b/code/game/gamemodes/changeling/changeling_powers.dm @@ -322,7 +322,7 @@ W.layer = initial(W.layer) var/mob/living/carbon/human/O = new /mob/living/carbon/human( src ) - if (isblockon(getblock(C.dna.uni_identity, 11,3),11)) + if (C.dna.GetUIState(DNA_UI_GENDER)) O.gender = FEMALE else O.gender = MALE diff --git a/code/game/gamemodes/setupgame.dm b/code/game/gamemodes/setupgame.dm index 8d617491939..b591359b7c8 100644 --- a/code/game/gamemodes/setupgame.dm +++ b/code/game/gamemodes/setupgame.dm @@ -1,9 +1,10 @@ -var/global/list/assigned_blocks[STRUCDNASIZE] -/proc/getAssignedBlock(var/name,var/list/blocksLeft) + +/proc/getAssignedBlock(var/name,var/list/blocksLeft, var/activity_bounds=list(1,2049,2050,4095)) var/assigned = pick(blocksLeft) blocksLeft.Remove(assigned) assigned_blocks[assigned]=name + dna_activity_bounds[assigned]=activity_bounds //Debug message_admins("[name] assigned to block #[assigned].") testing("[name] assigned to block #[assigned].") return assigned @@ -14,46 +15,10 @@ var/global/list/assigned_blocks[STRUCDNASIZE] BLOCKADD = rand(-300,300) if (prob(75)) DIFFMUT = rand(0,20) -/* - var/list/avnums = new/list() - var/tempnum - - avnums.Add(2) - avnums.Add(12) - avnums.Add(10) - avnums.Add(8) - avnums.Add(4) - avnums.Add(11) - avnums.Add(13) - avnums.Add(6) - - tempnum = pick(avnums) - avnums.Remove(tempnum) - HULKBLOCK = tempnum - tempnum = pick(avnums) - avnums.Remove(tempnum) - TELEBLOCK = tempnum - tempnum = pick(avnums) - avnums.Remove(tempnum) - FIREBLOCK = tempnum - tempnum = pick(avnums) - avnums.Remove(tempnum) - XRAYBLOCK = tempnum - tempnum = pick(avnums) - avnums.Remove(tempnum) - CLUMSYBLOCK = tempnum - tempnum = pick(avnums) - avnums.Remove(tempnum) - FAKEBLOCK = tempnum - tempnum = pick(avnums) - avnums.Remove(tempnum) - DEAFBLOCK = tempnum - tempnum = pick(avnums) - avnums.Remove(tempnum) - BLINDBLOCK = tempnum -*/ //Thanks to nexis for the fancy code +// BITCH I AIN'T DONE YET + var/list/numsToAssign=new() for(var/i=1;i BOUNDS[DNA_ON_LOWERBOUND] + +/obj/item/weapon/dnainjector/proc/SetState(var/on, var/selblock=0) + var/real_block + if(!selblock) + real_block=block + selblock=1 + else + real_block=selblock + var/list/BOUNDS=dna_activity_bounds[real_block] + var/val + if(on) + val=rand(BOUNDS[DNA_ON_LOWERBOUND],BOUNDS[DNA_ON_UPPERBOUND]) + else + val=rand(BOUNDS[DNA_OFF_LOWERBOUND],BOUNDS[DNA_OFF_UPPERBOUND]) + dna[selblock]=val + +/obj/item/weapon/dnainjector/proc/GetValue(var/block=1) + return dna[block] + /obj/item/weapon/dnainjector/proc/inject(mob/M as mob, mob/user as mob) if(istype(M,/mob/living)) M.radiation += rand(5,20) @@ -29,26 +57,29 @@ if (dnatype == "ui") if (!block) //isolated block? if (ue) //unique enzymes? yes - M.dna.uni_identity = dna + M.dna.UI = dna + M.dna.UpdateUI() updateappearance(M, M.dna.uni_identity) M.real_name = ue M.name = ue uses-- else //unique enzymes? no - M.dna.uni_identity = dna + M.dna.UI = dna + M.dna.UpdateUI() updateappearance(M, M.dna.uni_identity) uses-- else - M.dna.uni_identity = setblock(M.dna.uni_identity,block,dna,3) + M.dna.SetUIValue(block,src.GetValue()) updateappearance(M, M.dna.uni_identity) uses-- if (dnatype == "se") if (!block) //isolated block? - M.dna.struc_enzymes = dna + M.dna.SE = dna + M.dna.UpdateSE() domutcheck(M, null) uses-- else - M.dna.struc_enzymes = setblock(M.dna.struc_enzymes,block,dna,3) + M.dna.SetUIValue(block,src.GetValue()) domutcheck(M, null,1) uses-- if(prob(5)) @@ -91,11 +122,21 @@ inuse = 0 M.requests += O if (dnatype == "se") - if (isblockon(getblock(dna, 14,3),14) && istype(M, /mob/living/carbon/human)) - msg_admin_attack("[key_name_admin(user)] injected [key_name_admin(M)] with the [name] \red(MONKEY) (JMP)") - else - // message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name]") - log_attack("[key_name(user)] injected [key_name(M)] with the [name]") + if(!block) + if (GetState(MONKEYBLOCK) && istype(M, /mob/living/carbon/human) ) + message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name] \red(MONKEY)") + log_attack("[key_name(user)] injected [key_name(M)] with the [name] (MONKEY)") + log_game("[key_name_admin(user)] injected [key_name_admin(M)] with the [name] \red(MONKEY)") + else + // message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name]") + log_attack("[key_name(user)] injected [key_name(M)] with the [name]") + else // Isolated injector + if (GetState() && block == MONKEYBLOCK && istype(M, /mob/living/carbon/human) ) + message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the Isolated [name] \red(MONKEY)") + log_attack("[key_name(user)] injected [key_name(M)] with the Isolated [name] (MONKEY)") + log_game("[key_name_admin(user)] injected [key_name_admin(M)] with the Isolated [name] \red(MONKEY)") + else + log_attack("[key_name(user)] injected [key_name(M)] with the Isolated [name]") else // message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name]") log_attack("[key_name(user)] injected [key_name(M)] with the [name]") @@ -113,7 +154,7 @@ user << "\red Apparently it didn't work." return if (dnatype == "se") - if (isblockon(getblock(dna, 14,3),14) && istype(M, /mob/living/carbon/human)) + if (GetState(MONKEYBLOCK) && istype(M, /mob/living/carbon/human)) message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name] \red(MONKEY)") log_game("[key_name(user)] injected [key_name(M)] with the [name] (MONKEY)") else @@ -144,7 +185,7 @@ name = "DNA-Injector (Anti-Hulk)" desc = "Cures green skin." dnatype = "se" - dna = "708" + dna = list(4090) //block = 2 New() ..() @@ -154,7 +195,7 @@ name = "DNA-Injector (Hulk)" desc = "This will make you big and strong, but give you a bad skin condition." dnatype = "se" - dna = "FED" + dna = list(1) //block = 2 New() ..() @@ -164,7 +205,7 @@ name = "DNA-Injector (Xray)" desc = "Finally you can see what the Captain does." dnatype = "se" - dna = "FED" + dna = list(4090) //block = 8 New() ..() @@ -174,60 +215,279 @@ name = "DNA-Injector (Anti-Xray)" desc = "It will make you see harder." dnatype = "se" - dna = "708" + dna = list(1) //block = 8 New() ..() block = XRAYBLOCK + +/obj/item/weapon/dnainjector/firemut + name = "DNA-Injector (Fire)" + desc = "Gives you fire." + dnatype = "se" + dna = list(4090) + //block = 10 + New() + ..() + block = FIREBLOCK + +/obj/item/weapon/dnainjector/antifire + name = "DNA-Injector (Anti-Fire)" + desc = "Cures fire." + dnatype = "se" + dna = list(1) + //block = 10 + New() + ..() + block = FIREBLOCK + +/obj/item/weapon/dnainjector/telemut + name = "DNA-Injector (Tele.)" + desc = "Super brain man!" + dnatype = "se" + dna = list(4090) + //block = 12 + New() + ..() + block = TELEBLOCK + +/obj/item/weapon/dnainjector/antitele + name = "DNA-Injector (Anti-Tele.)" + desc = "Will make you not able to control your mind." + dnatype = "se" + dna = list(1) + //block = 12 + New() + ..() + block = TELEBLOCK + +/obj/item/weapon/dnainjector/nobreath + name = "DNA-Injector (No Breath)" + desc = "Hold your breath and count to infinity." + dnatype = "se" + dna = list(4090) + //block = 2 + New() + ..() + block = NOBREATHBLOCK + +/obj/item/weapon/dnainjector/antinobreath + name = "DNA-Injector (Anti-No Breath)" + desc = "Hold your breath and count to 100." + dnatype = "se" + dna = list(1) + //block = 2 + New() + ..() + block = NOBREATHBLOCK + +/obj/item/weapon/dnainjector/remoteview + name = "DNA-Injector (Remote View)" + desc = "Stare into the distance for a reason." + dnatype = "se" + dna = list(4090) + //block = 2 + New() + ..() + block = REMOTEVIEWBLOCK + +/obj/item/weapon/dnainjector/antiremoteview + name = "DNA-Injector (Anti-Remote View)" + desc = "Cures green skin." + dnatype = "se" + dna = list(1) + //block = 2 + New() + ..() + block = REMOTEVIEWBLOCK + +/obj/item/weapon/dnainjector/regenerate + name = "DNA-Injector (Regeneration)" + desc = "Healthy but hungry." + dnatype = "se" + dna = list(4090) + //block = 2 + New() + ..() + block = REGENERATEBLOCK + +/obj/item/weapon/dnainjector/antiregenerate + name = "DNA-Injector (Anti-Regeneration)" + desc = "Sickly but sated." + dnatype = "se" + dna = list(1) + //block = 2 + New() + ..() + block = REGENERATEBLOCK + +/obj/item/weapon/dnainjector/runfast + name = "DNA-Injector (Increase Run)" + desc = "Running Man." + dnatype = "se" + dna = list(4090) + //block = 2 + New() + ..() + block = INCREASERUNBLOCK + +/obj/item/weapon/dnainjector/antirunfast + name = "DNA-Injector (Anti-Increase Run)" + desc = "Walking Man." + dnatype = "se" + dna = list(1) + //block = 2 + New() + ..() + block = INCREASERUNBLOCK + +/obj/item/weapon/dnainjector/morph + name = "DNA-Injector (Morph)" + desc = "A total makeover." + dnatype = "se" + dna = list(4090) + //block = 2 + New() + ..() + block = MORPHBLOCK + +/obj/item/weapon/dnainjector/antimorph + name = "DNA-Injector (Anti-Morph)" + desc = "Cures identity crisis." + dnatype = "se" + dna = list(1) + //block = 2 + New() + ..() + block = MORPHBLOCK + +/obj/item/weapon/dnainjector/noprints + name = "DNA-Injector (No Prints)" + desc = "Better than a pair of budget insulated gloves." + dnatype = "se" + dna = list(4090) + //block = 2 + New() + ..() + block = NOPRINTSBLOCK + +/obj/item/weapon/dnainjector/antinoprints + name = "DNA-Injector (Anti-No Prints)" + desc = "Not quite as good as a pair of budget insulated gloves." + dnatype = "se" + dna = list(1) + //block = 2 + New() + ..() + block = NOPRINTSBLOCK + +/obj/item/weapon/dnainjector/insulation + name = "DNA-Injector (Shock Immunity)" + desc = "Better than a pair of real insulated gloves." + dnatype = "se" + dna = list(4090) + //block = 2 + New() + ..() + block = SHOCKIMMUNITYBLOCK + +/obj/item/weapon/dnainjector/antiinsulation + name = "DNA-Injector (Anti-Shock Immunity)" + desc = "Not quite as good as a pair of real insulated gloves." + dnatype = "se" + dna = list(1) + //block = 2 + New() + ..() + block = SHOCKIMMUNITYBLOCK + +/obj/item/weapon/dnainjector/midgit + name = "DNA-Injector (Small Size)" + desc = "Makes you shrink." + dnatype = "se" + dna = list(4090) + //block = 2 + New() + ..() + block = SMALLSIZEBLOCK + +/obj/item/weapon/dnainjector/antimidgit + name = "DNA-Injector (Anti-Small Size)" + desc = "Makes you grow. But not too much." + dnatype = "se" + dna = list(1) + //block = 2 + New() + ..() + block = SMALLSIZEBLOCK + ///////////////////////////////////// /obj/item/weapon/dnainjector/antiglasses name = "DNA-Injector (Anti-Glasses)" desc = "Toss away those glasses!" dnatype = "se" - dna = "708" - block = 1 + dna = list(1) + //block = 1 + New() + ..() + block = GLASSESBLOCK /obj/item/weapon/dnainjector/glassesmut name = "DNA-Injector (Glasses)" desc = "Will make you need dorkish glasses." dnatype = "se" - dna = "BD6" - block = 1 + dna = list(4090) + //block = 1 + New() + ..() + block = GLASSESBLOCK /obj/item/weapon/dnainjector/epimut name = "DNA-Injector (Epi.)" desc = "Shake shake shake the room!" dnatype = "se" - dna = "FA0" - block = 3 + dna = list(4090) + //block = 3 + New() + ..() + block = HEADACHEBLOCK /obj/item/weapon/dnainjector/antiepi name = "DNA-Injector (Anti-Epi.)" desc = "Will fix you up from shaking the room." dnatype = "se" - dna = "708" - block = 3 -//////////////////////////////////// + dna = list(1) + //block = 3 + New() + ..() + block = HEADACHEBLOCK + /obj/item/weapon/dnainjector/anticough name = "DNA-Injector (Anti-Cough)" desc = "Will stop that awful noise." dnatype = "se" - dna = "708" - block = 5 + dna = list(1) + //block = 5 + New() + ..() + block = COUGHBLOCK /obj/item/weapon/dnainjector/coughmut name = "DNA-Injector (Cough)" desc = "Will bring forth a sound of horror from your throat." dnatype = "se" - dna = "BD6" - block = 5 + dna = list(4090) + //block = 5 + New() + ..() + block = COUGHBLOCK /obj/item/weapon/dnainjector/clumsymut name = "DNA-Injector (Clumsy)" desc = "Makes clumsy minions." dnatype = "se" - dna = "FA0" + dna = list(4090) //block = 6 New() ..() @@ -237,7 +497,7 @@ name = "DNA-Injector (Anti-Clumy)" desc = "Cleans up confusion." dnatype = "se" - dna = "708" + dna = list(1) //block = 6 New() ..() @@ -247,36 +507,39 @@ name = "DNA-Injector (Anti-Tour.)" desc = "Will cure tourrets." dnatype = "se" - dna = "708" - block = 7 + dna = list(1) + //block = 7 + New() + ..() + block = TWITCHBLOCK /obj/item/weapon/dnainjector/tourmut name = "DNA-Injector (Tour.)" desc = "Gives you a nasty case off tourrets." dnatype = "se" - dna = "BD6" - block = 7 + dna = list(4090) + //block = 7 + New() + ..() + block = TWITCHBLOCK /obj/item/weapon/dnainjector/stuttmut name = "DNA-Injector (Stutt.)" desc = "Makes you s-s-stuttterrr" dnatype = "se" - dna = "FA0" - block = 9 + dna = list(4090) + //block = 9 + New() + ..() + block = NERVOUSBLOCK + /obj/item/weapon/dnainjector/antistutt name = "DNA-Injector (Anti-Stutt.)" desc = "Fixes that speaking impairment." dnatype = "se" - dna = "708" - block = 9 - -/obj/item/weapon/dnainjector/antifire - name = "DNA-Injector (Anti-Fire)" - desc = "Cures fire." - dnatype = "se" - dna = "708" - //block = 10 + dna = list(1) + //block = 9 New() ..() block = FIREBLOCK @@ -295,7 +558,7 @@ name = "DNA-Injector (Blind)" desc = "Makes you not see anything." dnatype = "se" - dna = "FA0" + dna = list(4090) //block = 11 New() ..() @@ -305,7 +568,7 @@ name = "DNA-Injector (Anti-Blind)" desc = "ITS A MIRACLE!!!" dnatype = "se" - dna = "708" + dna = list(1) //block = 11 New() ..() @@ -335,7 +598,7 @@ name = "DNA-Injector (Deaf)" desc = "Sorry, what did you say?" dnatype = "se" - dna = "FA0" + dna = list(4090) //block = 13 New() ..() @@ -345,22 +608,48 @@ name = "DNA-Injector (Anti-Deaf)" desc = "Will make you hear once more." dnatype = "se" - dna = "708" + dna = list(1) //block = 13 New() ..() block = DEAFBLOCK +/obj/item/weapon/dnainjector/hallucination + name = "DNA-Injector (Halluctination)" + desc = "What you see isn't always what you get." + dnatype = "se" + dna = list(4090) + //block = 2 + New() + ..() + block = HALLUCINATIONBLOCK + +/obj/item/weapon/dnainjector/antihallucination + name = "DNA-Injector (Anti-Hallucination)" + desc = "What you see is what you get." + dnatype = "se" + dna = list(1) + //block = 2 + New() + ..() + block = HALLUCINATIONBLOCK + /obj/item/weapon/dnainjector/h2m name = "DNA-Injector (Human > Monkey)" desc = "Will make you a flea bag." dnatype = "se" - dna = "FA0" - block = 14 + dna = list(4090) + //block = 14 + New() + ..() + block = MONKEYBLOCK /obj/item/weapon/dnainjector/m2h name = "DNA-Injector (Monkey > Human)" desc = "Will make you...less hairy." dnatype = "se" - dna = "708" - block = 14 \ No newline at end of file + dna = list(1) + //block = 14 + New() + ..() + block = MONKEYBLOCK diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 06e804e4e91..e553f68551c 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1362,10 +1362,18 @@ mob/living/carbon/human/yank_out_object() else see_invisible = SEE_INVISIBLE_LIVING + if(species.name=="Slime People") dna.mutantrace = "slime" - mutations+=species.default_mutations + if(species.default_mutations.len>0) + var/needs_update=0 + for(var/mutation in species.default_mutations) + if(!(mutation in mutations)) + mutations.Add(mutation) + needs_update=1 + if(needs_update) + check_mutations=1 // Can't check here or shit will happen. Bad shit. spawn(0) update_icons() diff --git a/code/modules/mob/living/carbon/human/human_defines.dm b/code/modules/mob/living/carbon/human/human_defines.dm index 12d6d0c57da..a1cc0d905f6 100644 --- a/code/modules/mob/living/carbon/human/human_defines.dm +++ b/code/modules/mob/living/carbon/human/human_defines.dm @@ -56,4 +56,7 @@ var/mob/remoteview_target = null var/meatleft = 3 //For chef item var/decaylevel = 0 // For rotting bodies - var/slime_color = "blue" //For slime people this defines their color, it's blue by default to pay tribute to the old icons \ No newline at end of file + var/slime_color = "blue" //For slime people this defines their color, it's blue by default to pay tribute to the old icons + + var/check_mutations=0 // Check mutations on next life tick + diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 38f4b73c292..a66fe6b35b8 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -73,6 +73,12 @@ var/obj/location_as_object = loc location_as_object.handle_internal_lifeform(src, 0) + if(check_mutations) + testing("Updating [src.real_name]'s mutations: "+english_list(mutations)) + domutcheck(src,null) + update_mutations() + check_mutations=0 + //Updates the number of stored chemicals for powers handle_changeling() diff --git a/code/modules/mob/living/carbon/species.dm b/code/modules/mob/living/carbon/species.dm index 079cdbad6ce..95f9d04e932 100644 --- a/code/modules/mob/living/carbon/species.dm +++ b/code/modules/mob/living/carbon/species.dm @@ -41,7 +41,7 @@ // For grays var/max_hurt_damage = 5 // Max melee damage dealt + 5 if hulk - var/default_mutations = list() + var/list/default_mutations = list() var/list/abilities = list() // For species-derived or admin-given powers diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 806361514dc..5d908fa654b 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -434,7 +434,7 @@ new_character.dna.b_type = client.prefs.b_type if(client.prefs.disabilities & DISABILITY_FLAG_NEARSIGHTED) - new_character.dna.struc_enzymes = setblock(new_character.dna.struc_enzymes,GLASSESBLOCK,toggledblock(getblock(new_character.dna.struc_enzymes,GLASSESBLOCK,3)),3) + new_character.dna.SetSEState(GLASSESBLOCK,1,1) new_character.disabilities |= NEARSIGHTED if(client.prefs.disabilities & DISABILITY_FLAG_FAT) @@ -442,13 +442,15 @@ new_character.overeatduration = 600 // Max overeat if(client.prefs.disabilities & DISABILITY_FLAG_EPILEPTIC) - new_character.dna.struc_enzymes = setblock(new_character.dna.struc_enzymes,EPILEPSYBLOCK,toggledblock(getblock(new_character.dna.struc_enzymes,EPILEPSYBLOCK,3)),3) + new_character.dna.SetSEState(EPILEPSYBLOCK,1,1) new_character.disabilities |= EPILEPSY if(client.prefs.disabilities & DISABILITY_FLAG_DEAF) - new_character.dna.struc_enzymes = setblock(new_character.dna.struc_enzymes,DEAFBLOCK,toggledblock(getblock(new_character.dna.struc_enzymes,DEAFBLOCK,3)),3) + new_character.dna.SetSEState(DEAFBLOCK,1,1) new_character.sdisabilities |= DEAF + new_character.dna.UpdateSE() + new_character.key = key //Manually transfer the key to log them in diff --git a/code/modules/virus2/effect.dm b/code/modules/virus2/effect.dm index af02775e47e..43829c595a1 100644 --- a/code/modules/virus2/effect.dm +++ b/code/modules/virus2/effect.dm @@ -241,8 +241,7 @@ stage = 3 activate(var/mob/living/carbon/mob,var/multiplier) mob.dna.check_integrity() - var/newdna = setblock(mob.dna.struc_enzymes,REMOTETALKBLOCK,toggledblock(getblock(mob.dna.struc_enzymes,REMOTETALKBLOCK,3)),3) - mob.dna.struc_enzymes = newdna + mob.dna.SetSEState(REMOTETALKBLOCK,1) domutcheck(mob, null) /datum/disease2/effect/mind @@ -439,4 +438,4 @@ mob.adjustToxLoss(-3) var/obj/effect/decal/cleanable/poop/P = new(get_turf(mob)) P.virus2 = virus_copylist(mob.virus2) - playsound(P.loc, 'sound/effects/splat.ogg', 50, 1) \ No newline at end of file + playsound(P.loc, 'sound/effects/splat.ogg', 50, 1)