Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pill bottle coloring #6190

Merged
merged 15 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions code/game/objects/items/storage/firstaid.dm
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,20 @@
/obj/item/storage/pill_bottle/proc/error_idlock(mob/user)
to_chat(user, SPAN_WARNING("It must have some kind of ID lock..."))

/obj/item/storage/pill_bottle/proc/choose_color()
Git-Nivrak marked this conversation as resolved.
Show resolved Hide resolved
var/list/possible_colors = list("Orange" = "", "Blue" = "1", "Yellow" = "2", "Light Purple" = "3", "Light Grey" = "4",
"White" = "5", "Light Green" = "6", "Cyan" = "7", "Red" = "8", "Aquamarine" = "9", "Grey" = "10", "Bordeaux" = "11", "Black" = "12")
Git-Nivrak marked this conversation as resolved.
Show resolved Hide resolved
var/selected_color = tgui_input_list(usr, "Select a color.", "Color choice", possible_colors)
Git-Nivrak marked this conversation as resolved.
Show resolved Hide resolved

if (!selected_color)
selected_color = ""
Drulikar marked this conversation as resolved.
Show resolved Hide resolved

selected_color = possible_colors[selected_color]

icon_state = "pill_canister" + selected_color
to_chat(usr, SPAN_NOTICE("You color [src]."))
Git-Nivrak marked this conversation as resolved.
Show resolved Hide resolved
update_icon()

/obj/item/storage/pill_bottle/verb/set_maptext()
set category = "Object"
set name = "Set short label (on-sprite)"
Expand Down
4 changes: 4 additions & 0 deletions code/game/objects/items/tools/misc_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@
if(isturf(A))
to_chat(user, SPAN_WARNING("The label won't stick to that."))
return
if(istype(A, /obj/item/storage/pill_bottle))
var/obj/item/storage/pill_bottle/target_pill_bottle = A
target_pill_bottle.choose_color()
Git-Nivrak marked this conversation as resolved.
Show resolved Hide resolved

if(!label || !length(label))
remove_label(A, user)
return
Expand Down
13 changes: 11 additions & 2 deletions code/modules/reagents/chemistry_machinery/chem_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
if(!istype(dest))
source.reagents.remove_reagent(reagent_id, amount)
else if(dest.reagents)
source.reagents.trans_id_to(dest, reagent_id, amount)
source.reagents.trans_id_to(dest, reagent_id, amount)
Git-Nivrak marked this conversation as resolved.
Show resolved Hide resolved

/obj/structure/machinery/chem_master/Topic(href, href_list)
. = ..()
Expand Down Expand Up @@ -141,7 +141,15 @@
if(length(label) < 3)
loaded_pill_bottle.maptext_label = label
loaded_pill_bottle.update_icon()
else if(href_list["setcolor"])
// Checking for state changes
if(!loaded_pill_bottle)
return

if(!Adjacent(usr))
return

loaded_pill_bottle.choose_color()

else if(href_list["close"])
close_browser(user, "chemmaster")
Expand Down Expand Up @@ -355,7 +363,8 @@
if(pill_maker)
if(loaded_pill_bottle)
dat += "<A href='?src=\ref[src];ejectp=1;user=\ref[user]'>Eject [loaded_pill_bottle] \[[loaded_pill_bottle.contents.len]/[loaded_pill_bottle.max_storage_space]\]</A><BR>"
dat += "<A href='?src=\ref[src];addlabelp=1;user=\ref[user]'>Add label to [loaded_pill_bottle] \[[loaded_pill_bottle.contents.len]/[loaded_pill_bottle.max_storage_space]\]</A><BR><BR>"
dat += "<A href='?src=\ref[src];addlabelp=1;user=\ref[user]'>Add label to [loaded_pill_bottle] \[[loaded_pill_bottle.contents.len]/[loaded_pill_bottle.max_storage_space]\]</A><BR>"
dat += "<A href='?src=\ref[src];setcolor=1;user=\ref[user]'>Set color to [loaded_pill_bottle] \[[loaded_pill_bottle.contents.len]/[loaded_pill_bottle.max_storage_space]\]</A><BR><BR>"
dat += "<A href='?src=\ref[src];transferp=1;'>Transfer [loaded_pill_bottle] \[[loaded_pill_bottle.contents.len]/[loaded_pill_bottle.max_storage_space]\] to the smartfridge</A><BR><BR>"
else
dat += "No pill bottle inserted.<BR><BR>"
Expand Down
Loading