//Custom vendors /obj/machinery/vending/nifsoft_shop name = "NIFSoft Shop" desc = "For all your mindware and mindware accessories." product_ads = "Let us get into your head!;Looking for an upgrade?;Surpass Humanity!;Why be normal when you can be SUPERnormal?;Jack in with NIFSoft!" icon = 'icons/obj/machines/ar_elements.dmi' icon_state = "proj" icon_vend = "beacon_yes" icon_deny = "beacon_no" products = list() contraband = list() premium = list() var/global/list/starting_legal_nifsoft var/global/list/starting_illegal_nifsoft density = 0 opacity = 0 var/datum/entopic/entopic /obj/machinery/vending/nifsoft_shop/Initialize() . = ..() entopic = new(aholder = src, aicon = icon, aicon_state = "beacon") /obj/machinery/vending/nifsoft_shop/Destroy() QDEL_NULL(entopic) return ..() /obj/machinery/vending/nifsoft_shop/power_change() ..() if(!entopic) return //Early APC init(), ignore if(stat & BROKEN) icon_state = "[initial(icon_state)]-broken" entopic.hide() else if(!(stat & NOPOWER)) icon_state = initial(icon_state) entopic.show() else spawn(rand(0, 15)) icon_state = "[initial(icon_state)]-off" entopic.hide() /obj/machinery/vending/nifsoft_shop/malfunction() stat |= BROKEN icon_state = "[initial(icon_state)]-broken" entopic.hide() return // Special Treatment! /obj/machinery/vending/nifsoft_shop/build_inventory() //Firsties if(!starting_legal_nifsoft) starting_legal_nifsoft = list() starting_illegal_nifsoft = list() for(var/P in (subtypesof(/datum/nifsoft) - typesof(/datum/nifsoft/package))) var/datum/nifsoft/NS = P if(initial(NS.vended)) switch(initial(NS.illegal)) if(TRUE) starting_illegal_nifsoft += NS if(FALSE) starting_legal_nifsoft += NS products = starting_legal_nifsoft.Copy() contraband = starting_illegal_nifsoft.Copy() var/list/all_products = list( list(products, CAT_NORMAL), list(contraband, CAT_HIDDEN), list(premium, CAT_COIN)) for(var/current_list in all_products) var/category = current_list[2] for(var/entry in current_list[1]) var/datum/nifsoft/NS = entry var/applies_to = initial(NS.applies_to) var/context = "" if(!(applies_to & NIF_SYNTHETIC)) context = " (Org Only)" else if(!(applies_to & NIF_ORGANIC)) context = " (Syn Only)" var/name = "[initial(NS.name)][context]" var/datum/stored_item/vending_product/product = new/datum/stored_item/vending_product(src, entry, name) product.price = initial(NS.cost) product.amount = 10 product.category = category product_records.Add(product) /obj/machinery/vending/nifsoft_shop/allowed(mob/user) if(!ishuman(user)) return FALSE var/mob/living/carbon/human/H = user if(!H.nif || !H.nif.stat == NIF_WORKING) to_chat(H, "[src] seems unable to connect to your NIF...") flick(icon_deny,entopic.my_image) return FALSE return ..() //Had to override this too /obj/machinery/vending/nifsoft_shop/Topic(href, href_list) if(stat & (BROKEN|NOPOWER)) return if(usr.stat || usr.restrained()) return if(href_list["remove_coin"] && !istype(usr,/mob/living/silicon)) if(!coin) to_chat(usr, "There is no coin in this machine.") return coin.forceMove(src.loc) if(!usr.get_active_hand()) usr.put_in_hands(coin) to_chat(usr, "You remove \the [coin] from \the [src]") coin = null categories &= ~CAT_COIN if((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf)))) if((href_list["vend"]) && (vend_ready) && (!currently_vending)) if((!allowed(usr)) && !emagged && scan_id) //For SECURE VENDING MACHINES YEAH to_chat(usr, "Access denied.") //Unless emagged of course flick(icon_deny,entopic.my_image) return var/key = text2num(href_list["vend"]) var/datum/stored_item/vending_product/R = product_records[key] // This should not happen unless the request from NanoUI was bad if(!(R.category & categories)) return //Specific soft access checking var/datum/nifsoft/path = R.item_path if(initial(path.access)) var/list/soft_access = list(initial(path.access)) var/list/usr_access = usr.GetAccess() if(!has_access(soft_access, list(), usr_access) && !emagged) to_chat(usr, "You aren't authorized to buy [initial(path.name)].") flick(icon_deny,entopic.my_image) return if(R.price <= 0) vend(R, usr) else if(istype(usr,/mob/living/silicon)) //If the item is not free, provide feedback if a synth is trying to buy something. to_chat(usr, "Artificial unit recognized. Artificial units cannot complete this transaction. Purchase canceled.") return else currently_vending = R if(!vendor_account || vendor_account.suspended) status_message = "This machine is currently unable to process payments due to problems with the associated account." status_error = 1 else status_message = "[initial(path.desc)]

Please swipe a card or insert cash to pay for the item." status_error = 0 else if(href_list["cancelpurchase"]) currently_vending = null else if((href_list["togglevoice"]) && (panel_open)) shut_up = !shut_up add_fingerprint(usr) SSnanoui.update_uis(src) // Also special treatment! /obj/machinery/vending/nifsoft_shop/vend(datum/stored_item/vending_product/R, mob/user) var/mob/living/carbon/human/H = user if((!allowed(usr)) && !emagged && scan_id && istype(H)) //For SECURE VENDING MACHINES YEAH to_chat(usr, "Purchase not allowed.") //Unless emagged of course flick(icon_deny,entopic.my_image) return vend_ready = 0 //One thing at a time!! status_message = "Installing..." status_error = 0 SSnanoui.update_uis(src) if(R.category & CAT_COIN) if(!coin) to_chat(user, "You need to insert a coin to get this item.") return if(coin.string_attached) if(prob(50)) to_chat(user, "You successfully pull the coin out before \the [src] could swallow it.") else to_chat(user, "You weren't able to pull the coin out fast enough, the machine ate it, string and all.") qdel(coin) coin = null categories &= ~CAT_COIN else qdel(coin) coin = null categories &= ~CAT_COIN if(((last_reply + (vend_delay + 200)) <= world.time) && vend_reply) spawn(0) speak(vend_reply) last_reply = world.time use_power(vend_power_usage) //actuators and stuff spawn(vend_delay) R.amount-- new R.item_path(H.nif) flick(icon_vend,entopic.my_image) if(has_logs) do_logging(R, user, 1) status_message = "" status_error = 0 vend_ready = 1 currently_vending = null SSnanoui.update_uis(src) return 1 //Can't throw intangible software at people. /obj/machinery/vending/nifsoft_shop/throw_item() //TODO: Make it throw disks at people with random software? That might be fun. EVEN THE ILLEGAL ONES? ;o return 0