Merge pull request #10980 from Fox-McCloud/fixes-genetics

Fixes Genetic Powers Activation
This commit is contained in:
variableundefined
2019-03-03 08:52:52 +08:00
committed by GitHub
+63 -64
View File
@@ -12,11 +12,12 @@
origin_tech = "biotech=1"
var/damage_coeff = 1
var/used = 0
var/used = FALSE
// USE ONLY IN PREMADE SYRINGES. WILL NOT WORK OTHERWISE.
var/datatype = 0
var/value = 0
var/forcedmutation = FALSE //Will it give the mutation, guaranteed?
/obj/item/dnainjector/Initialize()
. = ..()
@@ -31,45 +32,45 @@
QDEL_NULL(buf)
return ..()
/obj/item/dnainjector/proc/GetRealBlock(var/selblock)
if(selblock==0)
/obj/item/dnainjector/proc/GetRealBlock(selblock)
if(selblock == 0)
return block
else
return selblock
/obj/item/dnainjector/proc/GetState(var/selblock=0)
/obj/item/dnainjector/proc/GetState(selblock = 0)
var/real_block = GetRealBlock(selblock)
if(buf.types & DNA2_BUF_SE)
return buf.dna.GetSEState(real_block)
else
return buf.dna.GetUIState(real_block)
/obj/item/dnainjector/proc/SetState(var/on, var/selblock=0)
/obj/item/dnainjector/proc/SetState(on, selblock = 0)
var/real_block = GetRealBlock(selblock)
if(buf.types & DNA2_BUF_SE)
return buf.dna.SetSEState(real_block,on)
else
return buf.dna.SetUIState(real_block,on)
/obj/item/dnainjector/proc/GetValue(var/selblock=0)
/obj/item/dnainjector/proc/GetValue(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/dnainjector/proc/SetValue(var/val,var/selblock=0)
/obj/item/dnainjector/proc/SetValue(val, 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/dnainjector/proc/inject(mob/living/M as mob, mob/user as mob)
/obj/item/dnainjector/proc/inject(mob/living/M, mob/user)
if(used)
return
if(istype(M,/mob/living))
M.apply_effect(rand(20/(damage_coeff ** 2),50/(damage_coeff ** 2)),IRRADIATE,0,1)
M.apply_effect(rand(20 / (damage_coeff ** 2), 50 / (damage_coeff ** 2)), IRRADIATE, 0, 1)
var/mob/living/carbon/human/H
if(istype(M, /mob/living/carbon/human))
H = M
@@ -81,7 +82,6 @@
spawn(0) //Some mutations have sleeps in them, like monkey
if(!(NOCLONE in M.mutations) && !(H && (NO_DNA in H.dna.species.species_traits))) // prevents drained people from having their DNA changed
var/prev_ue = M.dna.unique_enzymes
var/mutflags = 0
// UI in syringe.
if(buf.types & DNA2_BUF_UI)
if(!block) //isolated block?
@@ -98,31 +98,30 @@
M.dna.SetUIValue(block,src.GetValue())
M.UpdateAppearance()
if(buf.types & DNA2_BUF_SE)
mutflags = MUTCHK_FORCED
if(!block) //isolated block?
M.dna.SE = buf.dna.SE.Copy()
M.dna.UpdateSE()
else
M.dna.SetSEValue(block,src.GetValue())
domutcheck(M, null, mutflags)
domutcheck(M, null, forcedmutation ? MUTCHK_FORCED : 0)
M.update_mutations()
if(H)
H.sync_organ_dna(assimilate = 0, old_ue = prev_ue)
/obj/item/dnainjector/attack(mob/M as mob, mob/user as mob)
/obj/item/dnainjector/attack(mob/M, mob/user)
if(used)
to_chat(user, "<span class='warning'>This injector is used up!</span>")
return
if(!M.dna) //You know what would be nice? If the mob you're injecting has DNA, and so doesn't cause runtimes.
return 0
return FALSE
if(ishuman(M)) // Would've done this via species instead of type, but the basic mob doesn't have a species, go figure.
var/mob/living/carbon/human/H = M
if(NO_DNA in H.dna.species.species_traits)
return 0
return FALSE
if(!user.IsAdvancedToolUser())
return 0
return FALSE
var/attack_log = "injected with the Isolated [name]"
@@ -154,7 +153,7 @@
M.LAssailant = user
inject(M, user)
used = 1
used = TRUE
icon_state = "dnainjector0"
desc += " This one is used up."
@@ -163,7 +162,7 @@
desc = "This will make you big and strong, but give you a bad skin condition."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/hulkmut/Initialize()
block = HULKBLOCK
@@ -174,7 +173,7 @@
desc = "Cures green skin."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/antihulk/Initialize()
block = HULKBLOCK
@@ -185,7 +184,7 @@
desc = "Finally you can see what the Captain does."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 8
forcedmutation = TRUE
/obj/item/dnainjector/xraymut/Initialize()
block = XRAYBLOCK
@@ -196,7 +195,7 @@
desc = "It will make you see harder."
datatype = DNA2_BUF_SE
value = 0x001
//block = 8
forcedmutation = TRUE
/obj/item/dnainjector/antixray/Initialize()
block = XRAYBLOCK
@@ -207,7 +206,7 @@
desc = "Gives you fire."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 10
forcedmutation = TRUE
/obj/item/dnainjector/firemut/Initialize()
block = FIREBLOCK
@@ -218,7 +217,7 @@
desc = "Cures fire."
datatype = DNA2_BUF_SE
value = 0x001
//block = 10
forcedmutation = TRUE
/obj/item/dnainjector/antifire/Initialize()
block = FIREBLOCK
@@ -229,7 +228,7 @@
desc = "Super brain man!"
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 12
forcedmutation = TRUE
/obj/item/dnainjector/telemut/Initialize()
block = TELEBLOCK
@@ -245,7 +244,7 @@
desc = "Will make you not able to control your mind."
datatype = DNA2_BUF_SE
value = 0x001
//block = 12
forcedmutation = TRUE
/obj/item/dnainjector/antitele/Initialize()
block = TELEBLOCK
@@ -256,7 +255,7 @@
desc = "Hold your breath and count to infinity."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/nobreath/Initialize()
block = BREATHLESSBLOCK
@@ -267,7 +266,7 @@
desc = "Hold your breath and count to 100."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/antinobreath/Initialize()
block = BREATHLESSBLOCK
@@ -278,7 +277,7 @@
desc = "Stare into the distance for a reason."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/remoteview/Initialize()
block = REMOTEVIEWBLOCK
@@ -289,7 +288,7 @@
desc = "Cures green skin."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/antiremoteview/Initialize()
block = REMOTEVIEWBLOCK
@@ -300,7 +299,7 @@
desc = "Healthy but hungry."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/regenerate/Initialize()
block = REGENERATEBLOCK
@@ -311,7 +310,7 @@
desc = "Sickly but sated."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/antiregenerate/Initialize()
block = REGENERATEBLOCK
@@ -322,7 +321,7 @@
desc = "Running Man."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/runfast/Initialize()
block = INCREASERUNBLOCK
@@ -333,7 +332,7 @@
desc = "Walking Man."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/antirunfast/Initialize()
block = INCREASERUNBLOCK
@@ -344,7 +343,7 @@
desc = "A total makeover."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/morph/Initialize()
block = MORPHBLOCK
@@ -355,7 +354,7 @@
desc = "Cures identity crisis."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/antimorph/Initialize()
block = MORPHBLOCK
@@ -366,7 +365,7 @@
desc = "Better than a pair of budget insulated gloves."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/noprints/Initialize()
block = NOPRINTSBLOCK
@@ -377,7 +376,7 @@
desc = "Not quite as good as a pair of budget insulated gloves."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/antinoprints/Initialize()
block = NOPRINTSBLOCK
@@ -388,7 +387,7 @@
desc = "Better than a pair of real insulated gloves."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/insulation/Initialize()
block = SHOCKIMMUNITYBLOCK
@@ -399,7 +398,7 @@
desc = "Not quite as good as a pair of real insulated gloves."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/antiinsulation/Initialize()
block = SHOCKIMMUNITYBLOCK
@@ -410,7 +409,7 @@
desc = "Makes you shrink."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/midgit/Initialize()
block = SMALLSIZEBLOCK
@@ -421,7 +420,7 @@
desc = "Makes you grow. But not too much."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/antimidgit/Initialize()
block = SMALLSIZEBLOCK
@@ -433,7 +432,7 @@
desc = "Toss away those glasses!"
datatype = DNA2_BUF_SE
value = 0x001
//block = 1
forcedmutation = TRUE
/obj/item/dnainjector/antiglasses/Initialize()
block = GLASSESBLOCK
@@ -444,7 +443,7 @@
desc = "Will make you need dorkish glasses."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 1
forcedmutation = TRUE
/obj/item/dnainjector/glassesmut/Initialize()
block = GLASSESBLOCK
@@ -455,7 +454,7 @@
desc = "Shake shake shake the room!"
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 3
forcedmutation = TRUE
/obj/item/dnainjector/epimut/Initialize()
block = EPILEPSYBLOCK
@@ -466,7 +465,7 @@
desc = "Will fix you up from shaking the room."
datatype = DNA2_BUF_SE
value = 0x001
//block = 3
forcedmutation = TRUE
/obj/item/dnainjector/antiepi/Initialize()
block = EPILEPSYBLOCK
@@ -477,7 +476,7 @@
desc = "Will stop that awful noise."
datatype = DNA2_BUF_SE
value = 0x001
//block = 5
forcedmutation = TRUE
/obj/item/dnainjector/anticough/Initialize()
block = COUGHBLOCK
@@ -488,7 +487,7 @@
desc = "Will bring forth a sound of horror from your throat."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 5
forcedmutation = TRUE
/obj/item/dnainjector/coughmut/Initialize()
block = COUGHBLOCK
@@ -499,7 +498,7 @@
desc = "Makes clumsy minions."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 6
forcedmutation = TRUE
/obj/item/dnainjector/clumsymut/Initialize()
block = CLUMSYBLOCK
@@ -510,7 +509,7 @@
desc = "Cleans up confusion."
datatype = DNA2_BUF_SE
value = 0x001
//block = 6
forcedmutation = TRUE
/obj/item/dnainjector/anticlumsy/Initialize()
block = CLUMSYBLOCK
@@ -521,7 +520,7 @@
desc = "Will cure tourrets."
datatype = DNA2_BUF_SE
value = 0x001
//block = 7
forcedmutation = TRUE
/obj/item/dnainjector/antitour/Initialize()
block = TWITCHBLOCK
@@ -532,7 +531,7 @@
desc = "Gives you a nasty case off tourrets."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 7
forcedmutation = TRUE
/obj/item/dnainjector/tourmut/Initialize()
block = TWITCHBLOCK
@@ -543,7 +542,7 @@
desc = "Makes you s-s-stuttterrr"
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 9
forcedmutation = TRUE
/obj/item/dnainjector/stuttmut/Initialize()
block = NERVOUSBLOCK
@@ -555,7 +554,7 @@
desc = "Fixes that speaking impairment."
datatype = DNA2_BUF_SE
value = 0x001
//block = 9
forcedmutation = TRUE
/obj/item/dnainjector/antistutt/Initialize()
block = NERVOUSBLOCK
@@ -566,7 +565,7 @@
desc = "Makes you not see anything."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 11
forcedmutation = TRUE
/obj/item/dnainjector/blindmut/Initialize()
block = BLINDBLOCK
@@ -577,7 +576,7 @@
desc = "ITS A MIRACLE!!!"
datatype = DNA2_BUF_SE
value = 0x001
//block = 11
forcedmutation = TRUE
/obj/item/dnainjector/antiblind/Initialize()
block = BLINDBLOCK
@@ -588,7 +587,7 @@
desc = "Super brain man!"
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 12
forcedmutation = TRUE
/obj/item/dnainjector/telemut/Initialize()
block = TELEBLOCK
@@ -599,7 +598,7 @@
desc = "Will make you not able to control your mind."
datatype = DNA2_BUF_SE
value = 0x001
//block = 12
forcedmutation = TRUE
/obj/item/dnainjector/antitele/Initialize()
block = TELEBLOCK
@@ -610,7 +609,7 @@
desc = "Sorry, what did you say?"
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 13
forcedmutation = TRUE
/obj/item/dnainjector/deafmut/Initialize()
block = DEAFBLOCK
@@ -621,7 +620,7 @@
desc = "Will make you hear once more."
datatype = DNA2_BUF_SE
value = 0x001
//block = 13
forcedmutation = TRUE
/obj/item/dnainjector/antideaf/Initialize()
block = DEAFBLOCK
@@ -632,7 +631,7 @@
desc = "What you see isn't always what you get."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/hallucination/Initialize()
block = HALLUCINATIONBLOCK
@@ -643,7 +642,7 @@
desc = "What you see is what you get."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
forcedmutation = TRUE
/obj/item/dnainjector/antihallucination/Initialize()
block = HALLUCINATIONBLOCK
@@ -654,7 +653,7 @@
desc = "Will make you a flea bag."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 14
forcedmutation = TRUE
/obj/item/dnainjector/h2m/Initialize()
block = MONKEYBLOCK
@@ -665,8 +664,8 @@
desc = "Will make you...less hairy."
datatype = DNA2_BUF_SE
value = 0x001
//block = 14
forcedmutation = TRUE
/obj/item/dnainjector/m2h/Initialize()
block = MONKEYBLOCK
..()
..()