ATM with a really shitty sprite, not mapped

You can take money out with a html interface, and put money in by bashing the thing with the money
This commit is contained in:
Miniature
2012-04-28 07:34:44 +09:30
parent 316092a048
commit a447d994b0
4 changed files with 92 additions and 0 deletions

View File

@@ -0,0 +1,83 @@
/*
TODO:
give money an actual use (QM stuff, vending machines)
send money to people (might be worth attaching money to custom database thing for this, instead of being in the ID)
log transactions
*/
/obj/item/weapon/card/id/var/money = 2000
/obj/machinery/atm
name = "NanoTrasen Automatic Teller Machine"
desc = "For all your monetary needs!"
icon = 'terminals.dmi'
icon_state = "atm"
use_power = 1
idle_power_usage = 10
/obj/machinery/atm/attackby(obj/item/I as obj, mob/user as mob)
if(ishuman(user))
var/obj/item/weapon/card/id/user_id = src.scan_user(user)
if(istype(I,/obj/item/weapon/spacecash))
user_id.money += I:worth
del I
/obj/machinery/atm/attack_hand(mob/user as mob)
var/obj/item/weapon/card/id/user_id = src.scan_user(user)
if(..())
return
var/dat = ""
dat += "<h1>NanoTrasen Automatic Teller Machine</h1><br/>"
dat += "For all your monetary needs!<br/><br/>"
dat += "Welcome, [user_id.registered_name].<br/>"
dat += "You have $[user_id.money] in your account.<br/>"
dat += "<a href=\"?src=\ref[src]&withdraw=1&id=\ref[user_id]\">Withdraw</a><br/>"
user << browse(dat,"window=atm")
/obj/machinery/atm/Topic(var/href, var/href_list)
if(href_list["withdraw"] && href_list["id"])
var/amount = input("How much would you like to withdraw?", "Amount", 0) in list(1,10,20,50,100,200,500,1000, 0)
var/obj/item/weapon/card/id/user_id = locate(href_list["id"])
if(amount != 0 && user_id)
if(amount <= user_id.money)
user_id.money -= amount
//hueg switch for giving moneh out
switch(amount)
if(1)
new /obj/item/weapon/spacecash(loc)
if(10)
new /obj/item/weapon/spacecash/c10(loc)
if(20)
new /obj/item/weapon/spacecash/c20(loc)
if(50)
new /obj/item/weapon/spacecash/c50(loc)
if(100)
new /obj/item/weapon/spacecash/c100(loc)
if(200)
new /obj/item/weapon/spacecash/c200(loc)
if(500)
new /obj/item/weapon/spacecash/c500(loc)
if(1000)
new /obj/item/weapon/spacecash/c1000(loc)
else
usr << browse("You don't have that much money!<br/><a href=\"?src=\ref[src]\">Back</a>","window=atm")
return
src.attack_hand(usr)
//stolen wholesale and then edited a bit from newscasters, which are awesome and by Agouri
/obj/machinery/atm/proc/scan_user(mob/living/carbon/human/human_user as mob)
if(human_user.wear_id)
if(istype(human_user.wear_id, /obj/item/device/pda) )
var/obj/item/device/pda/P = human_user.wear_id
if(P.id)
return P.id
else
return null
else if(istype(human_user.wear_id, /obj/item/weapon/card/id) )
return human_user.wear_id
else
return null
else
return null

View File

@@ -139,35 +139,43 @@
w_class = 1.0
var/access = list()
access = access_crate_cash
var/worth = 1
/obj/item/weapon/spacecash/c10
icon_state = "spacecash10"
access = access_crate_cash
desc = "It's worth 10 credits."
worth = 10
/obj/item/weapon/spacecash/c20
icon_state = "spacecash20"
access = access_crate_cash
desc = "It's worth 20 credits."
worth = 20
/obj/item/weapon/spacecash/c50
icon_state = "spacecash50"
access = access_crate_cash
desc = "It's worth 50 credits."
worth = 50
/obj/item/weapon/spacecash/c100
icon_state = "spacecash100"
access = access_crate_cash
desc = "It's worth 100 credits."
worth = 100
/obj/item/weapon/spacecash/c200
icon_state = "spacecash200"
access = access_crate_cash
desc = "It's worth 200 credits."
worth = 200
/obj/item/weapon/spacecash/c500
icon_state = "spacecash500"
access = access_crate_cash
desc = "It's worth 500 credits."
worth = 500
/obj/item/weapon/spacecash/c1000
icon_state = "spacecash1000"
access = access_crate_cash
desc = "It's worth 1000 credits."
worth = 1000
/obj/item/device/mass_spectrometer
desc = "A hand-held mass spectrometer which identifies trace chemicals in a blood sample."