From 8327330cb91b7562811ca6e012c118ec49ddaffd Mon Sep 17 00:00:00 2001 From: Rob Nelson Date: Sun, 8 Dec 2013 18:43:38 -0800 Subject: [PATCH] Integrate new gene handling. Conflicts: code/game/dna/dna2_helpers.dm code/game/dna/genes/powers.dm --- baystation12.dme | 1 + code/game/dna/dna2.dm | 2 + code/game/dna/dna2_domutcheck.dm | 346 ++++++++++++++++++++++++++ code/game/dna/dna2_helpers.dm | 365 ---------------------------- code/game/dna/genes/disabilities.dm | 2 +- code/game/dna/genes/gene.dm | 18 +- code/game/dna/genes/monkey.dm | 6 +- code/game/dna/genes/powers.dm | 18 +- 8 files changed, 369 insertions(+), 389 deletions(-) create mode 100644 code/game/dna/dna2_domutcheck.dm diff --git a/baystation12.dme b/baystation12.dme index 9b1d66b8462..b6b7eb4e0d4 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -202,6 +202,7 @@ #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" diff --git a/code/game/dna/dna2.dm b/code/game/dna/dna2.dm index bb4f841f701..6007c07e7b0 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 diff --git a/code/game/dna/dna2_domutcheck.dm b/code/game/dna/dna2_domutcheck.dm new file mode 100644 index 00000000000..a55218275b9 --- /dev/null +++ b/code/game/dna/dna2_domutcheck.dm @@ -0,0 +1,346 @@ +// (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, var/flags) + for(var/datum/dna/gene/gene in dna_genes) + if(!gene.block) + continue + + // Sanity checks, don't skip. + if(!gene.can_activate(M,connected,flags)) + 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)) + gene.activate(M) + if(!(gene.flags & GENE_ALWAYS_ACTIVATE)) + M.active_genes |= gene.type + M.update_icon=1 + else if(!gene_active && gene_prior_status) + gene.deactivate(M) + M.active_genes -= gene.type + M.update_icon=1 + +/* 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 1f73acba6f1..f8efe170597 100644 --- a/code/game/dna/dna2_helpers.dm +++ b/code/game/dna/dna2_helpers.dm @@ -171,368 +171,3 @@ /proc/probinj(var/pr, var/inj) return prob(pr+inj*pr) -// Mutations we simply transfer over without checking. -var/global/ignore_mutations=list(PLANT,SKELETON,FAT,HUSK) - -// Mutations we simply transfer over without checking. -var/global/dna_genes=list(PLANT,SKELETON,FAT,HUSK) - -// (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, 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 - - var/forced = (flags & MUTCHK_FORCED) == MUTCHK_FORCED - - for(var/legacy_mut in ignore_mutations) - if(legacy_mut in old_mutations) - M.mutations.Add(legacy_mut) - - for(var/datum/dna/gene/G in dna_genes) - if(G.block) - if(M.dna.GetSEState(G.block)) - if(forced || G.can_activate(M,old_mutations,flags)) - if(!(G.type in M.active_genes)) - G.activate(M, connected) - else - if(G.type in M.active_genes) - G.deactivate(M, connected) - - M.update_icon=1 - -/* 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 -<<<<<<< HEAD -======= - 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" ->>>>>>> b65818e... Start wrapping up the new domutcheck logic - 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)) -<<<<<<< HEAD - if(probinj(30,inj) || (COLD_RESISTANCE in old_mutations)) - M << "\blue Your body feels warm." - M.mutations.Add(COLD_RESISTANCE) -======= - 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) ->>>>>>> b65818e... Start wrapping up the new domutcheck logic - 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 -*/ diff --git a/code/game/dna/genes/disabilities.dm b/code/game/dna/genes/disabilities.dm index e25f8eec4a9..3243527557a 100644 --- a/code/game/dna/genes/disabilities.dm +++ b/code/game/dna/genes/disabilities.dm @@ -22,7 +22,7 @@ // Activation message var/activation_message="" -/datum/dna/gene/disability/can_activate(var/mob/M,var/list/old_mutations,var/flags) +/datum/dna/gene/disability/can_activate(var/mob/M,var/flags) return 1 // Always set! /datum/dna/gene/disability/activate(var/mob/living/carbon/M) diff --git a/code/game/dna/genes/gene.dm b/code/game/dna/genes/gene.dm index 192784559ed..d57b9258a98 100644 --- a/code/game/dna/genes/gene.dm +++ b/code/game/dna/genes/gene.dm @@ -20,21 +20,25 @@ // What gene activates this? var/block=0 + // Any of a number of GENE_ flags. + var/flags=0 + // Called when the gene is loaded by the game. Do initial setup here. /datum/dna/gene/proc/initialize() return // Return 1 if we can activate. -/datum/dna/gene/proc/can_activate(var/mob/M,var/list/old_mutations,var/flags) +// 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) +/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) +/datum/dna/gene/proc/deactivate(var/mob/M, var/connected, var/flags) return @@ -65,16 +69,12 @@ // Possible deactivation messages var/list/deactivation_messages=list() -/datum/dna/gene/basic/can_activate(var/mob/M,var/list/old_mutations,var/flags) +/datum/dna/gene/basic/can_activate(var/mob/M,var/flags) if(mutation==0) return 0 - // Mutation already set? - if(mutation in old_mutations) - return 1 - // Probability check - if(probinj(activation_prob,(flags&MUTCHK_FORCED))) + if(flags & MUTCHK_FORCED || probinj(activation_prob,(flags&MUTCHK_FORCED))) return 1 return 0 diff --git a/code/game/dna/genes/monkey.dm b/code/game/dna/genes/monkey.dm index 76364c842f8..73adcd66576 100644 --- a/code/game/dna/genes/monkey.dm +++ b/code/game/dna/genes/monkey.dm @@ -4,10 +4,10 @@ /datum/dna/gene/monkey/initialize() block=MONKEYBLOCK -/datum/dna/gene/monkey/can_activate(var/mob/M,var/list/old_mutations,var/flags) +/datum/dna/gene/monkey/can_activate(var/mob/M,var/flags) return istype(M, /mob/living/carbon/human) -/datum/dna/gene/monkey/activate(var/mob/living/M, var/connected) +/datum/dna/gene/monkey/activate(var/mob/living/M, var/connected, var/flags) var/mob/living/carbon/human/H = M H.monkeyizing = 1 var/list/implants = list() //Try to preserve implants. @@ -82,7 +82,7 @@ del(M) return -/datum/dna/gene/monkey/deactivate(var/mob/living/M, var/connected) +/datum/dna/gene/monkey/deactivate(var/mob/living/M, var/connected, var/flags) var/mob/living/carbon/monkey/Mo = M Mo.monkeyizing = 1 var/list/implants = list() //Still preserving implants diff --git a/code/game/dna/genes/powers.dm b/code/game/dna/genes/powers.dm index 7b7390f4f5f..24e7f03dd52 100644 --- a/code/game/dna/genes/powers.dm +++ b/code/game/dna/genes/powers.dm @@ -62,7 +62,6 @@ ..(M) M.verbs += /mob/living/carbon/human/proc/morph - /datum/dna/gene/basic/cold_resist name="Cold Resistance" activation_messages=list("Your body is filled with warmth.") @@ -71,10 +70,7 @@ initialize() block=FIREBLOCK - can_activate(var/mob/M,var/list/old_mutations,var/flags) - // Mutation already set? - if(mutation in old_mutations) - return 1 + can_activate(var/mob/M,var/flags) // Probability check var/_prob=30 @@ -105,11 +101,11 @@ initialize() block=SMALLSIZEBLOCK - can_activate(var/mob/M,var/list/old_mutations,var/flags) + can_activate(var/mob/M,var/flags) // Can't be big and small. - if(HULK in old_mutations) + if(HULK in M.mutations) return 0 - return ..(M,old_mutations,flags) + return ..(M,flags) activate(var/mob/M) ..(M) @@ -123,11 +119,11 @@ initialize() block=HULKBLOCK - can_activate(var/mob/M,var/list/old_mutations,var/flags) + can_activate(var/mob/M,var/flags) // Can't be big and small. - if(mSmallsize in old_mutations) + if(mSmallsize in M.mutations) return 0 - return ..(M,old_mutations,flags) + return ..(M,flags) /datum/dna/gene/basic/xray name="X-Ray Vision"