Merge pull request #2972 from Yoshax/vending

Vending machine logging
This commit is contained in:
Anewbe
2017-01-31 20:48:26 -06:00
committed by GitHub
2 changed files with 105 additions and 10 deletions
+69 -10
View File
@@ -64,6 +64,11 @@
var/obj/item/weapon/coin/coin
var/datum/wires/vending/wires = null
var/list/log = list()
var/req_log_access = access_cargo //default access for checking logs is cargo
var/has_logs = 0 //defaults to 0, set to anything else for vendor to have logs
/obj/machinery/vending/New()
..()
wires = new(src)
@@ -496,6 +501,8 @@
flick(icon_vend,src)
spawn(vend_delay)
R.get_product(get_turf(src))
if(has_logs)
do_logging(R, user, 1)
if(prob(1))
sleep(3)
if(R.get_product(get_turf(src)))
@@ -507,6 +514,44 @@
currently_vending = null
nanomanager.update_uis(src)
return 1
/obj/machinery/vending/proc/do_logging(datum/stored_item/vending_product/R, mob/user, var/vending = 0)
if(user.GetIdCard())
var/obj/item/weapon/card/id/tempid = user.GetIdCard()
var/list/list_item = list()
if(vending)
list_item += "vend"
else
list_item += "stock"
list_item += tempid.registered_name
list_item += stationtime2text()
list_item += R.item_name
log[++log.len] = list_item
/obj/machinery/vending/proc/show_log(mob/user as mob)
if(user.GetIdCard())
var/obj/item/weapon/card/id/tempid = user.GetIdCard()
if(req_log_access in tempid.GetAccess())
var/datum/browser/popup = new(user, "vending_log", "Vending Log", 700, 500)
var/dat = ""
dat += "<center><span style='font-size:24pt'><b>[name] Vending Log</b></span></center>"
dat += "<center><span style='font-size:16pt'>Welcome [user.name]!</span></center><br>"
dat += "<span style='font-size:8pt'>Below are the recent vending logs for your vending machine.</span><br>"
for(var/i in log)
dat += json_encode(i)
dat += ";<br>"
popup.set_content(dat)
popup.open()
else
to_chat(user,"<span class='warning'>You do not have the required access to view the vending logs for this machine.</span>")
/obj/machinery/vending/verb/check_logs()
set name = "Check Vending Logs"
set category = "Object"
set src in oview(1)
show_log(usr)
/**
* Add item to the machine
@@ -520,6 +565,8 @@
user << "<span class='notice'>You insert \the [W] in the product receptor.</span>"
R.add_product(W)
if(has_logs)
do_logging(R, user)
nanomanager.update_uis(src)
@@ -677,6 +724,8 @@
product_slogans = "I hope nobody asks me for a bloody cup o' tea...;Alcohol is humanity's friend. Would you abandon a friend?;Quite delighted to serve you!;Is nobody thirsty on this station?"
product_ads = "Drink up!;Booze is good for you!;Alcohol is humanity's best friend.;Quite delighted to serve you!;Care for a nice, cold beer?;Nothing cures you like booze!;Have a sip!;Have a drink!;Have a beer!;Beer is good for you!;Only the finest alcohol!;Best quality booze since 2053!;Award-winning wine!;Maximum alcohol!;Man loves beer.;A toast for progress!"
req_access = list(access_bar)
req_log_access = access_bar
has_logs = 1
/obj/machinery/vending/assist
products = list( /obj/item/device/assembly/prox_sensor = 5,/obj/item/device/assembly/igniter = 3,/obj/item/device/assembly/signaler = 4,
@@ -697,9 +746,6 @@
contraband = list(/obj/item/weapon/reagent_containers/food/drinks/ice = 10)
prices = list(/obj/item/weapon/reagent_containers/food/drinks/coffee = 3, /obj/item/weapon/reagent_containers/food/drinks/tea = 3, /obj/item/weapon/reagent_containers/food/drinks/h_chocolate = 3)
/obj/machinery/vending/snack
name = "Getmore Chocolate Corp"
desc = "A snack machine courtesy of the Getmore Chocolate Corporation, based out of Mars."
@@ -714,8 +760,6 @@
/obj/item/weapon/reagent_containers/food/snacks/sosjerky = 2,/obj/item/weapon/reagent_containers/food/snacks/no_raisin = 1,/obj/item/weapon/reagent_containers/food/snacks/spacetwinkie = 1,
/obj/item/weapon/reagent_containers/food/snacks/cheesiehonkers = 1, /obj/item/weapon/reagent_containers/food/snacks/tastybread = 2, /obj/item/weapon/reagent_containers/food/snacks/skrellsnacks = 4)
/obj/machinery/vending/cola
name = "Robust Softdrinks"
desc = "A softdrink vendor provided by Robust Industries, LLC."
@@ -768,7 +812,8 @@
products = list(/obj/item/weapon/cartridge/medical = 10,/obj/item/weapon/cartridge/engineering = 10,/obj/item/weapon/cartridge/security = 10,
/obj/item/weapon/cartridge/janitor = 10,/obj/item/weapon/cartridge/signal/science = 10,/obj/item/device/pda/heads = 10,
/obj/item/weapon/cartridge/captain = 3,/obj/item/weapon/cartridge/quartermaster = 10)
req_log_access = access_hop
has_logs = 1
/obj/machinery/vending/cigarette
name = "Cigarette machine" //OCD had to be uppercase to look nice with the new formating
@@ -798,7 +843,6 @@
/obj/item/weapon/storage/box/matches = 1,
/obj/item/weapon/flame/lighter/random = 2)
/obj/machinery/vending/medical
name = "NanoMed Plus"
desc = "Medical drug dispenser."
@@ -813,7 +857,8 @@
/obj/item/stack/medical/advanced/bruise_pack = 3, /obj/item/stack/medical/advanced/ointment = 3, /obj/item/stack/medical/splint = 2)
contraband = list(/obj/item/weapon/reagent_containers/pill/tox = 3,/obj/item/weapon/reagent_containers/pill/stox = 4,/obj/item/weapon/reagent_containers/pill/antitox = 6)
idle_power_usage = 211 //refrigerator - believe it or not, this is actually the average power consumption of a refrigerated vending machine according to NRCan.
req_log_access = access_cmo
has_logs = 1
//This one's from bay12
/obj/machinery/vending/phoronresearch
@@ -822,6 +867,8 @@
products = list(/obj/item/clothing/under/rank/scientist = 6,/obj/item/clothing/suit/bio_suit = 6,/obj/item/clothing/head/bio_hood = 6,
/obj/item/device/transfer_valve = 6,/obj/item/device/assembly/timer = 6,/obj/item/device/assembly/signaler = 6,
/obj/item/device/assembly/prox_sensor = 6,/obj/item/device/assembly/igniter = 6)
req_log_access = access_rd
has_logs = 1
/obj/machinery/vending/wallmed1
name = "NanoMed"
@@ -832,6 +879,8 @@
density = 0 //It is wall-mounted, and thus, not dense. --Superxpdude
products = list(/obj/item/stack/medical/bruise_pack = 2,/obj/item/stack/medical/ointment = 2,/obj/item/weapon/reagent_containers/hypospray/autoinjector = 4,/obj/item/device/healthanalyzer = 1)
contraband = list(/obj/item/weapon/reagent_containers/syringe/antitoxin = 4,/obj/item/weapon/reagent_containers/syringe/antiviral = 4,/obj/item/weapon/reagent_containers/pill/tox = 1)
req_log_access = access_cmo
has_logs = 1
/obj/machinery/vending/wallmed2
name = "NanoMed"
@@ -842,6 +891,8 @@
products = list(/obj/item/weapon/reagent_containers/hypospray/autoinjector = 5,/obj/item/weapon/reagent_containers/syringe/antitoxin = 3,/obj/item/stack/medical/bruise_pack = 3,
/obj/item/stack/medical/ointment =3,/obj/item/device/healthanalyzer = 3)
contraband = list(/obj/item/weapon/reagent_containers/pill/tox = 3)
req_log_access = access_cmo
has_logs = 1
/obj/machinery/vending/security
name = "SecTech"
@@ -853,6 +904,8 @@
products = list(/obj/item/weapon/handcuffs = 8,/obj/item/weapon/grenade/flashbang = 4,/obj/item/device/flash = 5,
/obj/item/weapon/reagent_containers/food/snacks/donut/normal = 12,/obj/item/weapon/storage/box/evidence = 6)
contraband = list(/obj/item/clothing/glasses/sunglasses = 2,/obj/item/weapon/storage/box/donut = 2)
req_log_access = access_armory
has_logs = 1
/obj/machinery/vending/hydronutrients
name = "NutriMax"
@@ -944,8 +997,6 @@
/obj/item/weapon/storage/toolbox/lunchbox/cti = 3,
/obj/item/weapon/storage/toolbox/lunchbox/nymph = 3,
/obj/item/weapon/storage/toolbox/lunchbox/syndicate = 3)
contraband = list(/obj/item/weapon/material/knife/butch = 2)
/obj/machinery/vending/sovietsoda
@@ -969,6 +1020,8 @@
/obj/item/device/flashlight/glowstick/orange =3, /obj/item/device/flashlight/glowstick/yellow = 3)
contraband = list(/obj/item/weapon/weldingtool/hugetank = 2,/obj/item/clothing/gloves/fyellow = 2,)
premium = list(/obj/item/clothing/gloves/yellow = 1)
req_log_access = access_ce
has_logs = 1
/obj/machinery/vending/engivend
name = "Engi-Vend"
@@ -990,6 +1043,8 @@
contraband = list(/obj/item/weapon/cell/potato = 3)
premium = list(/obj/item/weapon/storage/belt/utility = 3)
product_records = list()
req_log_access = access_ce
has_logs = 1
//This one's from bay12
/obj/machinery/vending/engineering
@@ -1007,6 +1062,8 @@
// There was an incorrect entry (cablecoil/power). I improvised to cablecoil/heavyduty.
// Another invalid entry, /obj/item/weapon/circuitry. I don't even know what that would translate to, removed it.
// The original products list wasn't finished. The ones without given quantities became quantity 5. -Sayu
req_log_access = access_ce
has_logs = 1
//This one's from bay12
/obj/machinery/vending/robotics
@@ -1020,3 +1077,5 @@
/obj/item/weapon/surgical/scalpel = 2,/obj/item/weapon/surgical/circular_saw = 2,/obj/item/weapon/tank/anesthetic = 2,/obj/item/clothing/mask/breath/medical = 5,
/obj/item/weapon/screwdriver = 5,/obj/item/weapon/crowbar = 5)
//everything after the power cell had no amounts, I improvised. -Sayu
req_log_access = access_rd
has_logs = 1
+36
View File
@@ -0,0 +1,36 @@
################################
# Example Changelog File
#
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
#
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
# When it is, any changes listed below will disappear.
#
# Valid Prefixes:
# bugfix
# wip (For works in progress)
# tweak
# soundadd
# sounddel
# rscadd (general adding of nice things)
# rscdel (general deleting of nice things)
# imageadd
# imagedel
# maptweak
# spellcheck (typo fixes)
# experiment
#################################
# Your name.
author: Yosh
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
delete-after: True
# Any changes you've made. See valid prefix list above.
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
# SCREW THIS UP AND IT WON'T WORK.
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
changes:
- rscadd: "Some vending machines now log the items they've vended and had stocked, storing the name of the user, the time and the item. These can be found by using the new verb for vending machines, or from the right click menu."