/obj/machinery/nanofab/refining name = "Nano-fabricator (Refining)" blueprints = list(/datum/matfab_recipe/coilsmall, /datum/matfab_recipe/coillarge, /datum/matfab_recipe/arrowhead, /datum/matfab_recipe/spear, /datum/matfab_recipe/arrow, /datum/matfab_recipe/bow, /datum/matfab_recipe/quiver, /datum/matfab_recipe/lens, /datum/matfab_recipe/gears, /datum/matfab_recipe/tripod, /datum/matfab_recipe/aplates, /datum/matfab_recipe/glasses, /datum/matfab_recipe/jumpsuit, /datum/matfab_recipe/glovesins, /datum/matfab_recipe/glovearmor, /datum/matfab_recipe/flashlight, /datum/matfab_recipe/lighttube, /datum/matfab_recipe/lightbulb, /datum/matfab_recipe/tripodbulb, /datum/matfab_recipe/sheet, /datum/matfab_recipe/cell_small, /datum/matfab_recipe/cell_large, /datum/matfab_recipe/simple/insbody, /datum/matfab_recipe/simple/insneck, /datum/matfab_recipe/simple/insmouth, /datum/matfab_recipe/simple/insbell, /datum/matfab_recipe/simple/insbag, /datum/matfab_recipe/simple/insrod, /datum/matfab_recipe/infusion, /datum/matfab_recipe/spacesuit) /obj/machinery/nanofab/mining name = "Nano-fabricator (Mining)" color = "#f4a742" blueprints = list(/datum/matfab_recipe/mining_tool, /datum/matfab_recipe/mining_head_drill, /datum/matfab_recipe/mining_head_hammer, /datum/matfab_recipe/mining_head_blaster, /datum/matfab_recipe/mining_head_pick, /datum/matfab_recipe/mining_mod_conc, /datum/matfab_recipe/spacesuit) /obj/machinery/nanofab/prototype name = "Nano-fabricator (Protoype)" color = "#496ba3" blueprints = list(/datum/matfab_recipe/mining_tool, /datum/matfab_recipe/mining_head_drill, /datum/matfab_recipe/mining_head_hammer, /datum/matfab_recipe/mining_head_blaster, /datum/matfab_recipe/mining_head_pick, /datum/matfab_recipe/mining_mod_conc, /datum/matfab_recipe/spacesuit) /obj/machinery/nanofab name = "Nano-fabricator" desc = "'Nano' means it's high-tech stuff." icon = 'icons/obj/manufacturer.dmi' icon_state = "fab2-on" anchored = 1 density = 1 layer = FLOOR_EQUIP_LAYER1 flags = NOSPLASH deconstruct_flags = DECON_SCREWDRIVER | DECON_WRENCH | DECON_CROWBAR | DECON_WELDER | DECON_WIRECUTTERS | DECON_MULTITOOL var/outputInternal = 0 //Produced objects are fed back into the fabricator. var/list/queue = list() var/tab = "recipes" //recipes,storage,selected,part var/datum/matfab_recipe/selectedRecipe = null var/list/recipes = list() var/datum/matfab_part/selectingPart = null var/list/selectingPartList = list() var/filter_category = null var/filter_string = null var/list/blueprints = list() New() for(var/R in blueprints) recipes.Add(new R()) ..() attack_hand(mob/user as mob) user.Browse(buildHtml(), "window=nfab;size=550x650;title=Nano-fabricator;fade_in=0;can_resize=0", 1) return proc/buildHtml() var/html = "" html += " Blueprints " html += " Storage " html += " Settings" html += "
" html += "
" switch(tab) if("settings") html += "Output into fabricator: [outputInternal ? "ON":"OFF"]
" if("recipes") if(filter_category) html += " Filtering by Category: [filter_category] " else if (filter_string) html += " Filtering by Name: [filter_string] " else html += " Category: " var/list/categories = list() for(var/datum/matfab_recipe/E in recipes) if(!categories.Find(E.category)) categories.Add(E.category) html += "[E.category] " html += " Name" html += "
" html += "
" for(var/datum/matfab_recipe/R in recipes) if(filter_category && R.category != filter_category) continue if(filter_string && !findtext(lowertext(R.name), lowertext(filter_string)) ) continue html += " [R.name]
" html += " Materials: " var/commanow = 0 for(var/datum/matfab_part/P in R.required_parts) html += "[commanow ? ", ":""]([P.required_amount]) [P.name]" commanow = 1 html += "
" html += " [R.desc]

" html += "
" if("storage") var/count = 0 for(var/obj/item/I in src) if(!I.amount) continue html += " [I.name]
" count++ if(!count) html += " No objects found in storage.
" if("selected") if(!selectedRecipe) html += "ERROR: No recipe selected." else html += "[selectedRecipe.name] :
" var/complete = 1 for(var/datum/matfab_part/P in selectedRecipe.required_parts) html += " [P.required_amount] [P.name] [P.part_name] " html += "[P.assigned ? P.assigned.name : "(EMPTY)"]" html += "
" if(!P.assigned && !P.optional) complete = 0 if(complete) html += "
BUILD" if("part") if(selectedRecipe && selectingPart) if(!selectingPartList.len) html += " No valid components found for this slot.
" html += "
Return" else for(var/obj/item/I in selectingPartList) if(selectingPartList[I]) //If this is set to 1, we dont have enough of the material. html += "

[I.name] (Insufficient amount)


" else html += " [I.name]
" html += "
Return" html += "
" return html Topic(href, href_list) if(get_dist(usr, src) > 1 || usr.z != src.z) return if(href_list["tab"]) tab = href_list["tab"] else if(href_list["filteroff"]) filter_category = null filter_string = null else if(href_list["filtercat"]) filter_category = strip_html(href_list["filtercat"]) filter_string = null else if(href_list["filterstr"]) filter_category = null filter_string = strip_html(input(usr,"Search for:","Search","")) else if(href_list["toggleoutput"]) outputInternal = !outputInternal else if(href_list["select"]) var/datum/matfab_recipe/R = locate(href_list["select"]) in recipes if(R) selectedRecipe = R selectedRecipe.clear() tab = "selected" else if(href_list["eject"]) var/obj/item/L = locate(href_list["eject"]) in src.contents if(!(L in src)) return L.set_loc(src.loc) else if(href_list["selectpart"]) var/datum/matfab_part/P = locate(href_list["selectpart"]) in selectedRecipe.required_parts if(P && selectedRecipe) selectingPart = P var/list/validOptions = list() validOptions.Add(src.contents) for(var/datum/matfab_part/RP in selectedRecipe.required_parts) if(RP == P) continue if(RP.assigned) validOptions.Remove(RP.assigned) for(var/obj/item/I in validOptions) if(!I.amount) validOptions.Remove(I) var/matchlevel = P.checkMatch(I) if(matchlevel == 0) validOptions.Remove(I) if(matchlevel == -1) validOptions[I] = 1 selectingPartList = validOptions tab = "part" else if(href_list["partreturn"]) tab = "selected" selectingPart = null selectingPartList.Cut() else if(href_list["choosepart"]) var/obj/item/L = locate(href_list["choosepart"]) in selectingPartList if(!(L in src) || !L) return selectingPart.assigned = L tab = "selected" selectingPart = null selectingPartList.Cut() else if(href_list["build"]) if(selectedRecipe) var/maxAmt = selectedRecipe.getMaxAmount() if(maxAmt) var/howMany = input(usr, "How many ([maxAmt] max)?", "Select amount", maxAmt) if(howMany > maxAmt || !selectedRecipe) return //ZeWaka: Fix for null.canBuild if(selectedRecipe.canBuild(howMany, src)) selectedRecipe.build(howMany, src) for(var/datum/matfab_part/P in selectedRecipe.required_parts) if(P.assigned) P.assigned.change_stack_amount(-(P.required_amount*howMany)) tab = "recipes" selectingPart = null selectingPartList.Cut() selectedRecipe = null flick("fab2-work", src) attack_hand(usr) proc/addMaterial(var/obj/item/W, var/mob/user) for(var/obj/item/A in src) if(A == W|| !A.amount) continue if(A.material && W.material) if(isSameMaterial(A.material, W.material) && A.check_valid_stack(W)) var/obj/item/I = A I.change_stack_amount(W.amount) if(W == user.equipped()) user.drop_item() qdel(W) return if(W == user.equipped()) user.drop_item() W.set_loc(src) attackby(var/obj/item/W , mob/user as mob) if(issilicon(user)) // fix bug where borgs could put things into the nanofab and then reject them boutput(user, "You can't put that in, it's attached to you.") return if(isExploitableObject(W)) boutput(user, "\the [src] grumps at you and refuses to use [W].") return user.visible_message("[user] puts \the [W] in \the [src].") addMaterial(W, user) /* if(W.material != null) user.visible_message("[user] puts \the [W] in \the [src].") if( W.material ) addMaterial(W, user) else boutput(user, "The fabricator can only use material-based objects.") return */ return ex_act(severity) return /obj/item/paper/nano_blueprint name = "Nanofab Blueprint" desc = "It's a blueprint to allow a nanofab unit to build something." info = "There's all manner of confusing diagrams and instructions on here. It's meant for a machine to read." icon = 'icons/obj/electronics.dmi' icon_state = "blueprint" item_state = "sheet" var/datum/matfab_recipe/recipe = null New(var/loc,var/schematic = null) if (!src.recipe) qdel(src) return 0 src.name = "Manufacturer Blueprint: [src.recipe.name]" src.desc = "This blueprint will allow a nanofab unit to build a [src.recipe.name]" src.pixel_x = rand(-4,4) src.pixel_y = rand(-4,4) return 1