-
Notifications
You must be signed in to change notification settings - Fork 555
/
cash.dm
194 lines (171 loc) · 7.46 KB
/
cash.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/obj/item/spacecash
name = "15 dollars"
desc = "You have 15 dollars."
gender = PLURAL
icon = 'icons/obj/items/items.dmi'
icon_state = "spacecash1"
opacity = FALSE
density = FALSE
anchored = FALSE
force = 1
throwforce = 1
throw_speed = SPEED_FAST
throw_range = 2
w_class = SIZE_TINY
var/worth = 15
/// 'Counterfeit' bills cannot be inserted into the black market for dosh. Their worth is also quartered when entered into an ATM.
var/counterfeit = FALSE
/obj/item/spacecash/Initialize(mapload, ...)
. = ..()
update_value()
/obj/item/spacecash/proc/update_value()
if(counterfeit)
return
black_market_value = worth // While money can be inserted directly into the console, this will allow CTs to detect if the money is 'counterfeit' with their scanner.
/obj/item/spacecash/attackby(obj/item/W as obj, mob/user as mob)
if(istype(W, /obj/item/spacecash))
var/obj/item/spacecash/attack_cash = W
if(istype(attack_cash, /obj/item/spacecash/ewallet))
return FALSE
if(attack_cash.counterfeit != src.counterfeit)
to_chat(user, SPAN_NOTICE("These two stacks of money seem different, somehow..."))
return
var/obj/item/spacecash/bundle/bundle
if(!istype(W, /obj/item/spacecash/bundle))
var/obj/item/spacecash/cash = W
user.temp_drop_inv_item(cash)
bundle = new (src.loc)
bundle.worth += cash.worth
bundle.update_value()
qdel(cash)
else //is bundle
bundle = W
bundle.worth += src.worth
bundle.update_value()
bundle.update_icon()
if(istype(user, /mob/living/carbon/human))
var/mob/living/carbon/human/h_user = user
h_user.temp_drop_inv_item(src)
h_user.temp_drop_inv_item(bundle)
h_user.put_in_hands(bundle)
to_chat(user, SPAN_NOTICE("You add [src.worth] dollars worth of money to the bundles.<br>It holds [bundle.worth] dollars now."))
qdel(src)
/obj/item/spacecash/bundle
name = "stack of dollars"
icon_state = ""
desc = "They are worth 0 dollars."
worth = 0
/obj/item/spacecash/bundle/update_icon()
overlays.Cut()
var/sum = worth
var/num = 0
for(var/i in list(1000,500,200,100,50,20,10,1))
while(sum >= i && num < 50)
sum -= i
num++
var/image/banknote = image('icons/obj/items/items.dmi', "spacecash[i]")
var/matrix/M = matrix()
M.Translate(rand(-6, 6), rand(-4, 8))
M.Turn(pick(-45, -27.5, 0, 0, 0, 0, 0, 0, 0, 27.5, 45))
banknote.transform = M
overlays += banknote
if(num == 0) // Less than one thaler, let's just make it look like 1 for ease
var/image/banknote = image('icons/obj/items/items.dmi', "spacecash1")
var/matrix/M = matrix()
M.Translate(rand(-6, 6), rand(-4, 8))
M.Turn(pick(-45, -27.5, 0, 0, 0, 0, 0, 0, 0, 27.5, 45))
banknote.transform = M
overlays += banknote
desc = "They are worth [worth] dollars."
/obj/item/spacecash/bundle/attack_self(mob/user)
..()
var/oldloc = loc
var/amount = tgui_input_number(user, "How many dollars do you want to take? (0 to [src.worth])", "Take Money", 0, src.worth, 0)
amount = floor(clamp(amount, 0, src.worth))
if(amount == 0)
return
if(QDELETED(src) || loc != oldloc)
return
src.worth -= amount
src.update_icon()
if(!worth)
usr.temp_drop_inv_item(src)
if(amount in list(1000,500,200,100,50,20,1))
var/cashtype = text2path("/obj/item/spacecash/c[amount]")
var/obj/cash = new cashtype (usr.loc)
user.put_in_hands(cash)
else
var/obj/item/spacecash/bundle/bundle = new (usr.loc)
bundle.worth = amount
bundle.update_icon()
user.put_in_hands(bundle)
if(!worth)
qdel(src)
/obj/item/spacecash/c1
name = "1 dollar bill"
icon_state = "spacecash1"
desc = "A single US Government minted one dollar bill. It has a picture of George Washington printed on it. Makes most people of English origin cry, but isn't worth very much. Could probably get you half a hot-dog in some systems. "
worth = 1
/obj/item/spacecash/c10
name = "10 dollar bill"
icon_state = "spacecash10"
desc = "A single US Government minted ten-dollar bill. It has a picture of Alexander Hamilton on it, federal bank enthusiast, and victim of a terrible griefing incident. Could probably pay for a meal at a cheap restaurant, before tax and tip."
worth = 10
/obj/item/spacecash/c20
name = "20 dollar bill"
icon_state = "spacecash20"
desc = "A single US Government minted twenty-dollar bill. It has a picture of Andrew Jackson on it, famed hero of the War of 1812 and slayer of indigenous peoples everywhere. Could probably afford you a nice 2-course meal at the local colony steakhouse."
worth = 20
/obj/item/spacecash/c50
name = "50 dollar bill"
icon_state = "spacecash50"
desc = "A single US Government minted fifty-dollar bill. It has a picture of Ulysses S. Grant, a man known for expendable troop tactics in the civil war, and probable distant relative of Bill Carson. You could probably buy the whole bar a beer with this, assuming there are 4 other people in the bar."
worth = 50
/obj/item/spacecash/c100
name = "100 dollar bill"
icon_state = "spacecash100"
desc = "A single US Government minted hundred-dollar bill. It has a picture of Ben Franklin, lightning kite extraordinaire. You could probably pay for an entire day of shore leave activities with this, provided you aren't careless. (which you are)"
worth = 100
/obj/item/spacecash/c200
name = "200 dollars"
icon_state = "spacecash200"
desc = "Two US Government minted hundred-dollar bills. They both have pictures of Ben Franklin on them. Both Bens look at you expectedly and passionately from different angles."
worth = 200
/obj/item/spacecash/c500
name = "500 dollars"
icon_state = "spacecash500"
desc = "Five US Government minted hundred-dollar bills. All of them have pictures of Ben Franklin on them. They all eagarly glare at you, making you feel as if you owe them something. "
worth = 500
/obj/item/spacecash/c500/counterfeit
// If you're going to slap down huge sums of cash in easily reachable spots for RP or flavor reasons, make them counterfeit, so they don't break the black market - they will be rejected.
counterfeit = TRUE
/obj/item/spacecash/c1000
name = "1000 dollars"
icon_state = "spacecash1000"
desc = "Ten US Government minted hundred-dollar bills. Every single damn one of them has Ben Fucking Franklin on them. The court of Bens sit impatiently, as if each one thought they alone belonged to you. This coven of angry Bens have all since learned about your relations with the other Bens, and they want answers."
worth = 1000
/obj/item/spacecash/c1000/counterfeit
// If you're going to slap down huge sums of cash in easily reachable spots for RP or flavor reasons, make them counterfeit, so they don't break the black market - they will be rejected.
counterfeit = TRUE
/proc/spawn_money(sum, spawnloc, mob/living/carbon/human/human_user as mob)
if(sum in list(1000,500,200,100,50,20,10,1))
var/cash_type = text2path("/obj/item/spacecash/c[sum]")
var/obj/cash = new cash_type (usr.loc)
if(ishuman(human_user) && !human_user.get_active_hand())
human_user.put_in_hands(cash)
else
var/obj/item/spacecash/bundle/bundle = new (spawnloc)
bundle.worth = sum
bundle.update_icon()
if (ishuman(human_user) && !human_user.get_active_hand())
human_user.put_in_hands(bundle)
return
/obj/item/spacecash/ewallet
name = "\improper Weyland-Yutani cash card"
icon_state = "efundcard"
desc = "A Weyland-Yutani backed cash card that holds an amount of money."
var/owner_name = "" //So the ATM can set it so the EFTPOS can put a valid name on transactions.
/obj/item/spacecash/ewallet/get_examine_text(mob/user)
. = ..()
if(user == loc)
. += SPAN_NOTICE("Charge card's owner: [owner_name]. Dollars remaining: [worth].")