From ff6d88f4e6417ce694df52ad5a3dc94db2f44de7 Mon Sep 17 00:00:00 2001 From: AnturK Date: Sun, 3 Jan 2016 18:49:10 +0100 Subject: [PATCH] Fixes injectors spawned before mutation table is ready --- .../objects/items/weapons/dna_injector.dm | 206 ++++++------------ 1 file changed, 62 insertions(+), 144 deletions(-) diff --git a/code/game/objects/items/weapons/dna_injector.dm b/code/game/objects/items/weapons/dna_injector.dm index 636145d74522..047aa449f2c8 100644 --- a/code/game/objects/items/weapons/dna_injector.dm +++ b/code/game/objects/items/weapons/dna_injector.dm @@ -12,13 +12,24 @@ var/list/fields var/list/add_mutations = list() var/list/remove_mutations = list() + + var/list/add_mutations_static = list() + var/list/remove_mutations_static = list() + var/used = 0 /obj/item/weapon/dnainjector/attack_paw(mob/user) return attack_hand(user) +/obj/item/weapon/dnainjector/proc/prepare() + for(var/mut_key in add_mutations_static) + add_mutations.Add(mutations_list[mut_key]) + for(var/mut_key in remove_mutations_static) + remove_mutations.Add(mutations_list[mut_key]) /obj/item/weapon/dnainjector/proc/inject(mob/living/carbon/M, mob/user) + prepare() + if(M.has_dna() && !(M.disabilities & NOCLONE)) M.radiation += rand(20/(damage_coeff ** 2),50/(damage_coeff ** 2)) var/log_msg = "[key_name(user)] injected [key_name(M)] with the [name]" @@ -76,170 +87,123 @@ /obj/item/weapon/dnainjector/antihulk name = "\improper DNA injector (Anti-Hulk)" desc = "Cures green skin." - New() - ..() - remove_mutations.Add(mutations_list[HULK]) + remove_mutations_static = list(HULK) /obj/item/weapon/dnainjector/hulkmut name = "\improper DNA injector (Hulk)" desc = "This will make you big and strong, but give you a bad skin condition." - New() - ..() - add_mutations.Add(mutations_list[HULK]) + add_mutations_static = list(HULK) + /obj/item/weapon/dnainjector/xraymut name = "\improper DNA injector (Xray)" desc = "Finally you can see what the Captain does." - New() - ..() - add_mutations.Add(mutations_list[XRAY]) + add_mutations_static = list(XRAY) /obj/item/weapon/dnainjector/antixray name = "\improper DNA injector (Anti-Xray)" desc = "It will make you see harder." - New() - ..() - remove_mutations.Add(mutations_list[XRAY]) + remove_mutations_static = list(XRAY) ///////////////////////////////////// /obj/item/weapon/dnainjector/antiglasses name = "\improper DNA injector (Anti-Glasses)" desc = "Toss away those glasses!" - New() - ..() - remove_mutations.Add(mutations_list[BADSIGHT]) + remove_mutations_static = list(BADSIGHT) /obj/item/weapon/dnainjector/glassesmut name = "\improper DNA injector (Glasses)" desc = "Will make you need dorkish glasses." - New() - ..() - add_mutations.Add(mutations_list[BADSIGHT]) + add_mutations_static = list(BADSIGHT) /obj/item/weapon/dnainjector/epimut name = "\improper DNA injector (Epi.)" desc = "Shake shake shake the room!" - New() - ..() - add_mutations.Add(mutations_list[EPILEPSY]) + add_mutations_static = list(EPILEPSY) /obj/item/weapon/dnainjector/antiepi name = "\improper DNA injector (Anti-Epi.)" desc = "Will fix you up from shaking the room." - New() - ..() - remove_mutations.Add(mutations_list[EPILEPSY]) + remove_mutations_static = list(EPILEPSY) //////////////////////////////////// /obj/item/weapon/dnainjector/anticough name = "\improper DNA injector (Anti-Cough)" desc = "Will stop that aweful noise." - New() - ..() - remove_mutations.Add(mutations_list[COUGH]) + remove_mutations_static = list(COUGH) /obj/item/weapon/dnainjector/coughmut name = "\improper DNA injector (Cough)" desc = "Will bring forth a sound of horror from your throat." - New() - ..() - add_mutations.Add(mutations_list[COUGH]) + add_mutations_static = list(COUGH) /obj/item/weapon/dnainjector/antidwarf name = "\improper DNA injector (Anti-Dwarfism)" desc = "Helps you grow big and strong." - New() - ..() - remove_mutations.Add(mutations_list[DWARFISM]) + remove_mutations_static = list(DWARFISM) /obj/item/weapon/dnainjector/dwarf name = "\improper DNA injector (Dwarfism)" desc = "Its a small world after all." - New() - ..() - add_mutations.Add(mutations_list[DWARFISM]) + add_mutations_static = list(DWARFISM) /obj/item/weapon/dnainjector/clumsymut name = "\improper DNA injector (Clumsy)" desc = "Makes clown minions." - New() - ..() - add_mutations.Add(mutations_list[CLOWNMUT]) + add_mutations_static = list(CLOWNMUT) /obj/item/weapon/dnainjector/anticlumsy name = "\improper DNA injector (Anti-Clumy)" desc = "Apply this for Security Clown." - New() - ..() - remove_mutations.Add(mutations_list[CLOWNMUT]) + remove_mutations_static = list(CLOWNMUT) /obj/item/weapon/dnainjector/antitour name = "\improper DNA injector (Anti-Tour.)" desc = "Will cure tourrets." - New() - ..() - remove_mutations.Add(mutations_list[TOURETTES]) + remove_mutations_static = list(TOURETTES) /obj/item/weapon/dnainjector/tourmut name = "\improper DNA injector (Tour.)" desc = "Gives you a nasty case off tourrets." - New() - ..() - add_mutations.Add(mutations_list[TOURETTES]) + add_mutations_static = list(TOURETTES) /obj/item/weapon/dnainjector/stuttmut name = "\improper DNA injector (Stutt.)" desc = "Makes you s-s-stuttterrr" - New() - ..() - add_mutations.Add(mutations_list[NERVOUS]) + add_mutations_static = list(NERVOUS) /obj/item/weapon/dnainjector/antistutt name = "\improper DNA injector (Anti-Stutt.)" desc = "Fixes that speaking impairment." - New() - ..() - remove_mutations.Add(mutations_list[NERVOUS]) + remove_mutations_static = list(NERVOUS) /obj/item/weapon/dnainjector/antifire name = "\improper DNA injector (Anti-Fire)" desc = "Cures fire." - New() - ..() - remove_mutations.Add(mutations_list[COLDRES]) + remove_mutations_static = list(COLDRES) /obj/item/weapon/dnainjector/firemut name = "\improper DNA injector (Fire)" desc = "Gives you fire." - New() - ..() - add_mutations.Add(mutations_list[COLDRES]) + add_mutations_static = list(COLDRES) /obj/item/weapon/dnainjector/blindmut name = "\improper DNA injector (Blind)" desc = "Makes you not see anything." - New() - ..() - add_mutations.Add(mutations_list[BLINDMUT]) + add_mutations_static = list(BLINDMUT) /obj/item/weapon/dnainjector/antiblind name = "\improper DNA injector (Anti-Blind)" desc = "ITS A MIRACLE!!!" - New() - ..() - remove_mutations.Add(mutations_list[BLINDMUT]) + remove_mutations_static = list(BLINDMUT) /obj/item/weapon/dnainjector/antitele name = "\improper DNA injector (Anti-Tele.)" desc = "Will make you not able to control your mind." - New() - ..() - remove_mutations.Add(mutations_list[TK]) + remove_mutations_static = list(TK) /obj/item/weapon/dnainjector/telemut name = "\improper DNA injector (Tele.)" desc = "Super brain man!" - New() - ..() - add_mutations.Add(mutations_list[TK]) + add_mutations_static = list(TK) /obj/item/weapon/dnainjector/telemut/darkbundle name = "\improper DNA injector" @@ -248,143 +212,101 @@ /obj/item/weapon/dnainjector/deafmut name = "\improper DNA injector (Deaf)" desc = "Sorry, what did you say?" - New() - ..() - add_mutations.Add(mutations_list[DEAFMUT]) + add_mutations_static = list(DEAFMUT) /obj/item/weapon/dnainjector/antideaf name = "\improper DNA injector (Anti-Deaf)" desc = "Will make you hear once more." - New() - ..() - remove_mutations.Add(mutations_list[DEAFMUT]) + remove_mutations_static = list(DEAFMUT) /obj/item/weapon/dnainjector/h2m name = "\improper DNA injector (Human > Monkey)" desc = "Will make you a flea bag." - New() - ..() - add_mutations.Add(mutations_list[RACEMUT]) + add_mutations_static = list(RACEMUT) /obj/item/weapon/dnainjector/m2h name = "\improper DNA injector (Monkey > Human)" desc = "Will make you...less hairy." - New() - ..() - remove_mutations.Add(mutations_list[RACEMUT]) + remove_mutations_static = list(RACEMUT) /obj/item/weapon/dnainjector/antichameleon name = "\improper DNA injector (Anti-Chameleon)" - New() - ..() - remove_mutations.Add(mutations_list[CHAMELEON]) + remove_mutations_static = list(CHAMELEON) /obj/item/weapon/dnainjector/chameleonmut name = "\improper DNA injector (Chameleon)" - New() - ..() - add_mutations.Add(mutations_list[CHAMELEON]) + add_mutations_static = list(CHAMELEON) /obj/item/weapon/dnainjector/antiwacky name = "\improper DNA injector (Anti-Wacky)" - New() - ..() - remove_mutations.Add(mutations_list[WACKY]) + remove_mutations_static = list(WACKY) /obj/item/weapon/dnainjector/wackymut name = "\improper DNA injector (Wacky)" - New() - ..() - add_mutations.Add(mutations_list[WACKY]) + add_mutations_static = list(WACKY) /obj/item/weapon/dnainjector/antimute name = "\improper DNA injector (Anti-Mute)" - New() - ..() - remove_mutations.Add(mutations_list[MUT_MUTE]) + remove_mutations_static = list(MUT_MUTE) /obj/item/weapon/dnainjector/mutemut name = "\improper DNA injector (Mute)" - New() - ..() - add_mutations.Add(mutations_list[MUT_MUTE]) + add_mutations_static = list(MUT_MUTE) /obj/item/weapon/dnainjector/antismile name = "\improper DNA injector (Anti-Smile)" - New() - ..() - remove_mutations.Add(mutations_list[SMILE]) + remove_mutations_static = list(SMILE) /obj/item/weapon/dnainjector/smilemut name = "\improper DNA injector (Smile)" - New() - ..() - add_mutations.Add(mutations_list[SMILE]) + add_mutations_static = list(SMILE) /obj/item/weapon/dnainjector/unintelligablemut name = "\improper DNA injector (Unintelligable)" - New() - ..() - add_mutations.Add(mutations_list[UNINTELLIGABLE]) + add_mutations_static = list(UNINTELLIGABLE) /obj/item/weapon/dnainjector/antiunintelligable name = "\improper DNA injector (Anti-Unintelligable)" - New() - ..() - remove_mutations.Add(mutations_list[UNINTELLIGABLE]) + remove_mutations_static = list(UNINTELLIGABLE) /obj/item/weapon/dnainjector/swedishmut name = "\improper DNA injector (Swedish)" - New() - ..() - add_mutations.Add(mutations_list[SWEDISH]) + add_mutations_static = list(SWEDISH) /obj/item/weapon/dnainjector/antiswedish name = "\improper DNA injector (Anti-Swedish)" - New() - ..() - remove_mutations.Add(mutations_list[SWEDISH]) + remove_mutations_static = list(SWEDISH) /obj/item/weapon/dnainjector/chavmut name = "\improper DNA injector (Chav)" - New() - ..() - add_mutations.Add(mutations_list[CHAV]) + add_mutations_static = list(CHAV) /obj/item/weapon/dnainjector/antichav name = "\improper DNA injector (Anti-Chav)" - New() - ..() - remove_mutations.Add(mutations_list[CHAV]) + remove_mutations_static = list(CHAV) /obj/item/weapon/dnainjector/elvismut name = "\improper DNA injector (Elvis)" - New() - ..() - add_mutations.Add(mutations_list[ELVIS]) + add_mutations_static = list(ELVIS) /obj/item/weapon/dnainjector/antielvis name = "\improper DNA injector (Anti-Elvis)" - New() - ..() - remove_mutations.Add(mutations_list[ELVIS]) + remove_mutations_static = list(ELVIS) /obj/item/weapon/dnainjector/lasereyesmut name = "\improper DNA injector (Laser Eyes)" - New() - ..() - add_mutations.Add(mutations_list[LASEREYES]) + add_mutations_static = list(LASEREYES) /obj/item/weapon/dnainjector/antilasereyes name = "\improper DNA injector (Anti-Laser Eyes)" - New() - ..() - remove_mutations.Add(mutations_list[LASEREYES]) + remove_mutations_static = list(LASEREYES) /obj/item/weapon/dnainjector/timed var/duration = 600 /obj/item/weapon/dnainjector/timed/inject(mob/living/carbon/M, mob/user) + prepare() + if(M.has_dna() && !(M.disabilities & NOCLONE)) if(M.stat == DEAD) //prevents dead people from having their DNA changed user << "You can't modify [M]'s DNA while \he's dead." @@ -436,13 +358,9 @@ /obj/item/weapon/dnainjector/timed/hulk name = "\improper DNA injector (Hulk)" desc = "This will make you big and strong, but give you a bad skin condition." - New() - ..() - add_mutations.Add(mutations_list[HULK]) + add_mutations_static = list(HULK) /obj/item/weapon/dnainjector/timed/h2m name = "\improper DNA injector (Human > Monkey)" desc = "Will make you a flea bag." - New() - ..() - add_mutations.Add(mutations_list[RACEMUT]) + add_mutations_static = list(RACEMUT)