Files
FluffyandGitHub 9636363e60 Refactored the attack proc (#19908)
Refactored the attack proc signature.
Added signals and components for the attack proc.
Added signals and components for the attackby proc.
Adjusted some leftover attackby procs signatures.
Added grep test to ensure people don't keep adding attack/attackby procs
with the wrong signature.
2024-10-06 21:30:00 +00:00

653 lines
15 KiB
Plaintext

/obj/item/dnainjector
name = "\improper DNA injector"
desc = "This injects the person with DNA."
icon = 'icons/obj/item/reagent_containers/syringe.dmi'
contained_sprite = TRUE
icon_state = "dnainjector"
item_state = "dnainjector"
var/block=0
var/datum/dna2/record/buf=null
var/s_time = 10.0
throw_speed = 1
throw_range = 5
w_class = WEIGHT_CLASS_TINY
slot_flags = SLOT_EARS
var/uses = 1
var/nofail
var/is_bullet = 0
var/inuse = 0
// USE ONLY IN PREMADE SYRINGES. WILL NOT WORK OTHERWISE.
var/datatype=0
var/value=0
/obj/item/dnainjector/New()
if(datatype && block)
buf=new
buf.dna=new
buf.types = datatype
buf.dna.ResetSE()
//testing("[name]: DNA2 SE blocks prior to SetValue: [english_list(buf.dna.SE)]")
SetValue(src.value)
//testing("[name]: DNA2 SE blocks after SetValue: [english_list(buf.dna.SE)]")
/obj/item/dnainjector/proc/GetRealBlock(var/selblock)
if(selblock==0)
return block
else
return selblock
/obj/item/dnainjector/proc/GetState(var/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)
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)
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)
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/M as mob, mob/user as mob)
if(istype(M,/mob/living))
var/mob/living/L = M
L.apply_damage(rand(5,20), DAMAGE_RADIATION, damage_flags = DAMAGE_FLAG_DISPERSED)
if (!(M.mutations & NOCLONE)) // prevents drained people from having their DNA changed
if (buf.types & DNA2_BUF_UI)
if (!block) //isolated block?
M.UpdateAppearance(buf.dna.UI.Copy())
if (buf.types & DNA2_BUF_UE) //unique enzymes? yes
M.real_name = buf.dna.real_name
M.name = buf.dna.real_name
uses--
else
M.dna.SetUIValue(block,src.GetValue())
M.UpdateAppearance()
uses--
if (buf.types & DNA2_BUF_SE)
if (!block) //isolated block?
M.dna.SE = buf.dna.SE.Copy()
M.dna.UpdateSE()
else
M.dna.SetSEValue(block,src.GetValue())
domutcheck(M, null, block!=null)
uses--
spawn(0)//this prevents the collapse of space-time continuum
if (user)
user.drop_from_inventory(src)
qdel(src)
return uses
/obj/item/dnainjector/attack(mob/living/target_mob, mob/living/user, target_zone)
if (!istype(target_mob))
return
if (!usr.IsAdvancedToolUser())
return
if(inuse)
return 0
user.visible_message(SPAN_DANGER("\The [user] is trying to inject \the [target_mob] with \the [src]!"))
inuse = 1
s_time = world.time
spawn(50)
inuse = 0
if(!do_after(user, 5 SECONDS))
return
user.setClickCooldown(DEFAULT_QUICK_COOLDOWN)
user.do_attack_animation(target_mob)
target_mob.visible_message(SPAN_DANGER("\The [target_mob] has been injected with \the [src] by \the [user]."))
var/mob/living/carbon/human/H = target_mob
if(!istype(H))
to_chat(user, SPAN_WARNING("Apparently it didn't work..."))
return
if(H.species && H.species.flags & NO_SCAN)
return
// Used by admin log.
var/injected_with_monkey = ""
if((buf.types & DNA2_BUF_SE) && (block ? (GetState() && block == MONKEYBLOCK) : GetState(MONKEYBLOCK)))
injected_with_monkey = SPAN_DANGER(" (MONKEY)")
target_mob.attack_log += "\[[time_stamp()]\] <font color='orange'>Has been injected with [name] by [user.name] ([user.ckey])</font>"
user.attack_log += "\[[time_stamp()]\] <span class='warning'>Used the [name] to inject [target_mob.name] ([target_mob.ckey])</span>"
log_attack("[user.name] ([user.ckey]) used the [name] to inject [target_mob.name] ([target_mob.ckey])")
message_admins("[key_name_admin(user)] injected [key_name_admin(target_mob)] with \the [src][injected_with_monkey]")
// Apply the DNA shit.
inject(target_mob, user)
return
/obj/item/dnainjector/hulkmut
name = "\improper DNA injector (Hulk)"
desc = "This will make you big and strong, but give you a bad skin condition."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
/obj/item/dnainjector/hulkmut/New()
block = HULKBLOCK
..()
/obj/item/dnainjector/antihulk
name = "\improper DNA injector (Anti-Hulk)"
desc = "Cures green skin."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
/obj/item/dnainjector/antihulk/New()
block = HULKBLOCK
..()
/obj/item/dnainjector/xraymut
name = "\improper DNA injector (Xray)"
desc = "Finally you can see what the Captain does."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 8
/obj/item/dnainjector/xraymut/New()
block = XRAYBLOCK
..()
/obj/item/dnainjector/antixray
name = "\improper DNA injector (Anti-Xray)"
desc = "It will make you see harder."
datatype = DNA2_BUF_SE
value = 0x001
//block = 8
/obj/item/dnainjector/antixray/New()
block = XRAYBLOCK
..()
/obj/item/dnainjector/firemut
name = "\improper DNA injector (Fire)"
desc = "Gives you fire."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 10
/obj/item/dnainjector/firemut/New()
block = FIREBLOCK
..()
/obj/item/dnainjector/antifire
name = "\improper DNA injector (Anti-Fire)"
desc = "Cures fire."
datatype = DNA2_BUF_SE
value = 0x001
//block = 10
/obj/item/dnainjector/antifire/New()
block = FIREBLOCK
..()
/obj/item/dnainjector/telemut
name = "\improper DNA injector (Tele.)"
desc = "Super brain man!"
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 12
/obj/item/dnainjector/telemut/New()
block = TELEBLOCK
..()
/obj/item/dnainjector/antitele
name = "\improper DNA injector (Anti-Tele.)"
desc = "Will make you not able to control your mind."
datatype = DNA2_BUF_SE
value = 0x001
//block = 12
/obj/item/dnainjector/antitele/New()
block = TELEBLOCK
..()
/obj/item/dnainjector/nobreath
name = "\improper DNA injector (No Breath)"
desc = "Hold your breath and count to infinity."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
/obj/item/dnainjector/nobreath/New()
block = NOBREATHBLOCK
..()
/obj/item/dnainjector/antinobreath
name = "\improper DNA injector (Anti-No Breath)"
desc = "Hold your breath and count to 100."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
/obj/item/dnainjector/antinobreath/New()
block = NOBREATHBLOCK
..()
/obj/item/dnainjector/remoteview
name = "\improper DNA injector (Remote View)"
desc = "Stare into the distance for a reason."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
/obj/item/dnainjector/remoteview/New()
block = REMOTEVIEWBLOCK
..()
/obj/item/dnainjector/antiremoteview
name = "\improper DNA injector (Anti-Remote View)"
desc = "Cures green skin."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
/obj/item/dnainjector/antiremoteview/New()
block = REMOTEVIEWBLOCK
..()
/obj/item/dnainjector/regenerate
name = "\improper DNA injector (Regeneration)"
desc = "Healthy but hungry."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
/obj/item/dnainjector/regenerate/New()
block = REGENERATEBLOCK
..()
/obj/item/dnainjector/antiregenerate
name = "\improper DNA injector (Anti-Regeneration)"
desc = "Sickly but sated."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
/obj/item/dnainjector/antiregenerate/New()
block = REGENERATEBLOCK
..()
/obj/item/dnainjector/runfast
name = "\improper DNA injector (Increase Run)"
desc = "Running Man."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
/obj/item/dnainjector/runfast/New()
block = INCREASERUNBLOCK
..()
/obj/item/dnainjector/antirunfast
name = "\improper DNA injector (Anti-Increase Run)"
desc = "Walking Man."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
/obj/item/dnainjector/antirunfast/New()
block = INCREASERUNBLOCK
..()
/obj/item/dnainjector/morph
name = "\improper DNA injector (Morph)"
desc = "A total makeover."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
/obj/item/dnainjector/morph/New()
block = MORPHBLOCK
..()
/obj/item/dnainjector/antimorph
name = "\improper DNA injector (Anti-Morph)"
desc = "Cures identity crisis."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
/obj/item/dnainjector/antimorph/New()
block = MORPHBLOCK
..()
/* No COLDBLOCK on bay
/obj/item/dnainjector/cold
name = "\improper DNA injector (Cold)"
desc = "Feels a bit chilly."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
/obj/item/dnainjector/cold/New()
block = COLDBLOCK
..()
/obj/item/dnainjector/anticold
name = "\improper DNA injector (Anti-Cold)"
desc = "Feels room-temperature."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
/obj/item/dnainjector/anticold/New()
block = COLDBLOCK
..()
*/
/obj/item/dnainjector/noprints
name = "\improper DNA injector (No Prints)"
desc = "Better than a pair of budget insulated gloves."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
/obj/item/dnainjector/noprints/New()
block = NOPRINTSBLOCK
..()
/obj/item/dnainjector/antinoprints
name = "\improper DNA injector (Anti-No Prints)"
desc = "Not quite as good as a pair of budget insulated gloves."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
/obj/item/dnainjector/antinoprints/New()
block = NOPRINTSBLOCK
..()
/obj/item/dnainjector/insulation
name = "\improper DNA injector (Shock Immunity)"
desc = "Better than a pair of real insulated gloves."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
/obj/item/dnainjector/insulation/New()
block = SHOCKIMMUNITYBLOCK
..()
/obj/item/dnainjector/antiinsulation
name = "\improper DNA injector (Anti-Shock Immunity)"
desc = "Not quite as good as a pair of real insulated gloves."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
/obj/item/dnainjector/antiinsulation/New()
block = SHOCKIMMUNITYBLOCK
..()
/obj/item/dnainjector/midgit
name = "\improper DNA injector (Small Size)"
desc = "Makes you shrink."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
/obj/item/dnainjector/midgit/New()
block = SMALLSIZEBLOCK
..()
/obj/item/dnainjector/antimidgit
name = "\improper DNA injector (Anti-Small Size)"
desc = "Makes you grow. But not too much."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
/obj/item/dnainjector/antimidgit/New()
block = SMALLSIZEBLOCK
..()
/////////////////////////////////////
/obj/item/dnainjector/antiglasses
name = "\improper DNA injector (Anti-Glasses)"
desc = "Toss away those glasses!"
datatype = DNA2_BUF_SE
value = 0x001
//block = 1
/obj/item/dnainjector/antiglasses/New()
block = GLASSESBLOCK
..()
/obj/item/dnainjector/glassesmut
name = "\improper DNA injector (Glasses)"
desc = "Will make you need dorkish glasses."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 1
/obj/item/dnainjector/glassesmut/New()
block = GLASSESBLOCK
..()
/obj/item/dnainjector/epimut
name = "\improper DNA injector (Epi.)"
desc = "Shake shake shake the room!"
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 3
/obj/item/dnainjector/epimut/New()
block = HEADACHEBLOCK
..()
/obj/item/dnainjector/antiepi
name = "\improper DNA injector (Anti-Epi.)"
desc = "Will fix you up from shaking the room."
datatype = DNA2_BUF_SE
value = 0x001
//block = 3
/obj/item/dnainjector/antiepi/New()
block = HEADACHEBLOCK
..()
/obj/item/dnainjector/anticough
name = "\improper DNA injector (Anti-Cough)"
desc = "Will stop that awful noise."
datatype = DNA2_BUF_SE
value = 0x001
//block = 5
/obj/item/dnainjector/anticough/New()
block = COUGHBLOCK
..()
/obj/item/dnainjector/coughmut
name = "\improper DNA injector (Cough)"
desc = "Will bring forth a sound of horror from your throat."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 5
/obj/item/dnainjector/coughmut/New()
block = COUGHBLOCK
..()
/obj/item/dnainjector/clumsymut
name = "\improper DNA injector (Clumsy)"
desc = "Makes clumsy minions."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 6
/obj/item/dnainjector/clumsymut/New()
block = CLUMSYBLOCK
..()
/obj/item/dnainjector/anticlumsy
name = "\improper DNA injector (Anti-Clumy)"
desc = "Cleans up confusion."
datatype = DNA2_BUF_SE
value = 0x001
//block = 6
/obj/item/dnainjector/anticlumsy/New()
block = CLUMSYBLOCK
..()
/obj/item/dnainjector/antitour
name = "\improper DNA injector (Anti-Tour.)"
desc = "Will cure tourrets."
datatype = DNA2_BUF_SE
value = 0x001
//block = 7
/obj/item/dnainjector/antitour/New()
block = TWITCHBLOCK
..()
/obj/item/dnainjector/tourmut
name = "\improper DNA injector (Tour.)"
desc = "Gives you a nasty case off tourrets."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 7
/obj/item/dnainjector/tourmut/New()
block = TWITCHBLOCK
..()
/obj/item/dnainjector/stuttmut
name = "\improper DNA injector (Stutt.)"
desc = "Makes you s-s-stuttterrr"
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 9
/obj/item/dnainjector/stuttmut/New()
block = STUTTERBLOCK
..()
/obj/item/dnainjector/antistutt
name = "\improper DNA injector (Anti-Stutt.)"
desc = "Fixes that speaking impairment."
datatype = DNA2_BUF_SE
value = 0x001
//block = 9
/obj/item/dnainjector/antistutt/New()
block = STUTTERBLOCK
..()
/obj/item/dnainjector/blindmut
name = "\improper DNA injector (Blind)"
desc = "Makes you not see anything."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 11
/obj/item/dnainjector/blindmut/New()
block = BLINDBLOCK
..()
/obj/item/dnainjector/antiblind
name = "\improper DNA injector (Anti-Blind)"
desc = "ITS A MIRACLE!!!"
datatype = DNA2_BUF_SE
value = 0x001
//block = 11
/obj/item/dnainjector/antiblind/New()
block = BLINDBLOCK
..()
/obj/item/dnainjector/deafmut
name = "\improper DNA injector (Deaf)"
desc = "Sorry, what did you say?"
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 13
/obj/item/dnainjector/deafmut/New()
block = DEAFBLOCK
..()
/obj/item/dnainjector/antideaf
name = "\improper DNA injector (Anti-Deaf)"
desc = "Will make you hear once more."
datatype = DNA2_BUF_SE
value = 0x001
//block = 13
/obj/item/dnainjector/antideaf/New()
block = DEAFBLOCK
..()
/obj/item/dnainjector/hallucination
name = "\improper DNA injector (Halluctination)"
desc = "What you see isn't always what you get."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 2
/obj/item/dnainjector/hallucination/New()
block = HALLUCINATIONBLOCK
..()
/obj/item/dnainjector/antihallucination
name = "\improper DNA injector (Anti-Hallucination)"
desc = "What you see is what you get."
datatype = DNA2_BUF_SE
value = 0x001
//block = 2
/obj/item/dnainjector/antihallucination/New()
block = HALLUCINATIONBLOCK
..()
/obj/item/dnainjector/h2m
name = "\improper DNA injector (Human > Monkey)"
desc = "Will make you a flea bag."
datatype = DNA2_BUF_SE
value = 0xFFF
//block = 14
/obj/item/dnainjector/h2m/New()
block = MONKEYBLOCK
..()
/obj/item/dnainjector/m2h
name = "\improper DNA injector (Monkey > Human)"
desc = "Will make you...less hairy."
datatype = DNA2_BUF_SE
value = 0x001
//block = 14
/obj/item/dnainjector/m2h/New()
block = MONKEYBLOCK
..()