From 80d4e405b9de5c2e19b786c266c40d7bf3b075ca Mon Sep 17 00:00:00 2001 From: "vageyenaman@gmail.com" Date: Tue, 2 Aug 2011 01:35:44 +0000 Subject: [PATCH] New DNA mutation system: see http://tgstation13.pretentiousfool.com/phpBB3/viewtopic.php?f=7&t=5584 (the code that makes this actually work has been commented out, it will be implemented maybe sometime soon) Fixed some spelling and grammar errors. Tweaked the cost of Large Energy Crossbow designs. Fixed a bug where people would generate two manifest entries when they late-joined. Annoying as fuck. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1966 316c924e-a436-60f5-8080-3fe189b3f50e --- code/defines/obj/weapon.dm | 2 +- code/game/atom_procs.dm | 97 +++++++++++++++++ code/game/dna.dm | 13 +++ code/game/dna_mutations.dm | 101 ++++++++++++++++++ code/game/gamemodes/setupgame.dm | 26 ++++- code/game/machinery/biogenerator.dm | 6 +- code/modules/admin/admin.dm | 1 + code/modules/chemical/Chemistry-Recipes.dm | 5 - code/modules/mob/living/carbon/human/human.dm | 3 + code/modules/mob/living/living.dm | 2 +- code/modules/mob/new_player/new_player.dm | 1 - code/modules/research/designs.dm | 2 +- code/setup.dm | 5 + tgstation.dme | 1 + 14 files changed, 252 insertions(+), 13 deletions(-) create mode 100644 code/game/dna_mutations.dm diff --git a/code/defines/obj/weapon.dm b/code/defines/obj/weapon.dm index 4140aae003f..9510661f30f 100644 --- a/code/defines/obj/weapon.dm +++ b/code/defines/obj/weapon.dm @@ -542,7 +542,7 @@ throw_range = 10 /obj/item/weapon/chemsprayer - desc = "Chem Sprayer" + desc = "A utility used to spray large amounts of reagent in a given area." icon = 'gun.dmi' name = "chem sprayer" icon_state = "chemsprayer" diff --git a/code/game/atom_procs.dm b/code/game/atom_procs.dm index b4a3d03bae0..8181e67e501 100644 --- a/code/game/atom_procs.dm +++ b/code/game/atom_procs.dm @@ -364,6 +364,75 @@ W.afterattack(src, usr, (t5 ? 1 : 0)) else if (istype(usr, /mob/living/carbon/human)) + if (usr:a_intent == "help") + if(istype(src, /mob/living/carbon)) + var/mob/living/carbon/C = src + if(usr:mutations & HEAL) + + if(C.stat != 2) + var/t_him = "it" + if (src.gender == MALE) + t_him = "him" + else if (src.gender == FEMALE) + t_him = "her" + var/u_him = "it" + if (usr.gender == MALE) + t_him = "him" + else if (usr.gender == FEMALE) + t_him = "her" + + if(src != usr) + usr.visible_message( \ + "\blue [usr] places [u_him] palms on [src], healing [t_him]!", \ + "\blue You place your palms on [src] and heal [t_him].", \ + ) + else + usr.visible_message( \ + "\blue [usr] places [u_him] palms on [u_him]self and heals.", \ + "\blue You place your palms on yourself and heal.", \ + ) + + C.oxyloss = max(0, C.oxyloss-25) + C.toxloss = max(0, C.toxloss-25) + + if (istype(C, /mob/living/carbon/human)) + var/mob/living/carbon/human/H = C + var/datum/organ/external/affecting = H.organs["chest"] + + var/t = usr:zone_sel:selecting + + if (t in list("eyes", "mouth")) + t = "head" + + if (H.organs[t]) + affecting = H.organs[t] + + if (affecting.heal_damage(25, 25)) + H.UpdateDamageIcon() + else + H.UpdateDamage() + C.updatehealth() + else + C.heal_organ_damage(25, 25) + + C.cloneloss = max(0, C.cloneloss-25) + + C.stunned = max(0, C.stunned-5) + C.paralysis = max(0, C.paralysis-5) + C.stuttering = max(0, C.stuttering-5) + C.drowsyness = max(0, C.drowsyness-5) + C.weakened = max(0, C.weakened-5) + + if(C.client) + C.updatehealth() + C:handle_regular_hud_updates() + usr:nutrition -= rand(1,10) + usr:handle_regular_hud_updates() + usr.next_move = world.time + 6 + else + usr << "\red [src] is dead and can't be healed." + return + src.attack_hand(usr, usr.hand) else if (istype(usr, /mob/living/carbon/monkey)) @@ -422,6 +491,34 @@ else if (istype(usr, /mob/living/carbon/alien/humanoid)) src.hand_al(usr, usr.hand) + else + if(usr:mutations & LASER && usr:a_intent == "hurt" && world.time >= usr.next_move) + var/turf/oloc + var/turf/T = get_turf(usr) + var/turf/U = get_turf(src) + if(istype(src, /turf)) oloc = src + else + oloc = loc + + if(istype(usr, /mob/living/carbon/human)) + usr:nutrition -= rand(1,5) + usr:handle_regular_hud_updates() + + var/obj/item/projectile/beam/A = new /obj/item/projectile/beam( usr.loc ) + A.icon = 'genetics.dmi' + A.icon_state = "eyelasers" + playsound(usr.loc, 'taser2.ogg', 75, 1) + + A.firer = usr + A.def_zone = usr:get_organ_target() + A.original = oloc + A.current = T + A.yo = U.y - T.y + A.xo = U.x - T.x + spawn( 1 ) + A.process() + + usr.next_move = world.time + 6 return diff --git a/code/game/dna.dm b/code/game/dna.dm index b904223dba7..13f41a0f241 100644 --- a/code/game/dna.dm +++ b/code/game/dna.dm @@ -98,6 +98,13 @@ result = copytext(input ,(blocksize*blocknumber)-(blocksize-1),(blocksize*blocknumber)+1) return result +/proc/getblockbuffer(input,blocknumber,blocksize) + var/result[3] + var/block = copytext(input ,(blocksize*blocknumber)-(blocksize-1),(blocksize*blocknumber)+1) + for(var/i = 1, i <= 3, i++) + result[i] = copytext(block, i, i+1) + return result + /proc/setblock(istring, blocknumber, replacement, blocksize) var/result result = getleftblocks(istring, blocknumber, blocksize) + replacement + getrightblocks(istring, blocknumber, blocksize) @@ -344,6 +351,12 @@ M.ear_deaf = 1 M << "\red You can't seem to hear anything..." + /* 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 (isblockon(getblock(M.dna.struc_enzymes, 14,3),14) && istype(M, /mob/living/carbon/human)) // human > monkey diff --git a/code/game/dna_mutations.dm b/code/game/dna_mutations.dm new file mode 100644 index 00000000000..e51ae5926ed --- /dev/null +++ b/code/game/dna_mutations.dm @@ -0,0 +1,101 @@ + + +/* NOTES: + +This system could be expanded to migrate all of our current mutations to. Maybe. + + +*/ + + +/* /datum/mutations : + * + * A /datum representation of "hidden" mutations. + * + */ +/datum/mutations + + var/list/requirements = list() // list of randomly-genned requirements + var/required = 1 // the number of requirements to generate + + var/list/races = list("human") // list of races the mutation effects + + proc/get_mutation(var/mob/living/carbon/M) // Called when check_mutation() is successful + ..() + + proc/check_mutation(var/mob/living/carbon/M) // Called in dna.dm, when a target's SE is modified + + if(! ("all" in races)) // "all" means it affects everyone! + if(istype(M, /mob/living/carbon/human)) + if(! ("human" in races)) + return + if(istype(M, /mob/living/carbon/monkey)) + if(! ("monkey" in races)) + return + // TODO: add more races maybe?? + + + var/passes = 0 + for(var/datum/mutationreq/require in requirements) + + var/se_block[] = getblockbuffer(M.dna.struc_enzymes, require.block, 3) // focus onto the block + if(se_block.len == 3) // we want to make sure there are exactly 3 entries + + if(se_block[require.subblock] == require.reqID) + + passes++ + + if(passes == required) // all requirements met + get_mutation(M) + + + Lasereyes + /* + Lets you shoot laser beams through your eyes. Fancy! + */ + required = 2 + + get_mutation(var/mob/living/carbon/M) + M << "\blue You feel a searing heat inside your eyes!" + M.mutations |= LASER + + Healing + /* + Lets you heal other people, and yourself. But it doesn't let you heal dead people. + */ + required = 2 + + get_mutation(var/mob/living/carbon/M) + M << "\blue You a pleasant warmth pulse throughout your body..." + M.mutations |= HEAL + +/* /datum/mutationreq : + * + * A /datum representation of a requirement in order for a mutation to happen. + * + */ + +/datum/mutationreq + var/block // The block to read + var/subblock // The sub-block to read + var/reqID // The required hexadecimal identifier to be equal to the sub-block being read. + + + + +/* +HEY: If you want to be able to get superpowers easily just uncomment this shit. +mob/verb/checkmuts() + for(var/datum/mutations/mut in global_mutations) + + for(var/datum/mutationreq/R in mut.requirements) + src << "Block: [R.block]" + src << "Sub-Block: [R.subblock]" + src << "Required ID: [R.reqID]" + src << "" + +mob/verb/editSE(t as text) + src:dna:struc_enzymes = t + domutcheck(src) + +*/ diff --git a/code/game/gamemodes/setupgame.dm b/code/game/gamemodes/setupgame.dm index 03a70840e00..78c7ac43272 100644 --- a/code/game/gamemodes/setupgame.dm +++ b/code/game/gamemodes/setupgame.dm @@ -42,6 +42,31 @@ avnums.Remove(tempnum) BLINDBLOCK = tempnum + + // HIDDEN MUTATIONS / SUPERPOWERS INITIALIZTION + + for(var/x in typesof(/datum/mutations) - /datum/mutations) + var/datum/mutations/mut = new x + + for(var/i = 1, i <= mut.required, i++) + var/datum/mutationreq/require = new/datum/mutationreq + require.block = rand(1, 13) + require.subblock = rand(1, 3) + + // Create random requirement identification + require.reqID = pick("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", \ + "B", "C", "D", "E", "F") + + mut.requirements += require + + + global_mutations += mut// add to global mutations list! + + + + + + /* This was used for something before, I think, but is not worth the effort to process now. /proc/setupcorpses() for (var/obj/landmark/A in world) @@ -140,4 +165,3 @@ del(A) continue */ - diff --git a/code/game/machinery/biogenerator.dm b/code/game/machinery/biogenerator.dm index f5c8dbe808f..1bf9675773b 100644 --- a/code/game/machinery/biogenerator.dm +++ b/code/game/machinery/biogenerator.dm @@ -34,7 +34,7 @@ /obj/machinery/biogenerator/attackby(var/obj/item/O as obj, var/mob/user as mob) if(istype(O, /obj/item/weapon/reagent_containers/glass)) if(beaker) - user << "\red Biogenerator already occuped." + user << "\red The biogenerator already occuped." else user.before_take_item(O) O.loc = src @@ -43,13 +43,13 @@ else if(!istype(O, /obj/item/weapon/reagent_containers/food/snacks/grown)) user << "\red You cannot put this in [src.name]" else if(processing) - user << "\red Biogenerator is processing." + user << "\red The biogenerator is currently processing." else var/i = 0 for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in contents) i++ if(i >= 10) - user << "\red Biogenerator is fulled! Activate it." + user << "\red The biogenerator is full! Activate it." else user.before_take_item(O) O.loc = src diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index c38034c3e5b..948a74b8b86 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -2299,6 +2299,7 @@ var/showadminmessages = 1 message_admins("\blue [key_name_admin(usr)] toggled guests game entering [guests_allowed?"":"dis"]allowed.", 1) + /obj/admins/proc/view_txt_log() set category = "Admin" set desc="Shows todays server log in new window" diff --git a/code/modules/chemical/Chemistry-Recipes.dm b/code/modules/chemical/Chemistry-Recipes.dm index c5b0af08d8c..789100780f6 100644 --- a/code/modules/chemical/Chemistry-Recipes.dm +++ b/code/modules/chemical/Chemistry-Recipes.dm @@ -543,9 +543,6 @@ datum new /obj/item/weapon/syntiflesh(location) return - - - metroidenzyme name = "Metroid Enzyme" id = "m_enzyme" @@ -602,8 +599,6 @@ datum S.start() return - - metroidchloral name = "Metroid Chloral" id = "m_bunch" diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 7d9cd1c4407..b19392dfd8f 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1015,6 +1015,9 @@ if (mutations & PORTALS) overlays += image("icon" = 'genetics.dmi', "icon_state" = "telekinesishead[fat][!lying ? "_s" : "_l"]") + if (mutations & LASER) + overlays += image("icon" = 'genetics.dmi', "icon_state" = "lasereyes[!lying ? "_s" : "_l"]") + if (mutantrace) switch(mutantrace) if("lizard","golem","metroid") diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index d0e4eff1f89..f1b88db1551 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -93,7 +93,7 @@ if(organStructure && organStructure.chest) health = organStructure.chest.maxHealth - oxyloss - toxloss - fireloss - bruteloss else - src.health = 100 - src.oxyloss - src.toxloss - src.fireloss - src.bruteloss + src.health = 100 - src.oxyloss - src.toxloss - src.fireloss - src.bruteloss - src.cloneloss else src.health = 100 src.stat = 0 diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 2f9276bd9a6..e2113f17620 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -287,7 +287,6 @@ mob/new_player else//Adds late joiners to minds so they can be linked to objectives. ticker.minds += character.mind//Cyborgs and AIs handle this in the transform proc. - data_core.manifest_inject(character) // add all the necessary stuff into the manifest del(src) else diff --git a/code/modules/research/designs.dm b/code/modules/research/designs.dm index 20e97eec209..b84f50aab16 100644 --- a/code/modules/research/designs.dm +++ b/code/modules/research/designs.dm @@ -1071,7 +1071,7 @@ datum id = "largecrossbow" req_tech = list("combat" = 4, "materials" = 5, "engineering" = 3, "biotech" = 4, "syndicate" = 3) build_type = PROTOLATHE - materials = list("$metal" = 5000, "$glass" = 1000) + materials = list("$metal" = 5000, "$glass" = 1000, "$uranium" = 1000, "$silver" = 1000) build_path = "/obj/item/weapon/gun/energy/largecrossbow" freeze_gun diff --git a/code/setup.dm b/code/setup.dm index 0a359ff7c5e..03c2c84ae09 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -146,6 +146,8 @@ #define CLOWN 16 #define FAT 32 #define HUSK 64 //changeling-drained +#define LASER 128 +#define HEAL 256 // channel numbers for power @@ -191,3 +193,6 @@ var/const var/list/accessable_z_levels = list("1" = 10, "3" = 15, "4" = 60, "5" = 15) //This list contains the z-level numbers which can be accessed via space travel and the percentual chances to get there. (Exceptions: extended, sandbox and nuke) -Errorage #define IS_MODE_COMPILED(MODE) (ispath(text2path("/datum/game_mode/"+(MODE)))) + + +var/list/global_mutations = list() // list of hidden mutation things diff --git a/tgstation.dme b/tgstation.dme index db9bae97c0f..8a379ee3209 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -307,6 +307,7 @@ #include "code\game\chemistry.dm" #include "code\game\communications.dm" #include "code\game\dna.dm" +#include "code\game\dna_mutations.dm" #include "code\game\hud.dm" #include "code\game\landmarks.dm" #include "code\game\master_controller.dm"