/datum/autowiki/vending page = "Template:Autowiki/Content/VendingMachines" /datum/autowiki/vending/generate() var/output = "" var/list/cached_products = list() // `powered()` checks if its in a null loc to say it's not powered. // So we put it inside, something var/obj/parent = new for (var/obj/machinery/vending/vending_type as anything in sort_list(subtypesof(/obj/machinery/vending), GLOBAL_PROC_REF(cmp_typepaths_asc))) var/obj/machinery/vending/parent_machine = type2parent(vending_type) if(initial(parent_machine.name) == initial(vending_type.name)) continue //Same name, likely just a slightly touched up subtype for specific maps. var/obj/machinery/vending/vending_machine = new vending_type(parent) vending_machine.use_power = FALSE vending_machine.update_icon(UPDATE_ICON_STATE) // Technically won't match if product amounts change, but this isn't likely var/products_cache_key = vending_machine.products.Join("-") + "&" + vending_machine.contraband.Join("-") + "&" + vending_machine.premium.Join("-") // In the future, this should show all vending machines that have the same products if (products_cache_key in cached_products) qdel(vending_machine) continue cached_products += products_cache_key var/filename = SANITIZE_FILENAME(escape_value(format_text(vending_machine.name))) output += include_template("Autowiki/VendingMachine", list( "icon" = escape_value(filename), "name" = escape_value(format_text(vending_machine.name)), "products" = format_product_list(vending_machine.products), "contraband" = format_product_list(vending_machine.contraband), "premium" = format_product_list(vending_machine.premium), )) // It would be cool to make this support gifs someday, but not now upload_icon(getFlatIcon(vending_machine, no_anim = TRUE), filename) qdel(vending_machine) qdel(parent) return output /datum/autowiki/vending/proc/format_product_list(list/product_list) var/output = "" for (var/obj/product_path as anything in product_list) output += include_template("Autowiki/VendingMachineProduct", list( "name" = escape_value(capitalize(format_text(initial(product_path.name)))), "amount" = product_list[product_path], )) return output