From 66831d6a8a329d8a69d8269685b2249f670e467c Mon Sep 17 00:00:00 2001
From: GDN <96800819+GDNgit@users.noreply.github.com>
Date: Fri, 17 Mar 2023 09:56:43 -0500
Subject: [PATCH] Reworks the cyborg hypospray (#20050)
* Borg hypo rework + radial menu
* bam
---
.../reagents/reagent_containers/borghydro.dm | 123 +++++++++---------
1 file changed, 60 insertions(+), 63 deletions(-)
diff --git a/code/modules/reagents/reagent_containers/borghydro.dm b/code/modules/reagents/reagent_containers/borghydro.dm
index 1f889430ded..a5d1d9bda73 100644
--- a/code/modules/reagents/reagent_containers/borghydro.dm
+++ b/code/modules/reagents/reagent_containers/borghydro.dm
@@ -1,42 +1,64 @@
-#define BORGHYPO_REFILL_VALUE 5
+#define BORGHYPO_REFILL_VALUE 10
/obj/item/reagent_containers/borghypo
name = "Cyborg Hypospray"
desc = "An advanced chemical synthesizer and injection system, designed for heavy-duty medical equipment."
- icon = 'icons/obj/hypo.dmi'
item_state = "hypo"
+ icon = 'icons/obj/hypo.dmi'
icon_state = "borghypo"
amount_per_transfer_from_this = 5
- volume = 30
possible_transfer_amounts = null
- var/mode = 1
+ /// It doesn't matter what reagent is used in the autohypos, so we don't!
+ var/total_reagents = 100
+ /// Maximum reagents that the base autohypo can store
+ var/maximum_reagents = 100
var/charge_cost = 50
+ /// Used for delay with the recharge time, each charge tick is worth 2 seconds of real time
var/charge_tick = 0
- var/recharge_time = 5 //Time it takes for shots to recharge (in seconds)
- var/bypass_protection = 0 //If the hypospray can go through armor or thick material
+ /// Time it takes for reagents to recharge, *2 and you get how many seconds it will additionally take from 2
+ var/recharge_time = 2
+ /// Can the autohypo inject through thick materials?
+ var/bypass_protection = 0
+ var/choosen_reagent = "salglu_solution"
var/list/datum/reagents/reagent_list = list()
- var/list/reagent_ids = list("salglu_solution", "epinephrine", "hydrocodone", "spaceacillin", "charcoal", "mannitol", "salbutamol")
+ var/list/reagent_ids = list("salglu_solution", "epinephrine", "spaceacillin", "charcoal", "hydrocodone", "mannitol", "salbutamol")
+ var/static/list/reagent_icons = list("salglu_solution" = image(icon = 'icons/goonstation/objects/iv.dmi', icon_state = "ivbag"),
+ "epinephrine" = image(icon = 'icons/obj/hypo.dmi', icon_state = "autoinjector"),
+ "spaceacillin" = image(icon = 'icons/obj/decals.dmi', icon_state = "bio"),
+ "charcoal" = image(icon = 'icons/obj/chemical.dmi', icon_state = "pill17"),
+ "hydrocodone" = image(icon = 'icons/obj/chemical.dmi', icon_state = "bottle19"),
+ "styptic_powder" = image(icon = 'icons/obj/chemical.dmi', icon_state = "bandaid_brute"),
+ "salbutamol" = image(icon = 'icons/obj/chemical.dmi', icon_state = "pill8"),
+ "sal_acid" = image(icon = 'icons/obj/chemical.dmi', icon_state = "pill4"),
+ "syndicate_nanites" = image(icon = 'icons/obj/decals.dmi', icon_state = "greencross"),
+ "potass_iodide" = image(icon = 'icons/obj/decals.dmi', icon_state = "radiation"),
+ "mannitol" = image(icon = 'icons/obj/chemical.dmi', icon_state = "pill19"),
+ "salbutamol" = image(icon = 'icons/obj/chemical.dmi', icon_state = "pill8"))
/obj/item/reagent_containers/borghypo/surgeon
reagent_ids = list("styptic_powder", "epinephrine", "salbutamol")
+ total_reagents = 60
+ maximum_reagents = 60
/obj/item/reagent_containers/borghypo/crisis
reagent_ids = list("salglu_solution", "epinephrine", "sal_acid")
+ total_reagents = 60
+ maximum_reagents = 60
/obj/item/reagent_containers/borghypo/syndicate
name = "syndicate cyborg hypospray"
desc = "An experimental piece of Syndicate technology used to produce powerful restorative nanites used to very quickly restore injuries of all types. Also metabolizes potassium iodide, for radiation poisoning, and hydrocodone, for field surgery and pain relief."
icon_state = "borghypo_s"
charge_cost = 20
- recharge_time = 2
+ recharge_time = 1 // No time to recharge
reagent_ids = list("syndicate_nanites", "potass_iodide", "hydrocodone")
- bypass_protection = 1
+ total_reagents = 60
+ maximum_reagents = 60
+ bypass_protection = TRUE
+ choosen_reagent = "syndicate_nanites"
/obj/item/reagent_containers/borghypo/Initialize(mapload)
. = ..()
- for(var/R in reagent_ids)
- add_reagent(R)
-
START_PROCESSING(SSobj, src)
/obj/item/reagent_containers/borghypo/Destroy()
@@ -48,82 +70,57 @@
if(charge_tick < recharge_time)
return FALSE
charge_tick = 0
-
- if(isrobot(loc))
- var/mob/living/silicon/robot/R = loc
- if(R && R.cell)
- var/datum/reagents/RG = reagent_list[mode]
- if(!refill_borghypo(RG, reagent_ids[mode], R)) //If the storage is not full recharge reagents and drain power.
- for(var/i in 1 to reagent_list.len) //if active mode is full loop through the list and fill the first one that is not full
- RG = reagent_list[i]
- if(refill_borghypo(RG, reagent_ids[i], R))
- break
- //update_icon()
+ refill_borghypo()
return TRUE
// Use this to add more chemicals for the borghypo to produce.
-/obj/item/reagent_containers/borghypo/proc/add_reagent(reagent)
- reagent_ids |= reagent
- var/datum/reagents/RG = new(30)
- RG.my_atom = src
- reagent_list += RG
-
- var/datum/reagents/R = reagent_list[reagent_list.len]
- R.add_reagent(reagent, 30)
-
-/obj/item/reagent_containers/borghypo/proc/refill_borghypo(datum/reagents/RG, reagent_id, mob/living/silicon/robot/R)
- if(RG.total_volume < RG.maximum_volume)
- RG.add_reagent(reagent_id, BORGHYPO_REFILL_VALUE)
- R.cell.use(charge_cost)
- return TRUE
- return FALSE
+/obj/item/reagent_containers/borghypo/proc/refill_borghypo(reagent_id, mob/living/silicon/robot/robot)
+ if(istype(robot))
+ robot.cell.use(charge_cost)
+ total_reagents = min((total_reagents + BORGHYPO_REFILL_VALUE), maximum_reagents)
/obj/item/reagent_containers/borghypo/attack(mob/living/carbon/human/M, mob/user)
- var/datum/reagents/R = reagent_list[mode]
- if(!R.total_volume)
+ if(!total_reagents)
to_chat(user, "The injector is empty.")
return
if(!istype(M))
return
- if(R.total_volume && M.can_inject(user, TRUE, user.zone_selected, penetrate_thick = bypass_protection))
+ if(total_reagents && M.can_inject(user, TRUE, user.zone_selected, penetrate_thick = bypass_protection))
to_chat(user, "You inject [M] with the injector.")
to_chat(M, "You feel a tiny prick!")
- R.add_reagent(M)
+ M.reagents.add_reagent(choosen_reagent, 5)
+ total_reagents = (total_reagents - 5)
if(M.reagents)
- var/datum/reagent/injected = GLOB.chemical_reagents_list[reagent_ids[mode]]
+ var/datum/reagent/injected = GLOB.chemical_reagents_list[choosen_reagent]
var/contained = injected.name
- var/trans = R.trans_to(M, amount_per_transfer_from_this)
- add_attack_logs(user, M, "Injected with [name] containing [contained], transfered [trans] units", injected.harmless ? ATKLOG_ALMOSTALL : null)
- to_chat(user, "[trans] units injected. [R.total_volume] units remaining.")
+ add_attack_logs(user, M, "Injected with [name] containing [contained], transfered [5] units", injected.harmless ? ATKLOG_ALMOSTALL : null)
+ to_chat(user, "[5] units injected. [total_reagents] units remaining.")
+
+/obj/item/reagent_containers/borghypo/proc/get_radial_contents()
+ return reagent_icons & reagent_ids
/obj/item/reagent_containers/borghypo/attack_self(mob/user)
- playsound(loc, 'sound/effects/pop.ogg', 50, 0) //Change the mode
- mode++
- if(mode > reagent_list.len)
- mode = 1
+ playsound(loc, 'sound/effects/pop.ogg', 50, 0)
+ var/selected_reagent = show_radial_menu(user, src, get_radial_contents(), radius = 48)
+ if(!selected_reagent)
+ return
charge_tick = 0 //Prevents wasted chems/cell charge if you're cycling through modes.
- var/datum/reagent/R = GLOB.chemical_reagents_list[reagent_ids[mode]]
- to_chat(user, "Synthesizer is now producing '[R.name]'.")
- return
+ var/datum/reagent/R = GLOB.chemical_reagents_list[selected_reagent]
+ to_chat(user, "Synthesizer is now producing [R.name].")
+ choosen_reagent = selected_reagent
/obj/item/reagent_containers/borghypo/examine(mob/user)
. = ..()
- if(get_dist(user, src) <= 2)
- var/empty = TRUE
+ var/datum/reagent/get_reagent_name = GLOB.chemical_reagents_list[choosen_reagent]
+ . |= "It is currently dispensing [get_reagent_name.name]. Contains [total_reagents] units of various reagents." // We couldn't care less what actual reagent is in the container, just if there IS reagent in it
- for(var/datum/reagents/RS in reagent_list)
- var/datum/reagent/R = locate() in RS.reagent_list
- if(R)
- . += "It currently has [R.volume] units of [R.name] stored."
- empty = FALSE
-
- if(empty)
- . += "It is currently empty. Allow some time for the internal syntheszier to produce more."
/obj/item/reagent_containers/borghypo/basic
name = "Basic Medical Hypospray"
desc = "A very basic medical hypospray, capable of providing simple medical treatment in emergencies."
reagent_ids = list("salglu_solution", "epinephrine")
+ total_reagents = 30
+ maximum_reagents = 30
#undef BORGHYPO_REFILL_VALUE