mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Merge pull request #1206 from Hubblenaut/master
Adds wallets to loadout menu
This commit is contained in:
@@ -73,18 +73,16 @@
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/item/weapon/storage/wallet/random/New()
|
||||
..()
|
||||
var/item1_type = pick( /obj/item/weapon/spacecash/c10,/obj/item/weapon/spacecash/c100,/obj/item/weapon/spacecash/c1000,/obj/item/weapon/spacecash/c20,/obj/item/weapon/spacecash/c200,/obj/item/weapon/spacecash/c50, /obj/item/weapon/spacecash/c500)
|
||||
var/item2_type
|
||||
if(prob(50))
|
||||
item2_type = pick( /obj/item/weapon/spacecash/c10,/obj/item/weapon/spacecash/c100,/obj/item/weapon/spacecash/c1000,/obj/item/weapon/spacecash/c20,/obj/item/weapon/spacecash/c200,/obj/item/weapon/spacecash/c50, /obj/item/weapon/spacecash/c500)
|
||||
var/item3_type = pick( /obj/item/weapon/coin/silver, /obj/item/weapon/coin/silver, /obj/item/weapon/coin/gold, /obj/item/weapon/coin/iron, /obj/item/weapon/coin/iron, /obj/item/weapon/coin/iron )
|
||||
|
||||
spawn(2)
|
||||
if(item1_type)
|
||||
new item1_type(src)
|
||||
if(item2_type)
|
||||
new item2_type(src)
|
||||
if(item3_type)
|
||||
new item3_type(src)
|
||||
var/amount = rand(50, 100) + rand(50, 100) // Triangular distribution from 100 to 200
|
||||
var/obj/item/weapon/spacecash/SC = null
|
||||
for(var/i in list(100, 50, 20, 10, 5, 1))
|
||||
if(amount < i)
|
||||
continue
|
||||
SC = new(src)
|
||||
while(amount >= i)
|
||||
amount -= i
|
||||
SC.adjust_worth(i, 0)
|
||||
SC.update_icon()
|
||||
@@ -28,6 +28,10 @@
|
||||
display_name = "armband, science"
|
||||
path = /obj/item/clothing/accessory/armband/science
|
||||
|
||||
/datum/gear/accessory/wallet
|
||||
display_name = "wallet"
|
||||
path = /obj/item/weapon/storage/wallet/random
|
||||
|
||||
/datum/gear/accessory/holster
|
||||
display_name = "holster, armpit"
|
||||
path = /obj/item/clothing/accessory/holster/armpit
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
if(istype(W, /obj/item/weapon/spacecash/ewallet)) return 0
|
||||
|
||||
var/obj/item/weapon/spacecash/SC = W
|
||||
SC.worth += src.worth
|
||||
SC.update_icon()
|
||||
SC.adjust_worth(src.worth)
|
||||
if(istype(user, /mob/living/carbon/human))
|
||||
var/mob/living/carbon/human/h_user = user
|
||||
h_user.drop_from_inventory(src)
|
||||
@@ -59,26 +58,32 @@
|
||||
src.overlays += banknote
|
||||
src.desc = "They are worth [worth] Thalers."
|
||||
|
||||
/obj/item/weapon/spacecash/proc/adjust_worth(var/adjust_worth = 0, var/update = 1)
|
||||
worth += adjust_worth
|
||||
if(worth > 0)
|
||||
if(update)
|
||||
update_icon()
|
||||
return worth
|
||||
else
|
||||
qdel(src)
|
||||
return 0
|
||||
|
||||
/obj/item/weapon/spacecash/proc/set_worth(var/new_worth = 0, var/update = 1)
|
||||
worth = max(0, new_worth)
|
||||
if(update)
|
||||
update_icon()
|
||||
return worth
|
||||
|
||||
/obj/item/weapon/spacecash/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
|
||||
if(!amount)
|
||||
return
|
||||
|
||||
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/SC = new (usr.loc)
|
||||
SC.worth = amount
|
||||
SC.update_icon()
|
||||
usr.put_in_hands(SC)
|
||||
if(!worth)
|
||||
qdel(src)
|
||||
adjust_worth(-amount)
|
||||
var/obj/item/weapon/spacecash/SC = new (usr.loc)
|
||||
SC.set_worth(amount)
|
||||
usr.put_in_hands(SC)
|
||||
|
||||
/obj/item/weapon/spacecash/c1
|
||||
name = "1 Thaler"
|
||||
@@ -130,8 +135,7 @@
|
||||
|
||||
proc/spawn_money(var/sum, spawnloc, mob/living/carbon/human/human_user as mob)
|
||||
var/obj/item/weapon/spacecash/SC = new (spawnloc)
|
||||
SC.worth = sum
|
||||
SC.update_icon()
|
||||
SC.set_worth(sum)
|
||||
if (ishuman(human_user) && !human_user.get_active_hand())
|
||||
human_user.put_in_hands(SC)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user