Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all 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
25 changes: 23 additions & 2 deletions code/modules/reagents/chemistry/machinery/chem_dispenser.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
var/has_panel_overlay = TRUE
var/macroresolution = 1
var/obj/item/reagent_containers/beaker = null
//This will display every reagent that it could POSSIBLY dispense if it was fully upgraded (barring emagged chemicals). Ones you can't use will show what tier you need.
//If you want to add more to the tiers, it has to be in dispensable_reagents AND the list of what you tier you want it in below.
var/list/display_reagents = list()

var/list/dispensable_reagents = list(
/datum/reagent/aluminium,
/datum/reagent/bromine,
Expand Down Expand Up @@ -86,14 +90,20 @@
/obj/machinery/chem_dispenser/Initialize()
. = ..()
dispensable_reagents = sortList(dispensable_reagents, /proc/cmp_reagents_asc)
display_reagents = dispensable_reagents.Copy()
if(emagged_reagents)
emagged_reagents = sortList(emagged_reagents, /proc/cmp_reagents_asc)
if(t2_upgrade_reagents)
t2_upgrade_reagents = sortList(t2_upgrade_reagents, /proc/cmp_reagents_asc)
display_reagents |= t2_upgrade_reagents
display_reagents = sortList(display_reagents,/proc/cmp_reagents_asc) //Why is this here you ask? because yogs moved things from t1 to t2 so now it fucks up the ordering. This restores it.
if(t3_upgrade_reagents)
t3_upgrade_reagents = sortList(t3_upgrade_reagents, /proc/cmp_reagents_asc)
display_reagents |= t3_upgrade_reagents
if(t4_upgrade_reagents)
t4_upgrade_reagents = sortList(t4_upgrade_reagents, /proc/cmp_reagents_asc)
display_reagents |= t4_upgrade_reagents
//we don't sort display_reagents again after adding these because they will fuck up the order
update_icon()

/obj/machinery/chem_dispenser/Destroy()
Expand Down Expand Up @@ -150,6 +160,7 @@
return
to_chat(user, span_notice("You short out [src]'s safeties."))
dispensable_reagents |= emagged_reagents//add the emagged reagents to the dispensable ones
display_reagents |= emagged_reagents
obj_flags |= EMAGGED

/obj/machinery/chem_dispenser/ex_act(severity, target)
Expand All @@ -173,6 +184,16 @@
beaker = null
cut_overlays()

/obj/machinery/chem_dispenser/proc/get_tier_for_chemical(datum/reagent/chem)
var/tier = 1
if(t4_upgrade_reagents?.Find(chem.type))
tier = 4
if(t3_upgrade_reagents?.Find(chem.type))
tier = 3
if(t2_upgrade_reagents?.Find(chem.type))
tier = 2
return tier

/obj/machinery/chem_dispenser/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
Expand Down Expand Up @@ -210,13 +231,13 @@
var/is_hallucinating = FALSE
if(user.hallucinating())
is_hallucinating = TRUE
for(var/re in dispensable_reagents)
for(var/re in display_reagents)
var/datum/reagent/temp = GLOB.chemical_reagents_list[re]
if(temp)
var/chemname = temp.name
if(is_hallucinating && prob(5))
chemname = "[pick_list_replacements("hallucination.json", "chemicals")]"
chemicals.Add(list(list("title" = chemname, "id" = ckey(temp.name))))
chemicals.Add(list(list("title" = chemname, "id" = ckey(temp.name), "locked" = (dispensable_reagents.Find(temp.type) ? FALSE : TRUE), "tier" = get_tier_for_chemical(temp))))
for(var/recipe in saved_recipes)
recipes.Add(list(recipe))
data["chemicals"] = chemicals
Expand Down
18 changes: 10 additions & 8 deletions tgui/packages/tgui/interfaces/ChemDispenser.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export const ChemDispenser = (props, context) => {
width="129.5px"
lineHeight={1.75}
content={chemical.title}
disabled={chemical.locked}
tooltip={chemical.locked ? "Requires T" + chemical.tier + " manipulator!" : ""}
onClick={() => act('dispense', {
reagent: chemical.id,
})} />
Expand Down Expand Up @@ -101,14 +103,14 @@ export const ChemDispenser = (props, context) => {
{recording
&& 'Virtual beaker'
|| data.isBeakerLoaded
&& (
<Fragment>
<AnimatedNumber
initial={0}
value={data.beakerCurrentVolume} />
/{data.beakerMaxVolume} units
</Fragment>
)
&& (
<Fragment>
<AnimatedNumber
initial={0}
value={data.beakerCurrentVolume} />
/{data.beakerMaxVolume} units
</Fragment>
)
|| 'No beaker'}
</LabeledList.Item>
<LabeledList.Item
Expand Down