diff --git a/baystation12.dme b/baystation12.dme index bfa7dff4dd..ab9e63bb11 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -179,8 +179,13 @@ #include "code\game\area\areas.dm" #include "code\game\area\Space Station 13 areas.dm" #include "code\game\dna\dna2.dm" +#include "code\game\dna\dna2_domutcheck.dm" #include "code\game\dna\dna2_helpers.dm" #include "code\game\dna\dna_modifier.dm" +#include "code\game\dna\genes\disabilities.dm" +#include "code\game\dna\genes\gene.dm" +#include "code\game\dna\genes\monkey.dm" +#include "code\game\dna\genes\powers.dm" #include "code\game\gamemodes\events.dm" #include "code\game\gamemodes\factions.dm" #include "code\game\gamemodes\game_mode.dm" diff --git a/baystation12.int b/baystation12.int index b82874fded..fb3d85be3c 100644 --- a/baystation12.int +++ b/baystation12.int @@ -1,6 +1,11 @@ // BEGIN_INTERNALS /* MAP_ICON_TYPE: 0 +WINDOW: code\__HELPERS\unsorted.dm;code\game\dna\dna2.dm;code\game\dna\dna2_domutcheck.dm;code\game\dna\dna2_helpers.dm;code\game\dna\dna_modifier.dm;code\game\machinery\cloning.dm;code\game\objects\items\weapons\dna_injector.dm;code\game\dna\genes\disabilities.dm;code\game\gamemodes\setupgame.dm;code\setup.dm;code\global.dm +LAST_COMPILE_VERSION: 501.1217 +DIR: code code\game code\game\dna code\game\dna\genes code\game\gamemodes code\game\objects code\game\objects\items code\game\objects\items\weapons +FILE: code\game\objects\items\weapons\dna_injector.dm +LAST_COMPILE_TIME: 1387468589 AUTO_FILE_DIR: OFF */ // END_INTERNALS diff --git a/code/datums/datacore.dm b/code/datums/datacore.dm index 1e141a2ac2..d4e9258422 100644 --- a/code/datums/datacore.dm +++ b/code/datums/datacore.dm @@ -107,13 +107,13 @@ var/datum/data/record/L = new() L.fields["id"] = md5("[H.real_name][H.mind.assigned_role]") L.fields["name"] = H.real_name - L.fields["rank"] = H.mind.assigned_role + L.fields["rank"] = H.mind.assigned_role L.fields["age"] = H.age L.fields["sex"] = H.gender L.fields["b_type"] = H.b_type L.fields["b_dna"] = H.dna.unique_enzymes - L.fields["enzymes"] = H.dna.SE - L.fields["identity"] = H.dna.UI + L.fields["enzymes"] = H.dna.SE // Used in respawning + L.fields["identity"] = H.dna.UI // " L.fields["image"] = getFlatIcon(H,0) //This is god-awful locked += L return diff --git a/code/game/dna/dna2.dm b/code/game/dna/dna2.dm index 9102ee8780..6b06dc57f6 100644 --- a/code/game/dna/dna2.dm +++ b/code/game/dna/dna2.dm @@ -25,6 +25,8 @@ var/global/list/dna_activity_bounds[STRUCDNASIZE] // Used to determine what each block means (admin hax and species stuff on /vg/, mostly) var/global/list/assigned_blocks[STRUCDNASIZE] +var/global/list/datum/dna/gene/dna_genes[0] + // UI Indices (can change to mutblock style, if desired) #define DNA_UI_HAIR_R 1 #define DNA_UI_HAIR_G 2 @@ -41,6 +43,13 @@ var/global/list/assigned_blocks[STRUCDNASIZE] #define DNA_UI_HAIR_STYLE 13 #define DNA_UI_LENGTH 13 // Update this when you add something, or you WILL break shit. +///////////////// +// GENE DEFINES +///////////////// + +// Skip checking if it's already active. +// Used for genes that check for value rather than a binary on/off. +#define GENE_ALWAYS_ACTIVATE 1 /* Note RE: unassigned blocks @@ -77,6 +86,10 @@ var/global/list/assigned_blocks[STRUCDNASIZE] 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, + + // New stuff + var/species = "Human" + /////////////////////////////////////// // UNIQUE IDENTITY /////////////////////////////////////// @@ -84,7 +97,11 @@ var/global/list/assigned_blocks[STRUCDNASIZE] // Create random UI. /datum/dna/proc/ResetUI(var/defer=0) for(var/i=1,i<=DNA_UI_LENGTH,i++) - UI[i]=rand(0,4095) + switch(i) + if(DNA_UI_SKIN_TONE) + SetUIValueRange(DNA_UI_SKIN_TONE,rand(1,220),220,1) // Otherwise, it gets fucked + else + UI[i]=rand(0,4095) if(!defer) UpdateUI() @@ -114,7 +131,7 @@ var/global/list/assigned_blocks[STRUCDNASIZE] SetUIValueRange(DNA_UI_BEARD_G, character.g_eyes, 255, 1) SetUIValueRange(DNA_UI_BEARD_B, character.b_eyes, 255, 1) - SetUIValueRange(DNA_UI_SKIN_TONE, character.s_tone, 220, 1) + SetUIValueRange(DNA_UI_SKIN_TONE, 35-character.s_tone, 220, 1) // Value can be negative. SetUIState(DNA_UI_GENDER, character.gender!=MALE, 1) @@ -234,6 +251,12 @@ var/global/list/assigned_blocks[STRUCDNASIZE] if(value) SetSEValue(block, value * range - rand(1,range-1)) +// Getter version of above. +/datum/dna/proc/GetSEValueRange(var/block,var/maxvalue) + if (block<=0) return 0 + var/value = GetSEValue(block) + return round(1 +(value / 4096)*maxvalue) + // Is the block "on" (1) or "off" (0)? (Un-assigned genes are always off.) /datum/dna/proc/GetSEState(var/block) if (block<=0) return 0 diff --git a/code/game/dna/dna2_domutcheck.dm b/code/game/dna/dna2_domutcheck.dm new file mode 100644 index 0000000000..c9b75118de --- /dev/null +++ b/code/game/dna/dna2_domutcheck.dm @@ -0,0 +1,355 @@ +// (Re-)Apply mutations. +// TODO: Turn into a /mob proc, change inj to a bitflag for various forms of differing behavior. +// M: Mob to mess with +// connected: Machine we're in, type unchecked so I doubt it's used beyond monkeying +// flags: See below, bitfield. +#define MUTCHK_FORCED 1 +/proc/domutcheck(var/mob/living/M, var/connected=null, var/flags=0) + for(var/datum/dna/gene/gene in dna_genes) + if(!M) + return + if(!gene.block) + continue + + // Sanity checks, don't skip. + if(!gene.can_activate(M,flags)) + //testing("[M] - Failed to activate [gene.name] (can_activate fail).") + continue + + // Current state + var/gene_active = (gene.flags & GENE_ALWAYS_ACTIVATE) + if(!gene_active) + gene_active = M.dna.GetSEState(gene.block) + + // Prior state + var/gene_prior_status = (gene.type in M.active_genes) + + if((gene_active && !gene_prior_status) || (gene.flags & GENE_ALWAYS_ACTIVATE)) + //testing("[gene.name] activated!") + gene.activate(M,connected,flags) + if(M) + if(!(gene.flags & GENE_ALWAYS_ACTIVATE)) + M.active_genes |= gene.type + M.update_icon=1 + else if(!gene_active && gene_prior_status) + //testing("[gene.name] deactivated!") + gene.deactivate(M,connected,flags) + if(M) + M.active_genes -= gene.type + M.update_icon = 1 + //else + // testing("[M] - Failed to activate [gene.name] - [gene_active?"+":"-"]active, [gene_prior_status?"+":"-"]prior") + +/* Old, inflexibile +/proc/domutcheck(var/mob/living/M, var/connected, var/flags) + 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) + + var/inj = (flags & MUTCHK_FROM_INJECTOR) == MUTCHK_FROM_INJECTOR + var/forced = (flags & MUTCHK_FORCED) == MUTCHK_FORCED + + if(M.dna.GetSEState(NOBREATHBLOCK)) + if(forced || 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(forced || 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(forced || probinj(45,inj) || (mRegen in old_mutations)) + M << "\blue You feel better" + M.mutations.Add(mRegen) + if(M.dna.GetSEState(INCREASERUNBLOCK)) + if(forced || probinj(45,inj) || (mRun in old_mutations)) + M << "\blue Your leg muscles pulsate." + M.mutations.Add(mRun) + if(M.dna.GetSEState(REMOTETALKBLOCK)) + if(forced || 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(forced || 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(COLDBLOCK)) + if(!(COLD_RESISTANCE in old_mutations)) + if(forced || probinj(15,inj) || (mHeatres in old_mutations)) + M.mutations.Add(mHeatres) + M << "\blue Your skin is icy to the touch" + else + if(forced || probinj(5,inj) || (mHeatres in old_mutations)) + M.mutations.Add(mHeatres) + M << "\blue Your skin is icy to the touch" + if(M.dna.GetSEState(HALLUCINATIONBLOCK)) + if(forced || probinj(45,inj) || (mHallucination in old_mutations)) + M.mutations.Add(mHallucination) + M << "\red Your mind says 'Hello'" + if(M.dna.GetSEState(NOPRINTSBLOCK)) + if(forced || probinj(45,inj) || (mFingerprints in old_mutations)) + M.mutations.Add(mFingerprints) + M << "\blue Your fingers feel numb" + if(M.dna.GetSEState(SHOCKIMMUNITYBLOCK)) + if(forced || probinj(45,inj) || (mShock in old_mutations)) + M.mutations.Add(mShock) + M << "\blue Your skin feels strange" + if(M.dna.GetSEState(SMALLSIZEBLOCK)) + if(forced || 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(forced || 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(forced || 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(!(mHeatres in old_mutations)) + if(forced || probinj(30,inj) || (COLD_RESISTANCE in old_mutations)) + M << "\blue Your body feels warm." + M.mutations.Add(COLD_RESISTANCE) + else + if(forced || probinj(5,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(forced || 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++ + O.UpdateAppearance() + 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/dna2_helpers.dm b/code/game/dna/dna2_helpers.dm index 08d07ab2e1..6f180993fb 100644 --- a/code/game/dna/dna2_helpers.dm +++ b/code/game/dna/dna2_helpers.dm @@ -143,7 +143,7 @@ H.g_eyes = dna.GetUIValueRange(DNA_UI_EYES_G, 255) H.b_eyes = dna.GetUIValueRange(DNA_UI_EYES_B, 255) - H.s_tone = dna.GetUIValueRange(DNA_UI_SKIN_TONE, 220) + H.s_tone = 35 - dna.GetUIValueRange(DNA_UI_SKIN_TONE, 220) // Value can be negative. if (dna.GetUIState(DNA_UI_GENDER)) H.gender = FEMALE @@ -170,309 +170,3 @@ // Used below, simple injection modifier. /proc/probinj(var/pr, var/inj) return prob(pr+inj*pr) - -// (Re-)Apply mutations. -// TODO: Turn into a /mob proc, change inj to a bitflag for various forms of differing behavior. -// M: Mob to mess with -// connected: Machine we're in, type unchecked so I doubt it's used beyond monkeying -// inj: 1 for if we're checking this from an injector, screws with manifestation probability calc. -/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) - - ///////////////////////////////////// - // IMPORTANT REMINDER - // IF A BLOCK IS SET TO 0 (unused) - // GetSEState(block) WILL RETURN 0 - ///////////////////////////////////// - - 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++ - O.UpdateAppearance() - 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 37ad94e3f5..6be58f811d 100644 --- a/code/game/dna/dna_modifier.dm +++ b/code/game/dna/dna_modifier.dm @@ -1,5 +1,37 @@ #define DNA_BLOCK_SIZE 3 +// Buffer datatype flags. +#define DNA2_BUF_UI 1 +#define DNA2_BUF_UE 2 +#define DNA2_BUF_SE 4 + +//list("data" = null, "owner" = null, "label" = null, "type" = null, "ue" = 0), +/datum/dna2/record + var/datum/dna/dna = null + var/types=0 + var/name="Empty" + + // Stuff for cloners + var/id=null + var/implant=null + var/ckey=null + var/mind=null + +/datum/dna2/record/proc/GetData() + var/list/ser=list("data" = null, "owner" = null, "label" = null, "type" = null, "ue" = 0) + ser["ue"] = (types & DNA2_BUF_UE) == DNA2_BUF_UE + if(types & DNA2_BUF_SE) + ser["data"] = dna.SE + else + ser["data"] = dna.UI + ser["owner"] = src.dna.real_name + ser["label"] = name + if(types & DNA2_BUF_UI) + ser["type"] = "ui" + else + ser["type"] = "se" + return ser + /////////////////////////// DNA MACHINES /obj/machinery/dna_scannernew name = "\improper DNA modifier" @@ -14,6 +46,7 @@ var/locked = 0 var/mob/living/carbon/occupant = null var/obj/item/weapon/reagent_containers/glass/beaker = null + var/opened = 0 /obj/machinery/dna_scannernew/New() ..() @@ -80,12 +113,6 @@ usr.loc = src src.occupant = usr src.icon_state = "scanner_1" - /* - for(var/obj/O in src) // THIS IS P. STUPID -- LOVE, DOOHL - //O = null - del(O) - //Foreach goto(124) - */ src.add_fingerprint(usr) return @@ -111,7 +138,12 @@ if (G.affecting.abiotic()) user << "\blue Subject cannot have abiotic items on." return - var/mob/M = G.affecting + put_in(G.affecting) + src.add_fingerprint(user) + del(G) + return + +/obj/machinery/dna_scannernew/proc/put_in(var/mob/M) if(M.client) M.client.perspective = EYE_PERSPECTIVE M.client.eye = src @@ -119,8 +151,6 @@ src.occupant = M src.icon_state = "scanner_1" - src.add_fingerprint(user) - // search for ghosts, if the corpse is empty and the scanner is connected to a cloner if(locate(/obj/machinery/computer/cloning, get_step(src, NORTH)) \ || locate(/obj/machinery/computer/cloning, get_step(src, SOUTH)) \ @@ -132,19 +162,11 @@ if(ghost.mind == M.mind) ghost << "Your corpse has been placed into a cloning scanner. Return to your body if you want to be resurrected/cloned! (Verbs -> Ghost -> Re-enter corpse)" break - del(G) return /obj/machinery/dna_scannernew/proc/go_out() if ((!( src.occupant ) || src.locked)) return -/* -// it's like this was -just- here to break constructed dna scanners -Pete -// if that's not the case, slap my shit and uncomment this. -// for(var/obj/O in src) -// O.loc = src.loc -*/ - //Foreach goto(30) if (src.occupant.client) src.occupant.client.eye = src.occupant.client.mob src.occupant.client.perspective = MOB_PERSPECTIVE @@ -205,11 +227,7 @@ var/selected_ui_target_hex = 1 var/radiation_duration = 2.0 var/radiation_intensity = 1.0 - var/list/buffers = list( - list("data" = null, "owner" = null, "label" = null, "type" = null, "ue" = 0), - list("data" = null, "owner" = null, "label" = null, "type" = null, "ue" = 0), - list("data" = null, "owner" = null, "label" = null, "type" = null, "ue" = 0) - ) + var/list/datum/dna2/record/buffers[3] var/irradiating = 0 var/injector_ready = 0 //Quick fix for issue 286 (screwdriver the screen twice to restore injector) -Pete var/obj/machinery/dna_scannernew/connected = null @@ -219,6 +237,7 @@ use_power = 1 idle_power_usage = 10 active_power_usage = 400 + var/waiting_for_user_input=0 // Fix for #274 (Mash create block injector without answering dialog to make unlimited injectors) - N3X /obj/machinery/computer/scan_consolenew/attackby(obj/item/I as obj, mob/user as mob) if(istype(I, /obj/item/weapon/screwdriver)) @@ -308,13 +327,13 @@ arr += "[i]:[EncodeDNABlock(buffer[i])]" return arr -/obj/machinery/computer/scan_consolenew/proc/setInjectorBlock(var/obj/item/weapon/dnainjector/I, var/blk, var/list/buffer) +/obj/machinery/computer/scan_consolenew/proc/setInjectorBlock(var/obj/item/weapon/dnainjector/I, var/blk, var/datum/dna2/record/buffer) var/pos = findtext(blk,":") if(!pos) return 0 var/id = text2num(copytext(blk,1,pos)) if(!id) return 0 I.block = id - I.dna = list(buffer[id]) + I.buf = buffer return 1 /obj/machinery/computer/scan_consolenew/attackby(obj/item/W as obj, mob/user as mob) @@ -336,6 +355,7 @@ ui_interact(user) /obj/machinery/computer/scan_consolenew/attack_ai(user as mob) + src.add_hiddenprint(user) ui_interact(user) /obj/machinery/computer/scan_consolenew/attack_hand(user as mob) @@ -363,27 +383,26 @@ data["selectedMenuKey"] = selected_menu_key data["locked"] = src.connected.locked data["hasOccupant"] = connected.occupant ? 1 : 0 - + data["isInjectorReady"] = injector_ready data["hasDisk"] = disk ? 1 : 0 var/diskData[0] - if (!disk) + if (!disk || !disk.buf) diskData["data"] = null diskData["owner"] = null diskData["label"] = null diskData["type"] = null diskData["ue"] = null else - diskData["data"] = disk.data - diskData["owner"] = disk.owner - diskData["label"] = disk.name - diskData["type"] = disk.data_type - diskData["ue"] = disk.ue + diskData = disk.buf.GetData() data["disk"] = diskData - data["buffers"] = buffers + var/list/new_buffers = list() + for(var/datum/dna2/record/buf in buffers) + new_buffers.Add(buf.GetData()) + data["buffers"]=new_buffers data["radiationIntensity"] = radiation_intensity data["radiationDuration"] = radiation_duration @@ -624,10 +643,13 @@ src.selected_se_block = select_block if ((select_subblock <= DNA_BLOCK_SIZE) && (select_subblock >= 1)) src.selected_se_subblock = select_subblock + //testing("User selected block [selected_se_block] (sent [select_block]), subblock [selected_se_subblock] (sent [select_block]).") return 1 // return 1 forces an update to all Nano uis attached to src if (href_list["pulseSERadiation"]) var/block = src.connected.occupant.dna.GetSESubBlock(src.selected_se_block,src.selected_se_subblock) + //var/original_block=block + //testing("Irradiating SE block [src.selected_se_block]:[src.selected_se_subblock] ([block])...") irradiating = src.radiation_duration var/lock_state = src.connected.locked @@ -650,23 +672,27 @@ else if (src.selected_se_block > STRUCDNASIZE/2 && src.selected_se_block < STRUCDNASIZE) real_SE_block-- + //testing("Irradiated SE block [real_SE_block]:[src.selected_se_subblock] ([original_block] now [block]) [(real_SE_block!=selected_se_block) ? "(SHIFTED)":""]!") connected.occupant.dna.SetSESubBlock(real_SE_block,selected_se_subblock,block) - domutcheck(src.connected.occupant,src.connected) src.connected.occupant.radiation += (src.radiation_intensity+src.radiation_duration) + domutcheck(src.connected.occupant,src.connected) else + src.connected.occupant.radiation += ((src.radiation_intensity*2)+src.radiation_duration) if (prob(80-src.radiation_duration)) + //testing("Random bad mut!") randmutb(src.connected.occupant) domutcheck(src.connected.occupant,src.connected) else randmuti(src.connected.occupant) + //testing("Random identity mut!") src.connected.occupant.UpdateAppearance() - src.connected.occupant.radiation += ((src.radiation_intensity*2)+src.radiation_duration) src.connected.locked = lock_state return 1 // return 1 forces an update to all Nano uis attached to src if(href_list["ejectBeaker"]) if(connected.beaker) - connected.beaker.loc = connected.loc + var/obj/item/weapon/reagent_containers/glass/B = connected.beaker + B.loc = connected.loc connected.beaker = null return 1 @@ -677,18 +703,14 @@ // Transfer Buffer Management if(href_list["bufferOption"]) var/bufferOption = href_list["bufferOption"] - + // These bufferOptions do not require a bufferId if (bufferOption == "wipeDisk") if ((isnull(src.disk)) || (src.disk.read_only)) //src.temphtml = "Invalid disk. Please try again." return 0 - src.disk.data = null - src.disk.data_type = null - src.disk.ue = null - src.disk.owner = null - src.disk.name = null + src.disk.buf=null //src.temphtml = "Data saved." return 1 @@ -702,7 +724,7 @@ // All bufferOptions from here on require a bufferId if (!href_list["bufferId"]) return 0 - + var/bufferId = text2num(href_list["bufferId"]) if (bufferId < 1 || bufferId > 3) @@ -710,56 +732,46 @@ if (bufferOption == "saveUI") if(src.connected.occupant && src.connected.occupant.dna) - src.buffers[bufferId]["ue"] = 0 - src.buffers[bufferId]["data"] = src.connected.occupant.dna.UI - if (!istype(src.connected.occupant,/mob/living/carbon/human)) - src.buffers[bufferId]["owner"] = src.connected.occupant.name - else - src.buffers[bufferId]["owner"] = src.connected.occupant.real_name - src.buffers[bufferId]["label"] = "Unique Identifier" - src.buffers[bufferId]["type"] = "ui" + var/datum/dna2/record/databuf=new + databuf.types = DNA2_BUF_UE + databuf.dna = src.connected.occupant.dna + databuf.name = "Unique Identifier" + src.buffers[bufferId] = databuf return 1 if (bufferOption == "saveUIAndUE") if(src.connected.occupant && src.connected.occupant.dna) - src.buffers[bufferId]["data"] = src.connected.occupant.dna.UI - if (!istype(src.connected.occupant,/mob/living/carbon/human)) - src.buffers[bufferId]["owner"] = src.connected.occupant.name - else - src.buffers[bufferId]["owner"] = src.connected.occupant.real_name - src.buffers[bufferId]["label"] = "Unique Identifier + Unique Enzymes" - src.buffers[bufferId]["type"] = "ui" - src.buffers[bufferId]["ue"] = 1 + var/datum/dna2/record/databuf=new + databuf.types = DNA2_BUF_UI|DNA2_BUF_UE + databuf.dna = src.connected.occupant.dna + databuf.name = "Unique Identifier + Unique Enzymes" + src.buffers[bufferId] = databuf return 1 if (bufferOption == "saveSE") if(src.connected.occupant && src.connected.occupant.dna) - src.buffers[bufferId]["ue"] = 0 - src.buffers[bufferId]["data"] = src.connected.occupant.dna.SE - if (!istype(src.connected.occupant,/mob/living/carbon/human)) - src.buffers[bufferId]["owner"] = src.connected.occupant.name - else - src.buffers[bufferId]["owner"] = src.connected.occupant.real_name - src.buffers[bufferId]["label"] = "Structural Enzymes" - src.buffers[bufferId]["type"] = "se" + var/datum/dna2/record/databuf=new + databuf.types = DNA2_BUF_SE + databuf.dna = src.connected.occupant.dna + databuf.name = "Structural Enzymes" + src.buffers[bufferId] = databuf return 1 if (bufferOption == "clear") - src.buffers[bufferId]["data"] = null - src.buffers[bufferId]["owner"] = null - src.buffers[bufferId]["label"] = null - src.buffers[bufferId]["ue"] = null + src.buffers[bufferId]=null return 1 if (bufferOption == "changeLabel") - var/label = src.buffers[bufferId]["label"] ? src.buffers[bufferId]["label"] : "New Label" - src.buffers[bufferId]["label"] = sanitize(input("New Label:", "Edit Label", label)) + var/datum/dna2/record/buf = src.buffers[bufferId] + buf.name = buf.name ? src.buffers[bufferId]["label"] : "New Label" + buf.name = sanitize(input("New Label:", "Edit Label", buf.name)) + src.buffers[bufferId] = buf return 1 if (bufferOption == "transfer") if (!src.connected.occupant || (NOCLONE in src.connected.occupant.mutations) || !src.connected.occupant.dna) return - + irradiating = 2 var/lock_state = src.connected.locked src.connected.locked = 1//lock it @@ -769,33 +781,37 @@ irradiating = 0 src.connected.locked = lock_state - - if (src.buffers[bufferId]["type"] == "ui") - if (src.buffers[bufferId]["ue"]) - src.connected.occupant.real_name = src.buffers[bufferId]["owner"] - src.connected.occupant.name = src.buffers[bufferId]["owner"] - src.connected.occupant.UpdateAppearance(src.buffers[bufferId]["data"]) - else if (src.buffers[bufferId]["type"] == "se") - src.connected.occupant.dna.SE = src.buffers[bufferId]["data"] + + var/datum/dna2/record/buf = src.buffers[bufferId] + + if ((buf.types & DNA2_BUF_UI)) + if ((buf.types & DNA2_BUF_UE)) + src.connected.occupant.real_name = buf.dna.real_name + src.connected.occupant.name = buf.dna.real_name + src.connected.occupant.UpdateAppearance(buf.dna.UI) + else if (buf.types & DNA2_BUF_SE) + src.connected.occupant.dna.SE = buf.dna.SE src.connected.occupant.dna.UpdateSE() domutcheck(src.connected.occupant,src.connected) src.connected.occupant.radiation += rand(20,50) return 1 if (bufferOption == "createInjector") - if (src.injector_ready) + if (src.injector_ready || waiting_for_user_input) + var/success = 1 var/obj/item/weapon/dnainjector/I = new /obj/item/weapon/dnainjector - I.dnatype = src.buffers[bufferId]["type"] + var/datum/dna2/record/buf = src.buffers[bufferId] if(href_list["createBlockInjector"]) - var/blk = input(usr,"Select Block","Block") in all_dna_blocks(src.buffers[bufferId]["data"]) - success = setInjectorBlock(I,blk,src.buffers[bufferId]["data"]) + waiting_for_user_input=1 + var/blk = input(usr,"Select Block","Block") in all_dna_blocks(buf.GetData()) + success = setInjectorBlock(I,blk,buf) else - I.dna = src.buffers[bufferId]["data"] + I.buf = buf + waiting_for_user_input=0 if(success) I.loc = src.loc - I.name += " ([src.buffers[bufferId]["label"]])" - if (src.buffers[bufferId]["ue"]) I.ue = src.buffers[bufferId]["owner"] //lazy haw haw + I.name += " ([buf.name])" //src.temphtml = "Injector created." src.injector_ready = 0 spawn(300) @@ -807,14 +823,11 @@ return 1 if (bufferOption == "loadDisk") - if ((isnull(src.disk)) || (!src.disk.data) || (src.disk.data == "")) + if ((isnull(src.disk)) || (!src.disk.buf)) //src.temphtml = "Invalid disk. Please try again." return 0 - src.buffers[bufferId]["data"] = src.disk.data - src.buffers[bufferId]["type"] = src.disk.data_type - src.buffers[bufferId]["ue"] = src.disk.ue - src.buffers[bufferId]["owner"] = src.disk.owner + src.buffers[bufferId]=src.disk.buf //src.temphtml = "Data loaded." return 1 @@ -823,11 +836,10 @@ //src.temphtml = "Invalid disk. Please try again." return 0 - src.disk.data = buffers[bufferId]["data"] - src.disk.data_type = src.buffers[bufferId]["type"] - src.disk.ue = src.buffers[bufferId]["ue"] - src.disk.owner = src.buffers[bufferId]["owner"] - src.disk.name = "data disk - '[src.buffers[bufferId]["owner"]]'" + var/datum/dna2/record/buf = src.buffers[bufferId] + + src.disk.buf = buf + src.disk.name = "data disk - '[buf.dna.real_name]'" //src.temphtml = "Data saved." return 1 diff --git a/code/game/dna/genes/disabilities.dm b/code/game/dna/genes/disabilities.dm new file mode 100644 index 0000000000..191b31be81 --- /dev/null +++ b/code/game/dna/genes/disabilities.dm @@ -0,0 +1,125 @@ +///////////////////// +// DISABILITY GENES +// +// These activate either a mutation, disability, or sdisability. +// +// Gene is always activated. +///////////////////// + +/datum/dna/gene/disability + name="DISABILITY" + + // Mutation to give (or 0) + var/mutation=0 + + // Disability to give (or 0) + var/disability=0 + + // SDisability to give (or 0) + var/sdisability=0 + + // Activation message + var/activation_message="" + + // Yay, you're no longer growing 3 arms + var/deactivation_message="" + +/datum/dna/gene/disability/can_activate(var/mob/M,var/flags) + return 1 // Always set! + +/datum/dna/gene/disability/activate(var/mob/M, var/connected, var/flags) + if(mutation && !(mutation in M.mutations)) + M.mutations.Add(mutation) + if(disability) + M.disabilities|=disability + if(mutation) + M.sdisabilities|=sdisability + if(activation_message) + M << "\red [activation_message]" + +/datum/dna/gene/disability/deactivate(var/mob/M, var/connected, var/flags) + if(mutation && (mutation in M.mutations)) + M.mutations.Remove(mutation) + if(disability) + M.disabilities-=disability + if(mutation) + M.sdisabilities-=sdisability + if(deactivation_message) + M << "\red [deactivation_message]" + +// Note: Doesn't seem to do squat, at the moment. +/datum/dna/gene/disability/hallucinate + name="Hallucinate" + activation_message="Your mind says 'Hello'." + mutation=mHallucination + + New() + block=HALLUCINATIONBLOCK + +/datum/dna/gene/disability/epilepsy + name="Epilepsy" + activation_message="You get a headache." + disability=EPILEPSY + + New() + block=HEADACHEBLOCK + +/datum/dna/gene/disability/cough + name="Coughing" + activation_message="You start coughing." + disability=COUGHING + + New() + block=COUGHBLOCK + +/datum/dna/gene/disability/clumsy + name="Clumsiness" + activation_message="You feel lightheaded." + mutation=CLUMSY + + New() + block=CLUMSYBLOCK + +/datum/dna/gene/disability/tourettes + name="Tourettes" + activation_message="You twitch." + disability=TOURETTES + + New() + block=TWITCHBLOCK + +/datum/dna/gene/disability/nervousness + name="Nervousness" + activation_message="You feel nervous." + disability=NERVOUS + + New() + block=NERVOUSBLOCK + +/datum/dna/gene/disability/blindness + name="Blindness" + activation_message="You can't seem to see anything." + sdisability=BLIND + + New() + block=BLINDBLOCK + +/datum/dna/gene/disability/deaf + name="Deafness" + activation_message="It's kinda quiet." + sdisability=DEAF + + New() + block=DEAFBLOCK + + activate(var/mob/M, var/connected, var/flags) + ..(M,connected,flags) + M.ear_deaf = 1 + +/datum/dna/gene/disability/nearsighted + name="Nearsightedness" + activation_message="Your eyes feel weird..." + disability=NEARSIGHTED + + New() + block=GLASSESBLOCK \ No newline at end of file diff --git a/code/game/dna/genes/gene.dm b/code/game/dna/genes/gene.dm new file mode 100644 index 0000000000..3bf5b5e5f7 --- /dev/null +++ b/code/game/dna/genes/gene.dm @@ -0,0 +1,88 @@ +/** +* Gene Datum +* +* domutcheck was getting pretty hairy. This is the solution. +* +* All genes are stored in a global variable to cut down on memory +* usage. +* +* @author N3X15 +*/ + +/datum/dna/gene + // Display name + var/name="BASE GENE" + + // Probably won't get used but why the fuck not + var/desc="Oh god who knows what this does." + + // Set in initialize()! + // What gene activates this? + var/block=0 + + // Any of a number of GENE_ flags. + var/flags=0 + +// Return 1 if we can activate. +// HANDLE MUTCHK_FORCED HERE! +/datum/dna/gene/proc/can_activate(var/mob/M, var/flags) + return 0 + +// Called when the gene activates. Do your magic here. +/datum/dna/gene/proc/activate(var/mob/M, var/connected, var/flags) + return + +// Called when the gene deactivates. Undo your magic here. +// Only called when the block is deactivated. +/datum/dna/gene/proc/deactivate(var/mob/M, var/connected, var/flags) + return + + +///////////////////// +// BASIC GENES +// +// These just chuck in a mutation and display a message. +// +// Gene is activated: +// 1. If mutation already exists in mob +// 2. If the probability roll succeeds +// 3. Activation is forced (done in domutcheck) +///////////////////// + + +/datum/dna/gene/basic + name="BASIC GENE" + + // Mutation to give + var/mutation=0 + + // Activation probability + var/activation_prob=45 + + // Possible activation messages + var/list/activation_messages=list() + + // Possible deactivation messages + var/list/deactivation_messages=list() + +/datum/dna/gene/basic/can_activate(var/mob/M,var/flags) + if(mutation==0) + return 0 + + // Probability check + if(flags & MUTCHK_FORCED || probinj(activation_prob,(flags&MUTCHK_FORCED))) + return 1 + + return 0 + +/datum/dna/gene/basic/activate(var/mob/M) + M.mutations.Add(mutation) + if(activation_messages.len) + var/msg = pick(activation_messages) + M << "\blue [msg]" + +/datum/dna/gene/basic/deactivate(var/mob/M) + M.mutations.Remove(mutation) + if(deactivation_messages.len) + var/msg = pick(deactivation_messages) + M << "\red [msg]" \ No newline at end of file diff --git a/code/game/dna/genes/monkey.dm b/code/game/dna/genes/monkey.dm new file mode 100644 index 0000000000..952f7df0f4 --- /dev/null +++ b/code/game/dna/genes/monkey.dm @@ -0,0 +1,170 @@ +/datum/dna/gene/monkey + name="Monkey" + +/datum/dna/gene/monkey/New() + block=MONKEYBLOCK + +/datum/dna/gene/monkey/can_activate(var/mob/M,var/flags) + return istype(M, /mob/living/carbon/human) || istype(M,/mob/living/carbon/monkey) + +/datum/dna/gene/monkey/activate(var/mob/living/M, var/connected, var/flags) + if(!istype(M,/mob/living/carbon/human)) + return + 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 + +/datum/dna/gene/monkey/deactivate(var/mob/living/M, var/connected, var/flags) + if(!istype(M,/mob/living/carbon/monkey)) + return + 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++ + O.UpdateAppearance() + 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 \ No newline at end of file diff --git a/code/game/dna/genes/powers.dm b/code/game/dna/genes/powers.dm new file mode 100644 index 0000000000..9da3afca5f --- /dev/null +++ b/code/game/dna/genes/powers.dm @@ -0,0 +1,163 @@ +/////////////////////////////////// +// POWERS +/////////////////////////////////// + +/datum/dna/gene/basic/nobreath + name="No Breathing" + activation_messages=list("You feel no need to breathe.") + mutation=mNobreath + + New() + block=NOBREATHBLOCK + +/datum/dna/gene/basic/remoteview + name="Remote Viewing" + activation_messages=list("Your mind expands.") + mutation=mRemote + + New() + block=REMOTEVIEWBLOCK + + activate(var/mob/M, var/connected, var/flags) + ..(M,connected,flags) + M.verbs += /mob/living/carbon/human/proc/remoteobserve + +/datum/dna/gene/basic/regenerate + name="Regenerate" + activation_messages=list("You feel better.") + mutation=mRegen + + New() + block=REGENERATEBLOCK + +/datum/dna/gene/basic/increaserun + name="Super Speed" + activation_messages=list("Your leg muscles pulsate.") + mutation=mRun + + New() + block=INCREASERUNBLOCK + +/datum/dna/gene/basic/remotetalk + name="Telepathy" + activation_messages=list("You expand your mind outwards.") + mutation=mRemotetalk + + New() + block=REMOTETALKBLOCK + + activate(var/mob/M, var/connected, var/flags) + ..(M,connected,flags) + M.verbs += /mob/living/carbon/human/proc/remotesay + +/datum/dna/gene/basic/morph + name="Morph" + activation_messages=list("Your skin feels strange.") + mutation=mMorph + + New() + block=MORPHBLOCK + + activate(var/mob/M) + ..(M) + M.verbs += /mob/living/carbon/human/proc/morph + +/* Not used on bay +/datum/dna/gene/basic/heat_resist + name="Heat Resistance" + activation_messages=list("Your skin is icy to the touch.") + mutation=mHeatres + + New() + block=COLDBLOCK + + can_activate(var/mob/M,var/flags) + // Probability check + var/_prob = 15 + if(COLD_RESISTANCE in M.mutations) + _prob=5 + if(probinj(_prob,(flags&MUTCHK_FORCED))) + return 1 +*/ + +/datum/dna/gene/basic/cold_resist + name="Cold Resistance" + activation_messages=list("Your body is filled with warmth.") + mutation=COLD_RESISTANCE + + New() + block=FIREBLOCK + + can_activate(var/mob/M,var/flags) + + // Probability check + var/_prob=30 + //if(mHeatres in M.mutations) + // _prob=5 + if(probinj(_prob,(flags&MUTCHK_FORCED))) + return 1 + +/datum/dna/gene/basic/noprints + name="No Prints" + activation_messages=list("Your fingers feel numb.") + mutation=mFingerprints + + New() + block=NOPRINTSBLOCK + +/datum/dna/gene/basic/noshock + name="Shock Immunity" + activation_messages=list("Your skin feels strange.") + mutation=mShock + + New() + block=SHOCKIMMUNITYBLOCK + +/datum/dna/gene/basic/midget + name="Midget" + activation_messages=list("Your skin feels rubbery.") + mutation=mSmallsize + + New() + block=SMALLSIZEBLOCK + + can_activate(var/mob/M,var/flags) + // Can't be big and small. + if(HULK in M.mutations) + return 0 + return ..(M,flags) + + activate(var/mob/M, var/connected, var/flags) + ..(M,connected,flags) + M.pass_flags |= 1 + +/datum/dna/gene/basic/hulk + name="Hulk" + activation_messages=list("Your muscles hurt.") + mutation=HULK + + New() + block=HULKBLOCK + + can_activate(var/mob/M,var/flags) + // Can't be big and small. + if(mSmallsize in M.mutations) + return 0 + return ..(M,flags) + +/datum/dna/gene/basic/xray + name="X-Ray Vision" + activation_messages=list("The walls suddenly disappear.") + mutation=XRAY + + New() + block=XRAYBLOCK + +/datum/dna/gene/basic/tk + name="Telekenesis" + activation_messages=list("You feel smarter.") + mutation=TK + activation_prob=15 + + New() + block=TELEBLOCK \ No newline at end of file diff --git a/code/game/gamemodes/setupgame.dm b/code/game/gamemodes/setupgame.dm index c72f56f8cf..813bbbabf2 100644 --- a/code/game/gamemodes/setupgame.dm +++ b/code/game/gamemodes/setupgame.dm @@ -2,7 +2,7 @@ // (mostly) DNA2 SETUP ///////////////////////// -// Randomize block, assign a reference name, and optionally define difficulty (by making activation zone smaller or bigger) +// Randomize block, assign a reference name, and optionally define difficulty (by making activation zone smaller or bigger) // The name is used on /vg/ for species with predefined genetic traits, // and for the DNA panel in the player panel. /proc/getAssignedBlock(var/name,var/list/blocksLeft, var/activity_bounds=DNA_DEFAULT_BOUNDS) @@ -74,7 +74,7 @@ XRAYBLOCK = getAssignedBlock("XRAY", numsToAssign, DNA_HARDER_BOUNDS) CLUMSYBLOCK = getAssignedBlock("CLUMSY", numsToAssign) FAKEBLOCK = getAssignedBlock("FAKE", numsToAssign) - + // UNUSED! //COUGHBLOCK = getAssignedBlock("COUGH", numsToAssign) //GLASSESBLOCK = getAssignedBlock("GLASSES", numsToAssign) @@ -96,8 +96,20 @@ //SHOCKIMMUNITYBLOCK = getAssignedBlock("SHOCKIMMUNITY", numsToAssign) //SMALLSIZEBLOCK = getAssignedBlock("SMALLSIZE", numsToAssign, DNA_HARD_BOUNDS) - - + // And the genes that actually do the work. (domutcheck improvements) + var/list/blocks_assigned[STRUCDNASIZE] + for(var/gene_type in typesof(/datum/dna/gene)) + var/datum/dna/gene/G = new gene_type + if(G.block) + if(G.block in blocks_assigned) + warning("DNA2: Gene [G.name] trying to use already-assigned block [G.block] (used by [english_list(blocks_assigned[G.block])])") + dna_genes.Add(G) + var/list/assignedToBlock[0] + if(blocks_assigned[G.block]) + assignedToBlock=blocks_assigned[G.block] + assignedToBlock.Add(G.name) + blocks_assigned[G.block]=assignedToBlock + testing("DNA2: Gene [G.name] assigned to block [G.block].") // HIDDEN MUTATIONS / SUPERPOWERS INITIALIZTION diff --git a/code/game/machinery/cloning.dm b/code/game/machinery/cloning.dm index 40a0aa4c6c..1503ff6ebe 100644 --- a/code/game/machinery/cloning.dm +++ b/code/game/machinery/cloning.dm @@ -30,25 +30,42 @@ icon_state = "datadisk0" //Gosh I hope syndies don't mistake them for the nuke disk. item_state = "card-id" w_class = 1.0 - var/data = "" - var/ue = 0 - var/data_type = "ui" //ui|se - var/owner = "God Emperor of Mankind" + var/datum/dna2/record/buf=null var/read_only = 0 //Well,it's still a floppy disk +/obj/item/weapon/disk/data/proc/Initialize() + buf = new + buf.dna=new + /obj/item/weapon/disk/data/demo name = "data disk - 'God Emperor of Mankind'" - data = "066000033000000000AF00330660FF4DB002690" - //data = "0C80C80C80C80C80C8000000000000161FBDDEF" - Farmer Jeff - ue = 1 read_only = 1 + New() + Initialize() + buf.types=DNA2_BUF_UE|DNA2_BUF_UI + //data = "066000033000000000AF00330660FF4DB002690" + //data = "0C80C80C80C80C80C8000000000000161FBDDEF" - Farmer Jeff + buf.dna.real_name="God Emperor of Mankind" + buf.dna.unique_enzymes = md5(buf.dna.real_name) + buf.dna.UI=list(0x066,0x000,0x033,0x000,0x000,0x000,0xAF0,0x033,0x066,0x0FF,0x4DB,0x002,0x690) + //buf.dna.UI=list(0x0C8,0x0C8,0x0C8,0x0C8,0x0C8,0x0C8,0x000,0x000,0x000,0x000,0x161,0xFBD,0xDEF) // Farmer Jeff + buf.dna.UpdateUI() + /obj/item/weapon/disk/data/monkey name = "data disk - 'Mr. Muggles'" - data_type = "se" - data = "0983E840344C39F4B059D5145FC5785DC6406A4FFF" read_only = 1 + New() + Initialize() + buf.types=DNA2_BUF_SE + var/list/new_SE=list(0x098,0x3E8,0x403,0x44C,0x39F,0x4B0,0x59D,0x514,0x5FC,0x578,0x5DC,0x640,0x6A4) + for(var/i=new_SE.len;i<=STRUCDNASIZE;i++) + new_SE += rand(1,1024) + buf.dna.SE=new_SE + buf.dna.SetSEValue(MONKEYBLOCK,0xFFF) + + //Find a dead mob with a brain and client. /proc/find_dead_player(var/find_key) if (isnull(find_key)) @@ -102,6 +119,7 @@ return src.healthstring /obj/machinery/clonepod/attack_ai(mob/user as mob) + src.add_hiddenprint(user) return attack_hand(user) /obj/machinery/clonepod/attack_paw(mob/user as mob) return attack_hand(user) @@ -116,20 +134,20 @@ //Clonepod //Start growing a human clone in the pod! -/obj/machinery/clonepod/proc/growclone(var/ckey, var/clonename, var/list/ui, var/list/se, var/mindref, var/datum/species/mrace, var/languages) +/obj/machinery/clonepod/proc/growclone(var/datum/dna2/record/R) if(mess || attempting) return 0 - var/datum/mind/clonemind = locate(mindref) + var/datum/mind/clonemind = locate(R.mind) if(!istype(clonemind,/datum/mind)) //not a mind return 0 if( clonemind.current && clonemind.current.stat != DEAD ) //mind is associated with a non-dead body return 0 if(clonemind.active) //somebody is using that mind - if( ckey(clonemind.key)!=ckey ) + if( ckey(clonemind.key)!=R.ckey ) return 0 else for(var/mob/dead/observer/G in player_list) - if(G.ckey == ckey) + if(G.ckey == R.ckey) if(G.can_reenter_corpse) break else @@ -147,9 +165,9 @@ var/mob/living/carbon/human/H = new /mob/living/carbon/human(src) occupant = H - if(!clonename) //to prevent null names - clonename = "clone ([rand(0,999)])" - H.real_name = clonename + if(!R.dna.real_name) //to prevent null names + R.dna.real_name = "clone ([rand(0,999)])" + H.real_name = R.dna.real_name src.icon_state = "pod_1" //Get the clone body ready @@ -161,7 +179,7 @@ H.updatehealth() clonemind.transfer_to(H) - H.ckey = ckey + H.ckey = R.ckey H << "Consciousness slowly creeps over you as your body regenerates.
So this is what cloning feels like?
" // -- Mode/mind specific stuff goes here @@ -180,24 +198,24 @@ // -- End mode specific stuff - if(!H.dna) + if(!R.dna) H.dna = new /datum/dna() H.dna.real_name = H.real_name - if(ui) - H.UpdateAppearance(ui) - if(se) - H.dna.SE = se - H.dna.UpdateSE() - randmutb(H) //Sometimes the clones come out wrong. + else + H.dna=R.dna + H.UpdateAppearance() + randmutb(H) //Sometimes the clones come out wrong. + H.dna.UpdateSE() + H.dna.UpdateUI() H.f_style = "Shaved" - if(mrace.name == "Human") //no more xenos losing ears/tentacles + if(R.dna.species == "Human") //no more xenos losing ears/tentacles H.h_style = pick("Bedhead", "Bedhead 2", "Bedhead 3") - H.species = mrace - for(var/datum/language/L in languages) - H.add_language(L.name) - H.update_mutantrace() + H.set_species(R.dna.species) + + //for(var/datum/language/L in languages) + // H.add_language(L.name) H.suiciding = 0 src.attempting = 0 return 1 diff --git a/code/game/machinery/computer/cloning.dm b/code/game/machinery/computer/cloning.dm index f5e3cf0fe3..293046b076 100644 --- a/code/game/machinery/computer/cloning.dm +++ b/code/game/machinery/computer/cloning.dm @@ -10,7 +10,7 @@ var/scantemp = "Scanner unoccupied" var/menu = 1 //Which menu screen to display var/list/records = list() - var/datum/data/record/active_record = null + var/datum/dna2/record/active_record = null var/obj/item/weapon/disk/data/diskette = null //Mostly so the geneticist can steal everything. var/loading = 0 // Nice loading text @@ -136,8 +136,8 @@ if(2) dat += "

Current records

" dat += "Back

" - for(var/datum/data/record/R in src.records) - dat += "[R.fields["id"]]-[R.fields["name"]]
" + for(var/datum/dna2/record/R in src.records) + dat += "
  • [R.dna.real_name]
  • " if(3) dat += "

    Selected Record

    " @@ -146,10 +146,11 @@ if (!src.active_record) dat += "ERROR: Record not found." else - dat += "
    Delete Record
    " - dat += "Name: [src.active_record.fields["name"]]
    " - - var/obj/item/weapon/implant/health/H = locate(src.active_record.fields["imp"]) + dat += {"
    Delete Record
    + Name: [src.active_record.dna.real_name]
    "} + var/obj/item/weapon/implant/health/H = null + if(src.active_record.implant) + H=locate(src.active_record.implant) if ((H) && (istype(H))) dat += "Health: [H.sensehealth()] | OXY-BURN-TOX-BRUTE
    " @@ -166,13 +167,13 @@ else dat += "
    " //Keeping a line empty for appearances I guess. - dat += {"UI: [src.active_record.fields["UI"]]
    - SE: [src.active_record.fields["SE"]]

    "} + dat += {"UI: [src.active_record.dna.uni_identity]
    + SE: [src.active_record.dna.struc_enzymes]

    "} if(pod1 && pod1.biomass >= CLONE_BIOMASS) dat += {"Clone
    "} else - dat += {"Unsufficient biomass
    "} + dat += {"Insufficient biomass
    "} if(4) if (!src.active_record) @@ -217,8 +218,8 @@ else if (href_list["view_rec"]) src.active_record = locate(href_list["view_rec"]) - if(istype(src.active_record,/datum/data/record)) - if ((isnull(src.active_record.fields["ckey"])) || (src.active_record.fields["ckey"] == "")) + if(istype(src.active_record,/datum/dna2/record)) + if ((isnull(src.active_record.ckey))) del(src.active_record) src.temp = "ERROR: Record Corrupt" else @@ -248,7 +249,7 @@ else if (href_list["disk"]) //Load or eject. switch(href_list["disk"]) if("load") - if ((isnull(src.diskette)) || (src.diskette.data == "")) + if ((isnull(src.diskette)) || isnull(src.diskette.buf)) src.temp = "Load error." src.updateUsrDialog() return @@ -258,12 +259,7 @@ src.updateUsrDialog() return - if (src.diskette.data_type == "ui") - src.active_record.fields["UI"] = src.diskette.data - if (src.diskette.ue) - src.active_record.fields["name"] = src.diskette.owner - else if (src.diskette.data_type == "se") - src.active_record.fields["SE"] = src.diskette.data + src.active_record = src.diskette.buf src.temp = "Load successful." if("eject") @@ -277,28 +273,24 @@ src.updateUsrDialog() return + // DNA2 makes things a little simpler. + src.diskette.buf=src.active_record + src.diskette.buf.types=0 switch(href_list["save_disk"]) //Save as Ui/Ui+Ue/Se if("ui") - src.diskette.data = src.active_record.fields["UI"] - src.diskette.ue = 0 - src.diskette.data_type = "ui" + src.diskette.buf.types=DNA2_BUF_UI if("ue") - src.diskette.data = src.active_record.fields["UI"] - src.diskette.ue = 1 - src.diskette.data_type = "ui" + src.diskette.buf.types=DNA2_BUF_UI|DNA2_BUF_UE if("se") - src.diskette.data = src.active_record.fields["SE"] - src.diskette.ue = 0 - src.diskette.data_type = "se" - src.diskette.owner = src.active_record.fields["name"] - src.diskette.name = "data disk - '[src.diskette.owner]'" + src.diskette.buf.types=DNA2_BUF_SE + src.diskette.name = "data disk - '[src.active_record.dna.real_name]'" src.temp = "Save \[[href_list["save_disk"]]\] successful." else if (href_list["refresh"]) src.updateUsrDialog() else if (href_list["clone"]) - var/datum/data/record/C = locate(href_list["clone"]) + var/datum/dna2/record/C = locate(href_list["clone"]) //Look for that player! They better be dead! if(istype(C)) //Can't clone without someone to clone. Or a pod. Or if the pod is busy. Or full of gibs. @@ -313,17 +305,17 @@ else if(!config.revival_cloning) temp = "Error: Unable to initiate cloning cycle." - else if(pod1.growclone(C.fields["ckey"], C.fields["name"], C.fields["UI"], C.fields["SE"], C.fields["mind"], C.fields["mrace"], C.fields["languages"])) + else if(pod1.growclone(C)) temp = "Initiating cloning cycle..." records.Remove(C) del(C) menu = 1 else - var/mob/selected = find_dead_player("[C.fields["ckey"]]") + var/mob/selected = find_dead_player("[C.ckey]") selected << 'sound/machines/chime.ogg' //probably not the best sound but I think it's reasonable var/answer = alert(selected,"Do you want to return to life?","Cloning","Yes","No") - if(answer != "No" && pod1.growclone(C.fields["ckey"], C.fields["name"], C.fields["UI"], C.fields["SE"], C.fields["mind"], C.fields["mrace"], C.fields["languages"], C.fields["interface"])) + if(answer != "No" && pod1.growclone(C)) temp = "Initiating cloning cycle..." records.Remove(C) del(C) @@ -363,27 +355,25 @@ subject.dna.check_integrity() - var/datum/data/record/R = new /datum/data/record( ) - R.fields["mrace"] = subject.species - R.fields["ckey"] = subject.ckey - R.fields["name"] = subject.real_name - R.fields["id"] = copytext(md5(subject.real_name), 2, 6) - R.fields["UI"] = subject.dna.UI - R.fields["SE"] = subject.dna.SE - R.fields["languages"] = subject.languages + var/datum/dna2/record/R = new /datum/dna2/record() + R.dna=subject.dna + R.ckey = subject.ckey + R.id= copytext(md5(subject.real_name), 2, 6) + R.name=R.dna.real_name + R.types=DNA2_BUF_UI|DNA2_BUF_UE|DNA2_BUF_SE //Add an implant if needed var/obj/item/weapon/implant/health/imp = locate(/obj/item/weapon/implant/health, subject) if (isnull(imp)) imp = new /obj/item/weapon/implant/health(subject) imp.implanted = subject - R.fields["imp"] = "\ref[imp]" + R.implant = "\ref[imp]" //Update it if needed else - R.fields["imp"] = "\ref[imp]" + R.implant = "\ref[imp]" if (!isnull(subject.mind)) //Save that mind so traitors can continue traitoring after cloning. - R.fields["mind"] = "\ref[subject.mind]" + R.mind = "\ref[subject.mind]" src.records += R scantemp = "Subject successfully scanned." @@ -391,8 +381,8 @@ //Find a specific record by key. /obj/machinery/computer/cloning/proc/find_record(var/find_key) var/selected_record = null - for(var/datum/data/record/R in src.records) - if (R.fields["ckey"] == find_key) + for(var/datum/dna2/record/R in src.records) + if (R.ckey == find_key) selected_record = R break return selected_record diff --git a/code/game/objects/items/weapons/dna_injector.dm b/code/game/objects/items/weapons/dna_injector.dm index fd878e8582..d0b19f88e9 100644 --- a/code/game/objects/items/weapons/dna_injector.dm +++ b/code/game/objects/items/weapons/dna_injector.dm @@ -3,11 +3,8 @@ desc = "This injects the person with DNA." icon = 'icons/obj/items.dmi' icon_state = "dnainjector" - var/dnatype = null - var/list/dna = null - var/block = null - var/owner = null - var/ue = null + var/block=0 + var/datum/dna2/record/buf=null var/s_time = 10.0 throw_speed = 1 throw_range = 5 @@ -17,57 +14,76 @@ var/is_bullet = 0 var/inuse = 0 + // USE ONLY IN PREMADE SYRINGES. WILL NOT WORK OTHERWISE. + var/datatype=0 + var/value=0 + +/obj/item/weapon/dnainjector/New() + if(datatype && block) + buf=new + buf.dna=new + buf.types = datatype + buf.dna.ResetSE() + //testing("[name]: DNA2 SE blocks prior to SetValue: [english_list(buf.dna.SE)]") + SetValue(src.value) + //testing("[name]: DNA2 SE blocks after SetValue: [english_list(buf.dna.SE)]") + /obj/item/weapon/dnainjector/attack_paw(mob/user as mob) return attack_hand(user) +/obj/item/weapon/dnainjector/proc/GetRealBlock(var/selblock) + if(selblock==0) + return block + else + return selblock /obj/item/weapon/dnainjector/proc/GetState(var/selblock=0) - var/real_block - if(!selblock) - real_block=block - selblock=1 + var/real_block=GetRealBlock(selblock) + if(buf.types&DNA2_BUF_SE) + return buf.dna.GetSEState(real_block) else - real_block=selblock - var/list/BOUNDS = GetDNABounds(real_block) - return dna[selblock] > BOUNDS[DNA_ON_LOWERBOUND] + return buf.dna.GetUIState(real_block) /obj/item/weapon/dnainjector/proc/SetState(var/on, var/selblock=0) - var/real_block - if(!selblock) - real_block=block - selblock=1 + var/real_block=GetRealBlock(selblock) + if(buf.types&DNA2_BUF_SE) + return buf.dna.SetSEState(real_block,on) else - real_block=selblock - var/list/BOUNDS=GetDNABounds(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 + return buf.dna.SetUIState(real_block,on) -/obj/item/weapon/dnainjector/proc/GetValue(var/block=1) - return dna[block] +/obj/item/weapon/dnainjector/proc/GetValue(var/selblock=0) + var/real_block=GetRealBlock(selblock) + if(buf.types&DNA2_BUF_SE) + return buf.dna.GetSEValue(real_block) + else + return buf.dna.GetUIValue(real_block) + +/obj/item/weapon/dnainjector/proc/SetValue(var/val,var/selblock=0) + var/real_block=GetRealBlock(selblock) + if(buf.types&DNA2_BUF_SE) + return buf.dna.SetSEValue(real_block,val) + else + return buf.dna.SetUIValue(real_block,val) /obj/item/weapon/dnainjector/proc/inject(mob/M as mob, mob/user as mob) if(istype(M,/mob/living)) M.radiation += rand(5,20) if (!(NOCLONE in M.mutations)) // prevents drained people from having their DNA changed - if (dnatype == "ui") + if (buf.types & DNA2_BUF_UI) if (!block) //isolated block? - M.UpdateAppearance(dna) - if (ue) //unique enzymes? yes - M.real_name = ue - M.name = ue + M.UpdateAppearance(buf.dna) + if (buf.types & DNA2_BUF_UE) //unique enzymes? yes + M.real_name = buf.dna.real_name + M.name = buf.dna.real_name uses-- else M.dna.SetUIValue(block,src.GetValue()) M.UpdateAppearance() uses-- - if (dnatype == "se") + if (buf.types & DNA2_BUF_SE) if (!block) //isolated block? - M.dna.SE = dna + M.dna.SE = buf.dna.SE M.dna.UpdateSE() else M.dna.SetSEValue(block,src.GetValue()) @@ -107,15 +123,24 @@ spawn(50) // Not the best fix. There should be an failure proc, for /effect/equip_e/, which is called when the first initital checks fail inuse = 0 M.requests += O - if (dnatype == "se") - // So you're checking for 14, and yet MONKEYBLOCK is 27 in globals.dm, - // and domutcheck checks MONKEYBLOCK...? wat. - N3X - //if (isblockon(getblock(dna, 14,3),14) && istype(M, /mob/living/carbon/human)) - if (GetState(MONKEYBLOCK) && istype(M, /mob/living/carbon/human) ) - msg_admin_attack("[key_name_admin(user)] injected [key_name_admin(M)] with the [name] \red(MONKEY) (JMP)") + if (buf.types & DNA2_BUF_SE) + if(block)// Isolated injector + testing("Isolated block [block] injector with contents: [GetValue()]") + 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]") + testing("DNA injector with contents: [english_list(buf.dna.SE)]") + 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 // 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]") @@ -132,15 +157,24 @@ if (!(istype(M, /mob/living/carbon/human) || istype(M, /mob/living/carbon/monkey))) user << "\red Apparently it didn't work." return - if (dnatype == "se") - // And again... ? - //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)") + + if (buf.types & DNA2_BUF_SE) + if(block)// Isolated injector + testing("Isolated block [block] injector with contents: [GetValue()]") + 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_game("[key_name(user)] injected [key_name(M)] with the [name]") + testing("DNA injector with contents: [english_list(buf.dna.SE)]") + 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 + // message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name]") + log_game("[key_name(user)] injected [key_name(M)] with the [name]") else // message_admins("[key_name_admin(user)] injected [key_name_admin(M)] with the [name]") log_game("[key_name(user)] injected [key_name(M)] with the [name]") @@ -165,460 +199,462 @@ /obj/item/weapon/dnainjector/hulkmut name = "DNA-Injector (Hulk)" desc = "This will make you big and strong, but give you a bad skin condition." - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 2 New() - ..() block = HULKBLOCK + ..() /obj/item/weapon/dnainjector/antihulk name = "DNA-Injector (Anti-Hulk)" desc = "Cures green skin." - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //block = 2 New() - ..() block = HULKBLOCK + ..() /obj/item/weapon/dnainjector/xraymut name = "DNA-Injector (Xray)" desc = "Finally you can see what the Captain does." - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 8 New() - ..() block = XRAYBLOCK + ..() /obj/item/weapon/dnainjector/antixray name = "DNA-Injector (Anti-Xray)" desc = "It will make you see harder." - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //block = 8 New() - ..() block = XRAYBLOCK + ..() /obj/item/weapon/dnainjector/firemut name = "DNA-Injector (Fire)" desc = "Gives you fire." - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 10 New() - ..() block = FIREBLOCK + ..() /obj/item/weapon/dnainjector/antifire name = "DNA-Injector (Anti-Fire)" desc = "Cures fire." - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //block = 10 New() - ..() block = FIREBLOCK + ..() /obj/item/weapon/dnainjector/telemut name = "DNA-Injector (Tele.)" desc = "Super brain man!" - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //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) + datatype = DNA2_BUF_SE + value = 0x001 //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) + datatype = DNA2_BUF_SE + value = 0xFFF //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) + datatype = DNA2_BUF_SE + value = 0x001 //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) + datatype = DNA2_BUF_SE + value = 0xFFF //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) + datatype = DNA2_BUF_SE + value = 0x001 //block = 2 New() - ..() block = REMOTEVIEWBLOCK + ..() /obj/item/weapon/dnainjector/regenerate name = "DNA-Injector (Regeneration)" desc = "Healthy but hungry." - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 2 New() - ..() block = REGENERATEBLOCK + ..() /obj/item/weapon/dnainjector/antiregenerate name = "DNA-Injector (Anti-Regeneration)" desc = "Sickly but sated." - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //block = 2 New() - ..() block = REGENERATEBLOCK + ..() /obj/item/weapon/dnainjector/runfast name = "DNA-Injector (Increase Run)" desc = "Running Man." - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 2 New() - ..() block = INCREASERUNBLOCK + ..() /obj/item/weapon/dnainjector/antirunfast name = "DNA-Injector (Anti-Increase Run)" desc = "Walking Man." - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //block = 2 New() - ..() block = INCREASERUNBLOCK + ..() /obj/item/weapon/dnainjector/morph name = "DNA-Injector (Morph)" desc = "A total makeover." - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 2 New() - ..() block = MORPHBLOCK + ..() /obj/item/weapon/dnainjector/antimorph name = "DNA-Injector (Anti-Morph)" desc = "Cures identity crisis." - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //block = 2 New() - ..() block = MORPHBLOCK -/* + ..() + +/* No COLDBLOCK on bay /obj/item/weapon/dnainjector/cold name = "DNA-Injector (Cold)" desc = "Feels a bit chilly." - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 2 New() - ..() block = COLDBLOCK + ..() /obj/item/weapon/dnainjector/anticold name = "DNA-Injector (Anti-Cold)" desc = "Feels room-temperature." - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //block = 2 New() - ..() block = COLDBLOCK + ..() */ + /obj/item/weapon/dnainjector/noprints name = "DNA-Injector (No Prints)" desc = "Better than a pair of budget insulated gloves." - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //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) + datatype = DNA2_BUF_SE + value = 0x001 //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) + datatype = DNA2_BUF_SE + value = 0xFFF //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) + datatype = DNA2_BUF_SE + value = 0x001 //block = 2 New() - ..() block = SHOCKIMMUNITYBLOCK + ..() /obj/item/weapon/dnainjector/midgit name = "DNA-Injector (Small Size)" desc = "Makes you shrink." - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //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) + datatype = DNA2_BUF_SE + value = 0x001 //block = 2 New() - ..() block = SMALLSIZEBLOCK + ..() ///////////////////////////////////// /obj/item/weapon/dnainjector/antiglasses name = "DNA-Injector (Anti-Glasses)" desc = "Toss away those glasses!" - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //block = 1 New() - ..() block = GLASSESBLOCK + ..() /obj/item/weapon/dnainjector/glassesmut name = "DNA-Injector (Glasses)" desc = "Will make you need dorkish glasses." - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 1 New() - ..() block = GLASSESBLOCK + ..() /obj/item/weapon/dnainjector/epimut name = "DNA-Injector (Epi.)" desc = "Shake shake shake the room!" - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //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 = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //block = 3 New() - ..() block = HEADACHEBLOCK + ..() /obj/item/weapon/dnainjector/anticough name = "DNA-Injector (Anti-Cough)" desc = "Will stop that awful noise." - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //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 = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 5 New() - ..() block = COUGHBLOCK + ..() /obj/item/weapon/dnainjector/clumsymut name = "DNA-Injector (Clumsy)" desc = "Makes clumsy minions." - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 6 New() - ..() block = CLUMSYBLOCK + ..() /obj/item/weapon/dnainjector/anticlumsy name = "DNA-Injector (Anti-Clumy)" desc = "Cleans up confusion." - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //block = 6 New() - ..() block = CLUMSYBLOCK + ..() /obj/item/weapon/dnainjector/antitour name = "DNA-Injector (Anti-Tour.)" desc = "Will cure tourrets." - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //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 = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 7 New() - ..() block = TWITCHBLOCK + ..() /obj/item/weapon/dnainjector/stuttmut name = "DNA-Injector (Stutt.)" desc = "Makes you s-s-stuttterrr" - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 9 New() - ..() block = NERVOUSBLOCK + ..() /obj/item/weapon/dnainjector/antistutt name = "DNA-Injector (Anti-Stutt.)" desc = "Fixes that speaking impairment." - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //block = 9 New() - ..() block = NERVOUSBLOCK + ..() /obj/item/weapon/dnainjector/blindmut name = "DNA-Injector (Blind)" desc = "Makes you not see anything." - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 11 New() - ..() block = BLINDBLOCK + ..() /obj/item/weapon/dnainjector/antiblind name = "DNA-Injector (Anti-Blind)" desc = "ITS A MIRACLE!!!" - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //block = 11 New() - ..() block = BLINDBLOCK + ..() /obj/item/weapon/dnainjector/deafmut name = "DNA-Injector (Deaf)" desc = "Sorry, what did you say?" - dnatype = "se" - dna = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 13 New() - ..() block = DEAFBLOCK + ..() /obj/item/weapon/dnainjector/antideaf name = "DNA-Injector (Anti-Deaf)" desc = "Will make you hear once more." - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //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) + datatype = DNA2_BUF_SE + value = 0xFFF //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) + datatype = DNA2_BUF_SE + value = 0x001 //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 = list(4090) + datatype = DNA2_BUF_SE + value = 0xFFF //block = 14 New() - ..() block = MONKEYBLOCK + ..() /obj/item/weapon/dnainjector/m2h name = "DNA-Injector (Monkey > Human)" desc = "Will make you...less hairy." - dnatype = "se" - dna = list(1) + datatype = DNA2_BUF_SE + value = 0x001 //block = 14 New() - ..() block = MONKEYBLOCK + ..() \ No newline at end of file diff --git a/code/modules/events/radiation_storm.dm b/code/modules/events/radiation_storm.dm index ad79eed516..91bf29e00a 100644 --- a/code/modules/events/radiation_storm.dm +++ b/code/modules/events/radiation_storm.dm @@ -34,10 +34,10 @@ H.apply_effect((rand(40,70)),IRRADIATE,0) if (prob(75)) randmutb(H) // Applies bad mutation - domutcheck(H,null,1) + domutcheck(H,null,MUTCHK_FORCED) else randmutg(H) // Applies good mutation - domutcheck(H,null,1) + domutcheck(H,null,MUTCHK_FORCED) for(var/mob/living/carbon/monkey/M in living_mob_list) diff --git a/code/modules/mob/living/carbon/monkey/life.dm b/code/modules/mob/living/carbon/monkey/life.dm index 6c28acc72b..0cd4565d22 100644 --- a/code/modules/mob/living/carbon/monkey/life.dm +++ b/code/modules/mob/living/carbon/monkey/life.dm @@ -13,6 +13,9 @@ set invisibility = 0 set background = 1 if (monkeyizing) return + if (update_muts) + update_muts=0 + domutcheck(src,null,MUTCHK_FORCED) ..() var/datum/gas_mixture/environment // Added to prevent null location errors-- TLE diff --git a/code/modules/mob/living/carbon/monkey/monkey.dm b/code/modules/mob/living/carbon/monkey/monkey.dm index e050a30c5b..b0ddd30c73 100644 --- a/code/modules/mob/living/carbon/monkey/monkey.dm +++ b/code/modules/mob/living/carbon/monkey/monkey.dm @@ -10,28 +10,31 @@ var/obj/item/weapon/card/id/wear_id = null // Fix for station bounced radios -- Skie var/greaterform = "Human" // Used when humanizing a monkey. - var/uni_append = "12C4E2" // Small appearance modifier for different species. + icon_state = "monkey1" + //var/uni_append = "12C4E2" // Small appearance modifier for different species. + var/list/uni_append = list(0x12C,0x4E2) // Same as above for DNA2. + var/update_muts = 1 // Monkey gene must be set at start. /mob/living/carbon/monkey/tajara name = "farwa" voice_name = "farwa" speak_emote = list("mews") icon_state = "tajkey1" - uni_append = "0A0E00" + uni_append = list(0x0A0,0xE00) // 0A0E00 /mob/living/carbon/monkey/skrell name = "neaera" voice_name = "neaera" speak_emote = list("squicks") icon_state = "skrellkey1" - uni_append = "01CC92" + uni_append = list(0x01C,0xC92) // 01CC92 /mob/living/carbon/monkey/unathi name = "stok" voice_name = "stok" speak_emote = list("hisses") icon_state = "stokkey1" - uni_append = "044C5D" + uni_append = list(0x044,0xC5D) // 044C5D /mob/living/carbon/monkey/New() var/datum/reagents/R = new/datum/reagents(1000) @@ -52,13 +55,20 @@ //dna.uni_identity = "00600200A00E0110148FC01300B009" //dna.struc_enzymes = "43359156756131E13763334D1C369012032164D4FE4CD61544B6C03F251B6C60A42821D26BA3B0FD6" dna.unique_enzymes = md5(name) - //////////blah - var/gendervar - if (gender == MALE) - gendervar = add_zero2(num2hex((rand(1,2049)),1), 3) - else - gendervar = add_zero2(num2hex((rand(2051,4094)),1), 3) - dna.uni_identity += "[gendervar][uni_append]" + + // We're a monkey + dna.SetSEState(MONKEYBLOCK, 1) + // Fix gender + dna.SetUIState(DNA_UI_GENDER, gender != MALE, 1) + + // Set the blocks to uni_append, if needed. + if(uni_append.len>0) + for(var/b=1;b<=uni_append.len;b++) + dna.SetUIValue(DNA_UI_LENGTH-(uni_append.len-b),uni_append[b], 1) + dna.UpdateUI() + + update_muts=1 + ..() update_icons() return diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 85992e55fa..2f8ff455b2 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -216,3 +216,5 @@ var/immune_to_ssd = 0 var/turf/listed_turf = null //the current turf being examined in the stat panel + + var/list/active_genes=list()