mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 12:35:33 +01:00
Medipen Reagent Examine Text Remaster 2: The Electric Boogaloo (#69723)
* new medipen examine, petty_string remaster Adds a new, allergic reaction reducing description to the medipen, as well as a remastered petty_string for reagents which makes it much more modular.
This commit is contained in:
@@ -245,12 +245,37 @@ Primarily used in reagents/reaction_agents
|
||||
creation_purity = src.creation_purity
|
||||
return creation_purity / normalise_num_to
|
||||
|
||||
/proc/pretty_string_from_reagent_list(list/reagent_list)
|
||||
/**
|
||||
* Input a reagent_list, outputs pretty readable text!
|
||||
* Default output will be formatted as
|
||||
* * water, 5 | silicon, 6 | soup, 4 | space lube, 8
|
||||
*
|
||||
* * names_only will remove the amount displays, showing
|
||||
* * water | silicon | soup | space lube
|
||||
*
|
||||
* * join_text will alter the text between reagents
|
||||
* * setting to ", " will result in
|
||||
* * water, 5, silicon, 6, soup, 4, space lube, 8
|
||||
*
|
||||
* * final_and should be combined with the above. will format as
|
||||
* * water, 5, silicon, 6, soup, 4, and space lube, 8
|
||||
*
|
||||
* * capitalize_names will result in
|
||||
* * Water, 5 | Silicon, 6 | Soup, 4 | Space lube, 8
|
||||
*
|
||||
* * * use (reagents.reagent_list, names_only, join_text = ", ", final_and, capitalize_names) for the formatting
|
||||
* * * Water, Silicon, Soup, and Space Lube
|
||||
*/
|
||||
/proc/pretty_string_from_reagent_list(list/reagent_list, names_only, join_text = " | ", final_and, capitalize_names)
|
||||
//Convert reagent list to a printable string for logging etc
|
||||
var/list/rs = list()
|
||||
for (var/datum/reagent/R in reagent_list)
|
||||
rs += "[R.name], [R.volume]"
|
||||
|
||||
return rs.Join(" | ")
|
||||
|
||||
var/list/reagent_strings = list()
|
||||
var/reagents_left = reagent_list.len
|
||||
var/intial_list_length = reagents_left
|
||||
for (var/datum/reagent/reagent as anything in reagent_list)
|
||||
reagents_left--
|
||||
if(final_and && intial_list_length > 1 && reagents_left == 0)
|
||||
reagent_strings += "and [capitalize_names ? capitalize(reagent.name) : reagent.name][names_only ? null : ", [reagent.volume]"]"
|
||||
else
|
||||
reagent_strings += "[capitalize_names ? capitalize(reagent.name) : reagent.name][names_only ? null : ", [reagent.volume]"]"
|
||||
|
||||
return reagent_strings.Join(join_text)
|
||||
|
||||
@@ -116,6 +116,8 @@
|
||||
list_reagents = list(/datum/reagent/medicine/epinephrine = 10, /datum/reagent/toxin/formaldehyde = 3, /datum/reagent/medicine/coagulant = 2)
|
||||
custom_price = PAYCHECK_CREW
|
||||
custom_premium_price = PAYCHECK_COMMAND
|
||||
var/label_examine = TRUE
|
||||
var/label_text
|
||||
|
||||
/obj/item/reagent_containers/hypospray/medipen/suicide_act(mob/living/carbon/user)
|
||||
user.visible_message(span_suicide("[user] begins to choke on \the [src]! It looks like [user.p_theyre()] trying to commit suicide!"))
|
||||
@@ -136,10 +138,16 @@
|
||||
icon_state = "[base_icon_state][(reagents.total_volume > 0) ? null : 0]"
|
||||
return ..()
|
||||
|
||||
/obj/item/reagent_containers/hypospray/medipen/Initialize(mapload)
|
||||
. = ..()
|
||||
label_text = span_notice("There is a sticker pasted onto the side which reads, 'WARNING: This medipen contains [pretty_string_from_reagent_list(reagents.reagent_list, names_only = TRUE, join_text = ", ", final_and = TRUE, capitalize_names = TRUE)], do not use if allergic to any listed chemicals.")
|
||||
|
||||
/obj/item/reagent_containers/hypospray/medipen/examine()
|
||||
. = ..()
|
||||
if(reagents?.reagent_list.len)
|
||||
. += span_notice("It is currently loaded.")
|
||||
if (label_examine)
|
||||
. += label_text
|
||||
if(length(reagents?.reagent_list))
|
||||
. += span_notice("It is loaded.")
|
||||
else
|
||||
. += span_notice("It is spent.")
|
||||
|
||||
@@ -276,6 +284,7 @@
|
||||
inhand_icon_state = "snail"
|
||||
base_icon_state = "snail"
|
||||
list_reagents = list(/datum/reagent/snail = 10)
|
||||
label_examine = FALSE
|
||||
|
||||
/obj/item/reagent_containers/hypospray/medipen/magillitis
|
||||
name = "experimental autoinjector"
|
||||
@@ -296,6 +305,7 @@
|
||||
list_reagents = list(/datum/reagent/drug/pumpup = 15)
|
||||
icon_state = "maintenance"
|
||||
base_icon_state = "maintenance"
|
||||
label_examine = FALSE
|
||||
|
||||
/obj/item/reagent_containers/hypospray/medipen/ekit
|
||||
name = "emergency first-aid autoinjector"
|
||||
|
||||
Reference in New Issue
Block a user