//Hyper station economy. Because coding it yourself is easier than port sometimes. /obj/machinery/atm name = "automated teller machine" desc = "a wall mounted electronic banking outlet for accessing your bank account." icon = 'hyperstation/icons/obj/economy.dmi' icon_state = "atm" max_integrity = 250 integrity_failure = 100 armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 90, "acid" = 30) use_power = IDLE_POWER_USE idle_power_usage = 0 active_power_usage = 0 power_channel = ENVIRON resistance_flags = FIRE_PROOF var/obj/item/card/held_card var/user = "" light_power = 0 light_range = 7 light_color = "#ff3232" var/pin = 0 /obj/machinery/atm/ui_interact(mob/user) . = ..() var/dat = {""} dat += "
" dat += "
ATM
" dat += "Welcome to General Station 13's Automated Teller Service." dat += "
" if(!held_card) dat += "
Welcome, please insert your ID to continue." else dat += "
Welcome user, [held_card ? user : "------"]
"
var/obj/item/card/id/idcard = held_card
if(idcard.registered_account)
dat += "
Account ID: ([idcard.registered_account.account_id])" else dat += "
Error, this account number does not exsist, please contact your local administration." if(idcard.registered_account) if(!idcard.registered_account.account_pin || pin == idcard.registered_account.account_pin) dat += "
Balance: $[idcard.registered_account.account_balance]" //dat += "
Offstation Balance: " dat += "
" dat += "Withdraw" dat += "Change Pin" //dat += "Account Settings" dat += "Eject" else dat += "
Please enter your bank pin to continue!" dat += "
"
dat += "[pin ? pin : "----"]
"
dat += "
" var/datum/browser/popup = new(user, "atm", "ATM") popup.set_content(dat) popup.set_title_image(user.browse_rsc_icon(icon, icon_state), 500,300) popup.open() /obj/machinery/atm/attackby(obj/item/I, mob/living/user) if(istype(I, /obj/item/card)) //input id! if(!held_card) var/obj/item/card/id/idcard = I if(!user.transferItemToLoc(I, src)) //check if you can put it in return held_card = idcard user = idcard.registered_name pin = "" playsound(src, 'sound/machines/button.ogg', 50, FALSE) src.ui_interact(usr) if(istype(I, /obj/item/stack/credits)) //feed money back into the machine! dont need a pin to donate stuff. if(held_card) var/obj/item/stack/credits/cred = I var/obj/item/card/id/idcard = held_card idcard.registered_account.account_balance = (idcard.registered_account.account_balance+cred.amount) to_chat(usr, "You insert [cred] into the ATM.") src.ui_interact(usr) del(cred) /obj/machinery/atm/Topic(href, href_list) . = ..() if(..()) return if(href_list["card"]) if(held_card) if(usr.CanReach(src)) playsound(src, 'sound/machines/button.ogg', 50, FALSE) if(usr.put_in_hands(held_card)) to_chat(usr, "You take the ID out of the slot.") held_card = null else to_chat(usr, "The machine drops the ID onto the floor!") held_card = null pin = "" user = "" if(href_list["pin"]) playsound(src, get_sfx("terminal_type"), 25, 1) var/pininput = input(user, "Input pin", "Pin Number") as num|null if(pininput) if(pininput > 9999 || pininput < 1000) to_chat(usr, "[src.name] buzzes, you must input a 4 digit number between 1000 and 9999.") return pin = max(min( round(text2num(pininput)), 9999),1000) //4 numbers or less. var/obj/item/card/id/idcard = held_card if(pin == idcard.registered_account.account_pin) to_chat(usr, "[src.name] beeps, accepting the pin.") else to_chat(usr, "[src.name] buzzes, denying the pin.") if(href_list["changepin"]) playsound(src, get_sfx("terminal_type"), 25, 1) var/pinchange = input(user, "Input pin", "Pin Number") as num|null if(pinchange > 9999 || pinchange < 1000) to_chat(usr, "[src.name], you must have a 4 digit number for a pin and be between 1000 and 9999.") return if(pinchange) var/pinchange2 = input(user, "Confirm pin", "Confirm pin") as num|null //time to confirm! if(pinchange == pinchange2) var/obj/item/card/id/idcard = held_card idcard.registered_account.account_pin = pinchange to_chat(usr, "[src.name] beeps, your pin has been changed to [pinchange]!.") else to_chat(usr, "[src.name] buzzes, your pins did not match!") pin = "" if(href_list["withdraw"]) playsound(src, get_sfx("terminal_type"), 25, 1) if(held_card) var/obj/item/card/id/idcard = held_card if(idcard.registered_account) var/amount = input(user, "Choose amount", "Withdraw") as num|null if(amount>0) amount = max(min( round(text2num(amount)), idcard.registered_account.account_balance),0) //make sure they aint taking out more then what they have to_chat(usr, "The machine prints out [amount] credits.") idcard.registered_account.account_balance = (idcard.registered_account.account_balance-amount) //subtract the amount they took out. var/obj/item/stack/credits/C = new /obj/item/stack/credits/(loc) C.amount = amount if(usr.put_in_hands(C)) to_chat(usr, "You take [C] out of the ATM.") src.ui_interact(usr) //Money, Well, get back, I'm all right Jack, Keep your hands off of my stack. //making our own currency, just to stop exploits (for now) /obj/item/stack/credits name = "credits" singular_name = "credit" desc = "Legal tender, a bundle of shiny metalic looking notes." icon = 'hyperstation/icons/obj/economy.dmi' icon_state = "cash" amount = 1 max_amount = 99999999 throwforce = 0 throw_speed = 2 throw_range = 2 w_class = WEIGHT_CLASS_TINY full_w_class = WEIGHT_CLASS_TINY resistance_flags = FLAMMABLE var/value = 1