Skip to content

Commit

Permalink
Tweaks for icons of items within vendor UIs. (#9789)
Browse files Browse the repository at this point in the history
* icons_done

* some-more-work

* icons-code

* different-cache-path

* asset-list-instead-of-fake-items

* forgot-to-remove-these

* removes-the-separate-vendors-icon-file

* icon-fix

* merge_conflict_fix

* test

* reset

* try

* fix
  • Loading branch information
CydiaLamiales authored Nov 7, 2023
1 parent 2b2c549 commit 6579be3
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 10 deletions.
4 changes: 0 additions & 4 deletions code/_onclick/drag_drop.dm
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@

/obj/item/proc/onMouseUp(object, location, params, mob)
return

/obj/item
var/canMouseDown = FALSE

/obj/item/gun
item_flags = ISWEAPON
var/automatic = 0 //can gun use it, 0 is no, anything above 0 is the delay between clicks in ds
Expand Down
5 changes: 5 additions & 0 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
///Icon for monkey
var/icon/monkey_icon

var/canMouseDown = FALSE

///Icons used to show the item in vendors instead of the item's actual icon, drawn from the item's icon file (just chemical.dm for now)
var/vendor_icon_preview = null


/obj/item/Initialize(mapload)

Expand Down
6 changes: 5 additions & 1 deletion code/modules/asset_cache/asset_list_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,11 @@
else
icon_file = initial(item.icon)
var/icon_state = initial(item.icon_state)

if(ispath(item, /obj/item))
var/obj/item/fake_item = item
if(initial(fake_item.vendor_icon_preview))
icon_state = initial(fake_item.vendor_icon_preview)
icon_file = initial(fake_item.icon)
#ifdef UNIT_TESTS
var/icon_states_list = icon_states(icon_file)
if (!(icon_state in icon_states_list))
Expand Down
3 changes: 3 additions & 0 deletions code/modules/food_and_drinks/drinks/drinks/drinkingglass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,17 @@
/obj/item/reagent_containers/food/drinks/drinkingglass/filled/soda
name = "Soda Water"
list_reagents = list(/datum/reagent/consumable/sodawater = 50)
vendor_icon_preview = "glass_clear"

/obj/item/reagent_containers/food/drinks/drinkingglass/filled/cola
name = "Space Cola"
list_reagents = list(/datum/reagent/consumable/space_cola = 50)
vendor_icon_preview = "glass_brown"

/obj/item/reagent_containers/food/drinks/drinkingglass/filled/nuka_cola
name = "Nuka Cola"
list_reagents = list(/datum/reagent/consumable/nuka_cola = 50)
vendor_icon_preview = "nuka_colaglass"

/obj/item/reagent_containers/food/drinks/drinkingglass/attackby(obj/item/I, mob/user, params)
if(istype(I, /obj/item/reagent_containers/food/snacks/egg)) //breaking eggs
Expand Down
3 changes: 3 additions & 0 deletions code/modules/hydroponics/hydroitemdefines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,19 @@
name = "bottle of E-Z-Nutrient"
desc = "Contains a fertilizer that causes mild mutations with each harvest."
list_reagents = list(/datum/reagent/plantnutriment/eznutriment = 50)
vendor_icon_preview = "bottle_eznutrient"

/obj/item/reagent_containers/glass/bottle/nutrient/l4z
name = "bottle of Left 4 Zed"
desc = "Contains a fertilizer that limits plant yields to no more than one and causes significant mutations in plants."
list_reagents = list(/datum/reagent/plantnutriment/left4zednutriment = 50)
vendor_icon_preview = "bottle_left4zed"

/obj/item/reagent_containers/glass/bottle/nutrient/rh
name = "bottle of Robust Harvest"
desc = "Contains a fertilizer that increases the yield of a plant by 30% while causing no mutations."
list_reagents = list(/datum/reagent/plantnutriment/robustharvestnutriment = 50)
vendor_icon_preview = "bottle_robustharvest"

/obj/item/reagent_containers/glass/bottle/nutrient/empty
name = "bottle"
Expand Down
15 changes: 13 additions & 2 deletions code/modules/reagents/reagent_containers/bottle.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,21 @@
label_name = "epinephrine"
desc = "A small bottle. Contains epinephrine - used to stabilize patients."
list_reagents = list(/datum/reagent/medicine/epinephrine = 30)
vendor_icon_preview = "bottle_epinephrine"

/obj/item/reagent_containers/glass/bottle/tricordrazine
name = "tricordrazine bottle"
label_name = "tricordrazine"
desc = "A small bottle of tricordrazine. Used to aid in patient recovery."
list_reagents = list(/datum/reagent/medicine/tricordrazine = 30)
vendor_icon_preview = "bottle_tricordrazine"

/obj/item/reagent_containers/glass/bottle/spaceacillin
name = "spaceacillin bottle"
label_name = "spaceacillin"
desc = "A small bottle of spaceacillin. Used to cure some diseases."
list_reagents = list(/datum/reagent/medicine/spaceacillin = 30)
vendor_icon_preview = "bottle_spaceacillin"

/obj/item/reagent_containers/glass/bottle/antitoxin
name = "antitoxin bottle"
Expand All @@ -45,12 +48,14 @@
label_name = "mutagen toxin"
desc = "A small bottle of mutagen toxins. Do not drink, Might cause unpredictable mutations."
list_reagents = list(/datum/reagent/toxin/mutagen = 30)
vendor_icon_preview = "bottle_mutagen"

/obj/item/reagent_containers/glass/bottle/toxin
name = "toxin bottle"
label_name = "toxin"
desc = "A small bottle of toxins. Do not drink, it is poisonous."
list_reagents = list(/datum/reagent/toxin = 30)
vendor_icon_preview = "bottle_toxin"

/obj/item/reagent_containers/glass/bottle/cyanide
name = "cyanide bottle"
Expand All @@ -70,14 +75,14 @@
desc = "A small bottle of morphine."
icon = 'icons/obj/chemical.dmi'
list_reagents = list(/datum/reagent/medicine/morphine = 30)
vendor_icon_preview = "bottle_morphine"

/obj/item/reagent_containers/glass/bottle/chloralhydrate
name = "chloral hydrate bottle"
label_name = "chloral hydrate"
desc = "A small bottle of Choral Hydrate. Mickey's Favorite!"
icon_state = "bottle20"
list_reagents = list(/datum/reagent/toxin/chloralhydrate = 30)
label_icon = null
vendor_icon_preview = "bottle_chloralhydrate"

/obj/item/reagent_containers/glass/bottle/mannitol
name = "mannitol bottle"
Expand All @@ -90,6 +95,7 @@
label_name = "charcoal"
desc = "A small bottle of charcoal, which removes toxins and other chemicals from the bloodstream."
list_reagents = list(/datum/reagent/medicine/charcoal = 30)
vendor_icon_preview = "bottle_charcoal"

/obj/item/reagent_containers/glass/bottle/mutagen
name = "unstable mutagen bottle"
Expand Down Expand Up @@ -126,6 +132,7 @@
label_name = "ammonia"
desc = "A small bottle of ammonia."
list_reagents = list(/datum/reagent/ammonia = 30)
vendor_icon_preview = "bottle_ammonia"

/obj/item/reagent_containers/glass/bottle/diethylamine
name = "diethylamine bottle"
Expand Down Expand Up @@ -207,6 +214,7 @@
label_name = "formaldehyde"
desc = "A small bottle. Contains Formaldehyde."
list_reagents = list(/datum/reagent/toxin/formaldehyde = 30)
vendor_icon_preview = "bottle_formaldehyde"

/obj/item/reagent_containers/glass/bottle/initropidril
name = "initropidril bottle"
Expand Down Expand Up @@ -267,6 +275,7 @@
label_name = "saline-glucose"
desc = "A small bottle of saline-glucose solution. Useful for patients lacking in blood volume."
list_reagents = list(/datum/reagent/medicine/salglu_solution = 30)
vendor_icon_preview = "bottle_salineglucose"

/obj/item/reagent_containers/glass/bottle/atropine
name = "atropine bottle"
Expand All @@ -291,6 +300,7 @@
label_name = "Experimental disease culture"
desc = "A small bottle. Contains an untested viral culture in synthblood medium."
spawned_disease = /datum/disease/advance/random
vendor_icon_preview = "bottle_virusblood"

/obj/item/reagent_containers/glass/bottle/pierrot_throat
name = "Pierrot's Throat culture bottle"
Expand Down Expand Up @@ -495,6 +505,7 @@
name = "ethanol bottle"
label_name = "ethanol"
list_reagents = list(/datum/reagent/consumable/ethanol = 30)
vendor_icon_preview = "bottle_ethanol"

/obj/item/reagent_containers/glass/bottle/sugar
name = "sugar bottle"
Expand Down
1 change: 1 addition & 0 deletions code/modules/reagents/reagent_containers/glass.dm
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@
volume = 100
amount_per_transfer_from_this = 20
cap_icon_state = "bottle_cap"
vendor_icon_preview = "waterbottle_large"

/obj/item/reagent_containers/glass/waterbottle/large/empty
list_reagents = list()
Expand Down
6 changes: 3 additions & 3 deletions code/modules/vending/_vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -978,11 +978,11 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
item_price = T.custom_price
item_path = T.type
if(!base64)
if(base64_cache[T.type])
base64 = base64_cache[T.type]
if(base64_cache["[T.icon]_[T.icon_state]"])
base64 = base64_cache["[T.icon]_[T.icon_state]"]
else
base64 = icon2base64(icon(T.icon, T.icon_state, frame=1))
base64_cache[T.type] = base64
base64_cache["[T.icon]_[T.icon_state]"] = base64
break
var/list/data = list(
name = O,
Expand Down
Binary file modified icons/obj/chemical.dmi
Binary file not shown.
Binary file modified icons/obj/drinks.dmi
Binary file not shown.

0 comments on commit 6579be3

Please sign in to comment.