Fixes injectors spawned before mutation table is ready

This commit is contained in:
AnturK
2016-01-03 18:49:10 +01:00
parent 10b74eb793
commit ff6d88f4e6

View File

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