Syringe guns now embed syringes (#14192)

* Squashed commit of the following:

commit 8ec2fca541
Author: nmajask <nmajask@gmail.com>
Date:   Thu May 19 15:26:09 2022 -0400

    Converts embedding into a proc

    also adds a embed tic proc that is called whenever the embedde has a life tick

* Syringe gun rework

Syringe gun now embeds syringes and slowly transfers the reagents

* Squashed commit of the following:

commit c6d04d476b
Author: nmajask <nmajask@gmail.com>
Date:   Sat May 21 16:12:51 2022 -0400

    b

commit da83fdc5a0
Author: nmajask <nmajask@gmail.com>
Date:   Sat May 21 15:47:52 2022 -0400

    a

commit 8ec2fca541
Author: nmajask <nmajask@gmail.com>
Date:   Thu May 19 15:26:09 2022 -0400

    Converts embedding into a proc

    also adds a embed tic proc that is called whenever the embedde has a life tick

* a

* Pain

* Fixes and Buff

* buff

Co-authored-by: Jamie D <993128+JamieD1@users.noreply.github.com>
This commit is contained in:
nmajask
2022-06-11 09:54:43 -04:00
committed by GitHub
parent 87648fb3d6
commit efb926aa46
6 changed files with 81 additions and 33 deletions

View File

@@ -133,12 +133,30 @@
name = "shotgun dart" name = "shotgun dart"
desc = "A dart for use in shotguns. Can be injected with up to 30 units of any chemical." desc = "A dart for use in shotguns. Can be injected with up to 30 units of any chemical."
icon_state = "cshell" icon_state = "cshell"
projectile_type = /obj/item/projectile/bullet/dart projectile_type = /obj/item/projectile/bullet/reusable/dart
var/reagent_amount = 30 var/reagent_amount = 30
var/no_react = FALSE
/obj/item/ammo_casing/shotgun/dart/Initialize() /obj/item/ammo_casing/shotgun/dart/Initialize()
. = ..() . = ..()
create_reagents(reagent_amount, OPENCONTAINER) create_reagents(reagent_amount, OPENCONTAINER)
if(no_react)
ENABLE_BITFIELD(reagents.flags, NO_REACT)
/obj/item/ammo_casing/shotgun/dart/ready_proj(atom/target, mob/living/user, quiet, zone_override = "")
if(!BB)
return
if(reagents.total_volume < 0)
return
var/obj/item/projectile/bullet/reusable/dart/D = BB
var/obj/item/reagent_containers/syringe/dart/temp/new_dart = new(D)
new_dart.volume = reagents.total_volume
if(no_react)
new_dart.reagent_flags |= NO_REACT
reagents.trans_to(new_dart, reagents.total_volume, transfered_by = user)
D.add_dart(new_dart)
..()
/obj/item/ammo_casing/shotgun/dart/attackby() /obj/item/ammo_casing/shotgun/dart/attackby()
return return
@@ -148,10 +166,7 @@
desc = "A dart for use in shotguns, using similar technology as cryostatis beakers to keep internal reagents from reacting. Can be injected with up to 10 units of any chemical." desc = "A dart for use in shotguns, using similar technology as cryostatis beakers to keep internal reagents from reacting. Can be injected with up to 10 units of any chemical."
icon_state = "cnrshell" icon_state = "cnrshell"
reagent_amount = 10 reagent_amount = 10
no_react = TRUE
/obj/item/ammo_casing/shotgun/dart/noreact/Initialize()
. = ..()
ENABLE_BITFIELD(reagents.flags, NO_REACT)
/obj/item/ammo_casing/shotgun/dart/bioterror /obj/item/ammo_casing/shotgun/dart/bioterror
desc = "A shotgun dart filled with deadly toxins." desc = "A shotgun dart filled with deadly toxins."

View File

@@ -1,7 +1,7 @@
/obj/item/ammo_casing/syringegun /obj/item/ammo_casing/syringegun
name = "syringe gun spring" name = "syringe gun spring"
desc = "A high-power spring that throws syringes." desc = "A high-power spring that throws syringes."
projectile_type = /obj/item/projectile/bullet/dart/syringe projectile_type = /obj/item/projectile/bullet/reusable/dart/syringe
firing_effect_type = null firing_effect_type = null
/obj/item/ammo_casing/syringegun/ready_proj(atom/target, mob/living/user, quiet, zone_override = "") /obj/item/ammo_casing/syringegun/ready_proj(atom/target, mob/living/user, quiet, zone_override = "")
@@ -9,23 +9,21 @@
return return
if(istype(loc, /obj/item/gun/syringe)) if(istype(loc, /obj/item/gun/syringe))
var/obj/item/gun/syringe/SG = loc var/obj/item/gun/syringe/SG = loc
var/obj/item/projectile/bullet/reusable/dart/D = BB
if(!SG.syringes.len) if(!SG.syringes.len)
return return
var/obj/item/reagent_containers/syringe/S = SG.syringes[1] var/obj/item/reagent_containers/syringe/S = SG.syringes[1]
S.reagents.trans_to(BB, S.reagents.total_volume, transfered_by = user) S.reagents.trans_to(BB, S.reagents.total_volume, transfered_by = user)
BB.name = S.name D.add_dart(S)
var/obj/item/projectile/bullet/dart/D = BB
D.piercing = S.proj_piercing
SG.syringes.Remove(S) SG.syringes.Remove(S)
qdel(S)
..() ..()
/obj/item/ammo_casing/chemgun /obj/item/ammo_casing/chemgun
name = "dart synthesiser" name = "dart synthesiser"
desc = "A high-power spring, linked to an energy-based dart synthesiser." desc = "A high-power spring, linked to an energy-based dart synthesiser."
projectile_type = /obj/item/projectile/bullet/dart projectile_type = /obj/item/projectile/bullet/reusable/dart
firing_effect_type = null firing_effect_type = null
/obj/item/ammo_casing/chemgun/ready_proj(atom/target, mob/living/user, quiet, zone_override = "") /obj/item/ammo_casing/chemgun/ready_proj(atom/target, mob/living/user, quiet, zone_override = "")
@@ -35,8 +33,11 @@
var/obj/item/gun/chem/CG = loc var/obj/item/gun/chem/CG = loc
if(CG.syringes_left <= 0) if(CG.syringes_left <= 0)
return return
CG.reagents.trans_to(BB, 15, transfered_by = user) var/obj/item/projectile/bullet/reusable/dart/D = BB
BB.name = "chemical dart" var/obj/item/reagent_containers/syringe/dart/temp/new_dart = new(D)
CG.reagents.trans_to(new_dart, 15, transfered_by = user)
D.add_dart(new_dart)
CG.syringes_left-- CG.syringes_left--
..() ..()

View File

@@ -1,38 +1,42 @@
/obj/item/projectile/bullet/dart /obj/item/projectile/bullet/reusable/dart
name = "dart" name = "dart"
icon_state = "cbbolt" icon_state = "cbbolt"
damage = 6 damage = 6
var/obj/item/reagent_containers/container
var/piercing = FALSE var/piercing = FALSE
/obj/item/projectile/bullet/dart/Initialize() /obj/item/projectile/bullet/reusable/dart/Initialize()
. = ..() . = ..()
create_reagents(50, NO_REACT)
/obj/item/projectile/bullet/dart/on_hit(atom/target, blocked = FALSE) /obj/item/projectile/bullet/reusable/dart/on_hit(atom/target, blocked = FALSE)
if(iscarbon(target)) if(iscarbon(target))
var/mob/living/carbon/M = target var/mob/living/carbon/C = target
if(blocked != 100) // not completely blocked if(blocked != 100) // not completely blocked
if(M.can_inject(null, FALSE, def_zone, piercing)) // Pass the hit zone to see if it can inject by whether it hit the head or the body. if(C.embed_object(container, def_zone, FALSE))
dropped = TRUE
..() ..()
reagents.reaction(M, INJECT)
reagents.trans_to(M, reagents.total_volume)
return BULLET_ACT_HIT return BULLET_ACT_HIT
else else
blocked = 100 blocked = 100
target.visible_message(span_danger("\The [src] was deflected!"), \ target.visible_message(span_danger("\The [container] was deflected!"), \
span_userdanger("You were protected against \the [src]!")) span_userdanger("You were protected against \the [container]!"))
..(target, blocked) ..(target, blocked)
DISABLE_BITFIELD(reagents.flags, NO_REACT)
reagents.handle_reactions()
return BULLET_ACT_HIT return BULLET_ACT_HIT
/obj/item/projectile/bullet/dart/metalfoam/Initialize() /obj/item/projectile/bullet/reusable/dart/handle_drop()
. = ..() if(!dropped)
reagents.add_reagent(/datum/reagent/aluminium, 15) container.forceMove(get_turf(src))
reagents.add_reagent(/datum/reagent/foaming_agent, 5) dropped = TRUE
reagents.add_reagent(/datum/reagent/toxin/acid/fluacid, 5)
/obj/item/projectile/bullet/dart/syringe /obj/item/projectile/bullet/reusable/dart/proc/add_dart(obj/item/reagent_containers/new_dart)
container = new_dart
new_dart.forceMove(src)
name = new_dart.name
if(istype(new_dart, /obj/item/reagent_containers/syringe))
var/obj/item/reagent_containers/syringe/syringe
piercing = syringe.proj_piercing
/obj/item/projectile/bullet/reusable/dart/syringe
name = "syringe" name = "syringe"
icon_state = "syringeproj" icon_state = "syringeproj"

View File

@@ -15,6 +15,7 @@
materials = list(/datum/material/iron=10, /datum/material/glass=20) materials = list(/datum/material/iron=10, /datum/material/glass=20)
reagent_flags = TRANSPARENT reagent_flags = TRANSPARENT
sharpness = SHARP_POINTY sharpness = SHARP_POINTY
embedding = list("embedded_pain_chance" = 0, "embedded_pain_multiplier" = 0, "embedded_unsafe_removal_time" = 0.25 SECONDS, "embedded_unsafe_removal_pain_multiplier" = 0, "embed_chance" = 15, "embedded_fall_chance" = 5)
/obj/item/reagent_containers/syringe/Initialize() /obj/item/reagent_containers/syringe/Initialize()
. = ..() . = ..()
@@ -193,6 +194,12 @@
injoverlay = "inject" injoverlay = "inject"
add_overlay(injoverlay) add_overlay(injoverlay)
M.update_inv_hands() M.update_inv_hands()
/obj/item/reagent_containers/syringe/on_embed(mob/living/carbon/human/embedde, obj/item/bodypart/part)
reagents.trans_to(embedde, amount_per_transfer_from_this)
/obj/item/reagent_containers/syringe/embed_tick(embedde, part)
reagents.trans_to(embedde, amount_per_transfer_from_this * 0.2)
/obj/item/reagent_containers/syringe/epinephrine /obj/item/reagent_containers/syringe/epinephrine
name = "syringe (epinephrine)" name = "syringe (epinephrine)"
@@ -286,7 +293,6 @@
desc = "A diamond-tipped syringe that pierces armor when launched at high velocity. It can hold up to 10 units." desc = "A diamond-tipped syringe that pierces armor when launched at high velocity. It can hold up to 10 units."
volume = 10 volume = 10
proj_piercing = 1 proj_piercing = 1
/obj/item/reagent_containers/syringe/crude /obj/item/reagent_containers/syringe/crude
name = "crude syringe" name = "crude syringe"
desc = "A crudely made syringe. The flimsy wooden construction makes it hold up minimal amounts of reagents." desc = "A crudely made syringe. The flimsy wooden construction makes it hold up minimal amounts of reagents."
@@ -296,3 +302,15 @@
name = "spider extract syringe" name = "spider extract syringe"
desc = "Contains crikey juice - makes any gold core create the most deadly companions in the world." desc = "Contains crikey juice - makes any gold core create the most deadly companions in the world."
list_reagents = list(/datum/reagent/spider_extract = 1) list_reagents = list(/datum/reagent/spider_extract = 1)
/obj/item/reagent_containers/syringe/dart
name = "reagent dart"
amount_per_transfer_from_this = 10
embedding = list("embed_chance" = 15, "embedded_fall_chance" = 0)
/obj/item/reagent_containers/syringe/dart/temp
item_flags = DROPDEL
/obj/item/reagent_containers/syringe/dart/temp/on_embed_removal(mob/living/carbon/human/embedde)
qdel(src)

View File

@@ -102,6 +102,16 @@
category = list("Medical Designs") category = list("Medical Designs")
departmental_flags = DEPARTMENTAL_FLAG_MEDICAL departmental_flags = DEPARTMENTAL_FLAG_MEDICAL
/datum/design/dartsyringe
name = "Reagent Dart"
desc = "A specialized syringe that quickly inject reagent. It can hold up to 15 units."
id = "dartsyringe"
build_type = PROTOLATHE
materials = list(/datum/material/glass = 2500)
build_path = /obj/item/reagent_containers/syringe/dart
category = list("Medical Designs")
departmental_flags = DEPARTMENTAL_FLAG_MEDICAL
/datum/design/bluespacebodybag /datum/design/bluespacebodybag
name = "Bluespace Body Bag" name = "Bluespace Body Bag"
desc = "A bluespace body bag, powered by experimental bluespace technology. It can hold loads of bodies and the largest of creatures." desc = "A bluespace body bag, powered by experimental bluespace technology. It can hold loads of bodies and the largest of creatures."

View File

@@ -733,7 +733,7 @@
display_name = "Medical Weaponry" display_name = "Medical Weaponry"
description = "Weapons using medical technology." description = "Weapons using medical technology."
prereq_ids = list("adv_biotech", "adv_weaponry") prereq_ids = list("adv_biotech", "adv_weaponry")
design_ids = list("rapidsyringe", "shotgundartcryostatis") design_ids = list("rapidsyringe", "shotgundartcryostatis", "dartsyringe")
research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500) research_costs = list(TECHWEB_POINT_TYPE_GENERIC = 2500)
export_price = 5000 export_price = 5000