Skip to content

Commit

Permalink
Pill bottle coloring (#6190)
Browse files Browse the repository at this point in the history
# About the pull request
You can now change pill bottle colors with 12 color options!
Color reference:

![image](https://github.com/cmss13-devs/cmss13/assets/59925169/d8ce2260-adc9-4000-80fe-0106355e9043)

<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game
Allows for some less bland colors on custom pill bottles that are nicer
on the eye
It's also pretty cool
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
qol: You can now change the color of pill bottles in the chem master or
with a hand labeler.
/:cl:

---------

Co-authored-by: Drathek <[email protected]>
  • Loading branch information
Git-Nivrak and Drulikar committed Apr 26, 2024
1 parent 4d7a5d1 commit ccb9bc5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
28 changes: 28 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,34 @@
/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(mob/user)
if(!user)
user = usr
var/static/list/possible_colors = list(
"Orange" = "",
"Blue" = "1",
"Yellow" = "2",
"Light Purple" = "3",
"Light Grey" = "4",
"White" = "5",
"Light Green" = "6",
"Cyan" = "7",
"Bordeaux" = "8",
"Aquamarine" = "9",
"Grey" = "10",
"Red" = "11",
"Black" = "12",
)
var/selected_color = tgui_input_list(user, "Select a color.", "Color choice", possible_colors)
if(!selected_color)
return

selected_color = possible_colors[selected_color]

icon_state = "pill_canister" + selected_color
to_chat(user, SPAN_NOTICE("You color [src]."))
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(user)

if(!label || !length(label))
remove_label(A, user)
return
Expand Down
11 changes: 10 additions & 1 deletion code/modules/reagents/chemistry_machinery/chem_master.dm
Original file line number Diff line number Diff line change
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

0 comments on commit ccb9bc5

Please sign in to comment.