ID:162207
 
Hi, now I need help with just one thing for an anvil system now, but I only need help with just one part. Its probably simple and I am just missing it, but anyways here goes.

I am trying to make it so at the beginning, when you double click, it asks, you, what kind would you like to make? Theres so many that you can make so instead of saying switch(input(blah blah)in list([100 things]) that you can just search for each type in the path and add it to the list, kinda like so

if("Armor")
var/list/Armorlist=list()
for(var/C as anything in typesof(/obj/items/Blacksmithing/Armor))
if(!locate(C)in Armorlist)
Armorlist+=C
var/O=input("What would you like to make?")as null|anything in Armorlist


the problem with this though is that the list shows their directories, thus messing up the look
There may be better ways to do this, but off hand I'd say you could generate an associative list at world/New() which lists each item type by its name.

For example:

var/list/selection_list = list()

proc/GenerateSelectionList()
for(var/T in typesof(/obj/mytype)
var/obj/mytype/O = new(T)
selection_list[O.name] = T
del(O)


Then when you want to select the type from the list, you'd do something like this:

var/T_name = input("What would you like to make?") as null|anything in selection_list
var/T = selection_list[T_name]


... At which point you'll be presented with a list of object names, and when you select the name you want, you can determine which object type that name belongs to by checking the selection list's associated value.