mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-17 10:05:27 +01:00
Spacecash is now stackable and called 'Thalers'
This commit is contained in:
+103
-20
@@ -1,9 +1,9 @@
|
||||
/obj/item/weapon/spacecash
|
||||
name = "0 credit chip"
|
||||
desc = "It's worth 0 credits."
|
||||
name = "0 Thaler"
|
||||
desc = "It's worth 0 Thalers."
|
||||
gender = PLURAL
|
||||
icon = 'icons/obj/items.dmi'
|
||||
icon_state = "spacecash"
|
||||
icon_state = "spacecash1"
|
||||
opacity = 0
|
||||
density = 0
|
||||
anchored = 0.0
|
||||
@@ -16,52 +16,135 @@
|
||||
access = access_crate_cash
|
||||
var/worth = 0
|
||||
|
||||
/obj/item/weapon/spacecash/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/spacecash))
|
||||
if(istype(W, /obj/item/weapon/spacecash/ewallet)) return 0
|
||||
|
||||
var/obj/item/weapon/spacecash/bundle/bundle
|
||||
if(!istype(W, /obj/item/weapon/spacecash/bundle))
|
||||
var/obj/item/weapon/spacecash/cash = W
|
||||
user.drop_from_inventory(cash)
|
||||
bundle = new (src.loc)
|
||||
bundle.worth += cash.worth
|
||||
del(cash)
|
||||
else //is bundle
|
||||
bundle = W
|
||||
bundle.worth += src.worth
|
||||
bundle.update_icon()
|
||||
if (!istype(src.loc, /turf) && istype(user, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/h_user = user
|
||||
if(h_user.r_hand == src)
|
||||
h_user.drop_from_inventory(src)
|
||||
h_user.put_in_r_hand(bundle)
|
||||
else if(h_user.l_hand == src)
|
||||
h_user.drop_from_inventory(src)
|
||||
h_user.put_in_l_hand(bundle)
|
||||
else if (h_user.l_store == src)
|
||||
h_user.drop_from_inventory(src)
|
||||
bundle.loc = h_user
|
||||
bundle.layer = 20
|
||||
h_user.l_store = bundle
|
||||
h_user.update_inv_pockets()
|
||||
else if (h_user.r_store == src)
|
||||
h_user.drop_from_inventory(src)
|
||||
bundle.loc = h_user
|
||||
bundle.layer = 20
|
||||
h_user.r_store = bundle
|
||||
h_user.update_inv_pockets()
|
||||
else
|
||||
src.loc = get_turf(h_user)
|
||||
if(h_user.client) h_user.client.screen -= src
|
||||
h_user.put_in_hands(bundle)
|
||||
user << "<span class='notice'>You add [src.worth] Thalers worth of money to the bundles.<br>It holds [bundle.worth] Thalers now.</span>"
|
||||
del(src)
|
||||
|
||||
/obj/item/weapon/spacecash/bundle
|
||||
name = "bundles of thalers"
|
||||
icon_state = ""
|
||||
desc = "It's worth 0 Thalers."
|
||||
worth = 0
|
||||
|
||||
/obj/item/weapon/spacecash/bundle/update_icon()
|
||||
overlays.Cut()
|
||||
var/sum = src.worth
|
||||
for(var/i in list(1000,500,200,100,50,20,10,1))
|
||||
while(sum >= i)
|
||||
sum -= i
|
||||
var/image/banknote = image('icons/obj/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
|
||||
src.overlays += banknote
|
||||
src.desc = "They are worth [worth] Thalers."
|
||||
|
||||
/obj/item/weapon/spacecash/bundle/attack_self()
|
||||
var/amount = input(usr, "How many Thalers do you want to take? (0 to [src.worth])", "Take Money", 20) as num
|
||||
amount = round(Clamp(amount, 0, src.worth))
|
||||
if(amount==0) return 0
|
||||
|
||||
src.worth -= amount
|
||||
src.update_icon()
|
||||
if(!worth)
|
||||
usr.drop_from_inventory(src)
|
||||
if(amount in list(1000,500,200,100,50,20,1))
|
||||
var/cashtype = text2path("/obj/item/weapon/spacecash/c[amount]")
|
||||
var/obj/cash = new cashtype (usr.loc)
|
||||
usr.put_in_hands(cash)
|
||||
else
|
||||
var/obj/item/weapon/spacecash/bundle/bundle = new (usr.loc)
|
||||
bundle.worth = amount
|
||||
bundle.update_icon()
|
||||
usr.put_in_hands(bundle)
|
||||
if(!worth)
|
||||
del(src)
|
||||
|
||||
/obj/item/weapon/spacecash/c1
|
||||
name = "1 credit chip"
|
||||
icon_state = "spacecash"
|
||||
name = "1 Thaler"
|
||||
icon_state = "spacecash1"
|
||||
desc = "It's worth 1 credit."
|
||||
worth = 1
|
||||
|
||||
/obj/item/weapon/spacecash/c10
|
||||
name = "10 credit chip"
|
||||
name = "10 Thaler"
|
||||
icon_state = "spacecash10"
|
||||
desc = "It's worth 10 credits."
|
||||
desc = "It's worth 10 Thalers."
|
||||
worth = 10
|
||||
|
||||
/obj/item/weapon/spacecash/c20
|
||||
name = "20 credit chip"
|
||||
name = "20 Thaler"
|
||||
icon_state = "spacecash20"
|
||||
desc = "It's worth 20 credits."
|
||||
desc = "It's worth 20 Thalers."
|
||||
worth = 20
|
||||
|
||||
/obj/item/weapon/spacecash/c50
|
||||
name = "50 credit chip"
|
||||
name = "50 Thaler"
|
||||
icon_state = "spacecash50"
|
||||
desc = "It's worth 50 credits."
|
||||
desc = "It's worth 50 Thalers."
|
||||
worth = 50
|
||||
|
||||
/obj/item/weapon/spacecash/c100
|
||||
name = "100 credit chip"
|
||||
name = "100 Thaler"
|
||||
icon_state = "spacecash100"
|
||||
desc = "It's worth 100 credits."
|
||||
desc = "It's worth 100 Thalers."
|
||||
worth = 100
|
||||
|
||||
/obj/item/weapon/spacecash/c200
|
||||
name = "200 credit chip"
|
||||
name = "200 Thaler"
|
||||
icon_state = "spacecash200"
|
||||
desc = "It's worth 200 credits."
|
||||
desc = "It's worth 200 Thalers."
|
||||
worth = 200
|
||||
|
||||
/obj/item/weapon/spacecash/c500
|
||||
name = "500 credit chip"
|
||||
name = "500 Thaler"
|
||||
icon_state = "spacecash500"
|
||||
desc = "It's worth 500 credits."
|
||||
desc = "It's worth 500 Thalers."
|
||||
worth = 500
|
||||
|
||||
/obj/item/weapon/spacecash/c1000
|
||||
name = "1000 credit chip"
|
||||
name = "1000 Thaler"
|
||||
icon_state = "spacecash1000"
|
||||
desc = "It's worth 1000 credits."
|
||||
desc = "It's worth 1000 Thalers."
|
||||
worth = 1000
|
||||
|
||||
proc/spawn_money(var/sum, spawnloc)
|
||||
@@ -83,4 +166,4 @@ proc/spawn_money(var/sum, spawnloc)
|
||||
set src in view()
|
||||
..()
|
||||
if (!(usr in view(2)) && usr!=src.loc) return
|
||||
usr << "\blue Charge card's owner: [src.owner_name]. Credits remaining: [src.worth]."
|
||||
usr << "\blue Charge card's owner: [src.owner_name]. Thalers remaining: [src.worth]."
|
||||
Reference in New Issue
Block a user