mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-25 06:00:16 +01:00
Simplifies/refactors the "Add reagent" verb in VV (#22862)
* Adds an "Enter ID" option to reagent adding * Adds a cancel option to selecting reagent ID
This commit is contained in:
@@ -52,13 +52,13 @@
|
||||
var/refid = "\ref[D]"
|
||||
var/icon/sprite
|
||||
var/hash
|
||||
|
||||
|
||||
var/type = /list
|
||||
if (!islist)
|
||||
type = D.type
|
||||
|
||||
|
||||
|
||||
|
||||
if(istype(D,/atom))
|
||||
var/atom/AT = D
|
||||
if(AT.icon && AT.icon_state)
|
||||
@@ -850,8 +850,22 @@
|
||||
A.create_reagents(amount)
|
||||
|
||||
if(A.reagents)
|
||||
var/chosen_id
|
||||
var/list/reagent_options = sortList(chemical_reagents_list)
|
||||
var/chosen_id = input(usr, "Choose a reagent to add.", "Choose a reagent.") in reagent_options|null
|
||||
switch(alert(usr, "Choose a method.", "Add Reagents", "Enter ID", "Choose ID"))
|
||||
if("Enter ID")
|
||||
var/valid_id
|
||||
while(!valid_id)
|
||||
chosen_id = stripped_input(usr, "Enter the ID of the reagent you want to add.")
|
||||
if(!chosen_id) //Get me out of here!
|
||||
break
|
||||
for(var/ID in reagent_options)
|
||||
if(ID == chosen_id)
|
||||
valid_id = 1
|
||||
if(!valid_id)
|
||||
usr << "<span class='warning'>A reagent with that ID doesn't exist!</span>"
|
||||
if("Choose ID")
|
||||
chosen_id = input(usr, "Choose a reagent to add.", "Choose a reagent.") as null|anything in reagent_options
|
||||
if(chosen_id)
|
||||
var/amount = input(usr, "Choose the amount to add.", "Choose the amount.", A.reagents.maximum_volume) as num
|
||||
if(amount)
|
||||
|
||||
Reference in New Issue
Block a user