mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
Ported Animus Station's currency system, credit to @EditorRUS. ATM's now require a pin which is generated and stored in mob notes. Space cash renamed to stack of credits, and same value credits can be stacked together. Credits are generated randomly between 500 to 2000 credits. Credits or coins can be inserted and converted to credits. Still not used for anything!
This commit is contained in:
+2
-1
@@ -159,6 +159,7 @@
|
||||
#define FILE_DIR "code/unused/powerarmor"
|
||||
#define FILE_DIR "code/unused/spacecraft"
|
||||
#define FILE_DIR "code/WorkInProgress"
|
||||
#define FILE_DIR "code/WorkInProgress/animusstation"
|
||||
#define FILE_DIR "code/WorkInProgress/Apples"
|
||||
#define FILE_DIR "code/WorkInProgress/Cael_Aislinn"
|
||||
#define FILE_DIR "code/WorkInProgress/Cael_Aislinn/Rust"
|
||||
@@ -1139,6 +1140,7 @@
|
||||
#include "code\WorkInProgress\AI_Visibility.dm"
|
||||
#include "code\WorkInProgress\buildmode.dm"
|
||||
#include "code\WorkInProgress\explosion_particles.dm"
|
||||
#include "code\WorkInProgress\animusstation\atm.dm"
|
||||
#include "code\WorkInProgress\Cael_Aislinn\Rust\core_field.dm"
|
||||
#include "code\WorkInProgress\Cael_Aislinn\Rust\core_gen.dm"
|
||||
#include "code\WorkInProgress\Cael_Aislinn\Rust\core_monitor.dm"
|
||||
@@ -1159,7 +1161,6 @@
|
||||
#include "code\WorkInProgress\Cael_Aislinn\Tajara\tajaran.dm"
|
||||
#include "code\WorkInProgress\Cael_Aislinn\Tajara\whisper.dm"
|
||||
#include "code\WorkInProgress\Chinsky\ashtray.dm"
|
||||
#include "code\WorkInProgress\Mini\ATM.dm"
|
||||
#include "code\WorkInProgress\Mini\atmos_control.dm"
|
||||
#include "code\WorkInProgress\Mini\pipe_heater.dm"
|
||||
#include "code\WorkInProgress\Mloc\Shortcuts.dm"
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
/*
|
||||
|
||||
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/machinery/atm
|
||||
name = "\improper NanoTrasen Automatic Teller Machine"
|
||||
desc = "For all your monetary needs!"
|
||||
icon = 'terminals.dmi'
|
||||
icon_state = "atm"
|
||||
anchored = 1
|
||||
use_power = 1
|
||||
idle_power_usage = 10
|
||||
var
|
||||
obj/item/weapon/card/id/card
|
||||
obj/item/weapon/spacecash/cashes = list()
|
||||
inserted = 0
|
||||
accepted = 0
|
||||
pincode = 0
|
||||
|
||||
attackby(var/obj/A, var/mob/user)
|
||||
if(istype(A,/obj/item/weapon/spacecash))
|
||||
cashes += A
|
||||
user.drop_item()
|
||||
A.loc = src
|
||||
inserted += A:worth
|
||||
return
|
||||
if(istype(A,/obj/item/weapon/coin))
|
||||
if(istype(A,/obj/item/weapon/coin/iron))
|
||||
cashes += A
|
||||
user.drop_item()
|
||||
A.loc = src
|
||||
inserted += 1
|
||||
return
|
||||
if(istype(A,/obj/item/weapon/coin/silver))
|
||||
cashes += A
|
||||
user.drop_item()
|
||||
A.loc = src
|
||||
inserted += 10
|
||||
return
|
||||
if(istype(A,/obj/item/weapon/coin/gold))
|
||||
cashes += A
|
||||
user.drop_item()
|
||||
A.loc = src
|
||||
inserted += 50
|
||||
return
|
||||
if(istype(A,/obj/item/weapon/coin/plasma))
|
||||
cashes += A
|
||||
user.drop_item()
|
||||
A.loc = src
|
||||
inserted += 2
|
||||
return
|
||||
if(istype(A,/obj/item/weapon/coin/diamond))
|
||||
cashes += A
|
||||
user.drop_item()
|
||||
A.loc = src
|
||||
inserted += 300
|
||||
return
|
||||
user << "You insert your [A.name] in ATM"
|
||||
..()
|
||||
|
||||
attack_hand(var/mob/user)
|
||||
if(istype(user, /mob/living/silicon))
|
||||
user << "\red Artificial unit recognized. Artificial units do not currently receive monetary compensation, as per NanoTrasen regulation #1005."
|
||||
return
|
||||
|
||||
if(!(stat && NOPOWER) && ishuman(user))
|
||||
var/dat
|
||||
user.machine = src
|
||||
if(!accepted)
|
||||
if(scan(user))
|
||||
pincode = input(usr,"Enter a pin-code") as num
|
||||
if(card.checkaccess(pincode,usr))
|
||||
accepted = 1
|
||||
// usr << sound('nya.mp3')
|
||||
else
|
||||
dat = null
|
||||
dat += "<h1>NanoTrasen Automatic Teller Machine</h1><br/>"
|
||||
dat += "For all your monetary needs!<br/><br/>"
|
||||
dat += "Welcome, [card.registered_name]. You have [card.money] credits deposited.<br>"
|
||||
dat += "Current inserted item value: [inserted] credits.<br><br>"
|
||||
dat += "Please, select action<br>"
|
||||
dat += "<a href=\"?src=\ref[src]&with=1\">Withdraw Physical Credits</a><br/>"
|
||||
dat += "<a href=\"?src=\ref[src]&eca=1\">Eject Inserted Items</a><br/>"
|
||||
dat += "<a href=\"?src=\ref[src]&ins=1\">Convert Inserted Items to Credits</a><br/>"
|
||||
dat += "<a href=\"?src=\ref[src]&lock=1\">Lock ATM</a><br/>"
|
||||
user << browse(dat,"window=atm")
|
||||
onclose(user,"close")
|
||||
proc
|
||||
withdraw(var/mob/user)
|
||||
if(accepted)
|
||||
var/amount = input("How much would you like to withdraw?", "Amount", 0) in list(1,10,20,50,100,200,500,1000, 0)
|
||||
if(amount == 0)
|
||||
return
|
||||
if(card.money >= amount)
|
||||
card.money -= amount
|
||||
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
|
||||
user << "\red Error: Insufficient funds."
|
||||
return
|
||||
|
||||
scan(var/mob/user)
|
||||
if(istype(user,/mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.wear_id)
|
||||
if(istype(H.wear_id, /obj/item/weapon/card/id))
|
||||
card = H.wear_id
|
||||
return 1
|
||||
if(istype(H.wear_id,/obj/item/device/pda))
|
||||
var/obj/item/device/pda/P = H.wear_id
|
||||
if(istype(P.id,/obj/item/weapon/card/id))
|
||||
card = P.id
|
||||
return 1
|
||||
return 0
|
||||
return 0
|
||||
|
||||
insert()
|
||||
if(accepted)
|
||||
card.money += inserted
|
||||
inserted = 0
|
||||
|
||||
Topic(href,href_list)
|
||||
if (usr.machine==src && get_dist(src, usr) <= 1 || istype(usr, /mob/living/silicon/ai))
|
||||
if(href_list["eca"])
|
||||
if(accepted)
|
||||
for(var/obj/item/weapon/spacecash/M in cashes)
|
||||
M.loc = loc
|
||||
inserted = 0
|
||||
if(!cashes)
|
||||
cashes = null
|
||||
if(href_list["with"] && card)
|
||||
withdraw(usr)
|
||||
if(href_list["ins"] && card)
|
||||
if(accepted)
|
||||
card.money += inserted
|
||||
inserted = 0
|
||||
if(href_list["lock"])
|
||||
card = null
|
||||
accepted = 0
|
||||
usr.machine = null
|
||||
usr << browse(null,"window=atm")
|
||||
src.updateUsrDialog()
|
||||
else
|
||||
usr.machine = null
|
||||
usr << browse(null,"window=atm")
|
||||
@@ -159,7 +159,7 @@
|
||||
ammo = 30
|
||||
|
||||
/obj/item/weapon/spacecash
|
||||
name = "space cash"
|
||||
name = "stack of credits"
|
||||
desc = "It's worth 1 credit."
|
||||
gender = PLURAL
|
||||
icon = 'items.dmi'
|
||||
@@ -175,6 +175,7 @@
|
||||
var/access = list()
|
||||
access = access_crate_cash
|
||||
var/worth = 1
|
||||
var/amount = 1
|
||||
|
||||
/obj/item/weapon/spacecash/c10
|
||||
icon_state = "spacecash10"
|
||||
@@ -211,6 +212,51 @@
|
||||
access = access_crate_cash
|
||||
desc = "It's worth 1000 credits."
|
||||
worth = 1000
|
||||
/obj/item/weapon/spacecash/attack_self(var/mob/user)
|
||||
var/dat = "<HEAD><TITLE>Space cash stack</TITLE></HEAD>"
|
||||
dat += "Credit amount - [worth * amount]<br>"
|
||||
dat += "<a href='?src=\ref[src];takemoney=1'>Take amount</a><br>"
|
||||
user << browse(dat,"window=money")
|
||||
|
||||
/obj/item/weapon/spacecash/Topic(href, href_list)
|
||||
if(href_list["takemoney"])
|
||||
var/a = 1
|
||||
a = input(usr,"How much you want take?") as num
|
||||
if((a > src.amount) || (a < 0))
|
||||
usr << "\red You don't have that many credits"
|
||||
return
|
||||
src.amount -= a
|
||||
var/obj/item/weapon/spacecash/S
|
||||
if(a <= 0)
|
||||
return
|
||||
switch(src.worth)
|
||||
if(1)
|
||||
S = new /obj/item/weapon/spacecash(get_turf(src))
|
||||
if(10)
|
||||
S = new /obj/item/weapon/spacecash/c10(get_turf(src))
|
||||
if(20)
|
||||
S = new /obj/item/weapon/spacecash/c20(get_turf(src))
|
||||
if(50)
|
||||
S = new /obj/item/weapon/spacecash/c50(get_turf(src))
|
||||
if(100)
|
||||
S = new /obj/item/weapon/spacecash/c100(get_turf(src))
|
||||
if(200)
|
||||
S = new /obj/item/weapon/spacecash/c200(get_turf(src))
|
||||
if(500)
|
||||
S = new /obj/item/weapon/spacecash/c500(get_turf(src))
|
||||
if(1000)
|
||||
S = new /obj/item/weapon/spacecash/c1000(get_turf(src))
|
||||
S.amount = a
|
||||
if(src.amount == 0)
|
||||
del(src)
|
||||
/obj/item/weapon/spacecash/attackby(var/obj/I, var/mob/user)
|
||||
if(!I)
|
||||
return
|
||||
if(istype(I,src))
|
||||
src.amount += I:amount
|
||||
user << "You add [I:amount] credits to stack"
|
||||
del(I)
|
||||
|
||||
|
||||
/obj/item/device/mass_spectrometer
|
||||
desc = "A hand-held mass spectrometer which identifies trace chemicals in a blood sample."
|
||||
@@ -573,11 +619,12 @@
|
||||
item_state = "card-id"
|
||||
var/access = list()
|
||||
var/registered_name = null // The name registered_name on the card
|
||||
|
||||
var/pin = 0
|
||||
var/money = 0
|
||||
var/assignment = null
|
||||
var/over_jumpsuit = 1 // If set to 0, it won't display on top of the mob's jumpsuit
|
||||
var/dorm = 0 // determines if this ID has claimed a dorm already
|
||||
|
||||
var/obj/item/weapon/credit_card/card
|
||||
var/blood_type = "\[UNSET\]"
|
||||
var/dna_hash = "\[UNSET\]"
|
||||
var/fingerprint_hash = "\[UNSET\]"
|
||||
|
||||
@@ -304,6 +304,11 @@ var/global/datum/controller/occupations/job_master
|
||||
C.assignment = title
|
||||
C.name = "[C.registered_name]'s ID Card ([C.assignment])"
|
||||
C.access = get_access(rank)
|
||||
C.pin = rand(1000,9999)
|
||||
C.money = 10 * rand(50,200)
|
||||
H << "\bold \red Your station account has [C.money] credits. The pin-code is [C.pin]."
|
||||
if(H.mind)
|
||||
H.mind.memory += "Your pin-code is - [C.pin]<br>"
|
||||
H.equip_if_possible(C, H.slot_wear_id)
|
||||
if(!H.equip_if_possible(new /obj/item/weapon/pen(H), H.slot_r_store))
|
||||
H.equip_if_possible(new /obj/item/weapon/pen(H), H.slot_ears)
|
||||
|
||||
@@ -107,6 +107,12 @@ FINGERPRINT CARD
|
||||
else
|
||||
..()
|
||||
|
||||
/obj/item/weapon/card/id/proc/checkaccess(p,var/mob/user)
|
||||
if(p == pin)
|
||||
user << "\green Access granted"
|
||||
return 1
|
||||
user << "\red Access denied"
|
||||
return 0
|
||||
|
||||
// FINGERPRINT HOLDER
|
||||
|
||||
|
||||
Reference in New Issue
Block a user