Adds wallets to loadout menu

This commit is contained in:
Hubblenaut
2016-03-18 13:07:38 +01:00
parent e8d65eb901
commit 5c1e5a89e6
3 changed files with 39 additions and 33 deletions

View File

@@ -73,18 +73,16 @@
else else
return ..() return ..()
/obj/item/weapon/storage/wallet/random/New() /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/amount = rand(50, 100) + rand(50, 100) // Triangular distribution from 100 to 200
var/item2_type var/obj/item/weapon/spacecash/SC = null
if(prob(50)) for(var/i in list(100, 50, 20, 10, 5, 1))
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) if(amount < i)
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 ) continue
SC = new(src)
spawn(2) while(amount >= i)
if(item1_type) amount -= i
new item1_type(src) SC.adjust_worth(i, 0)
if(item2_type) SC.update_icon()
new item2_type(src)
if(item3_type)
new item3_type(src)

View File

@@ -28,6 +28,10 @@
display_name = "armband, science" display_name = "armband, science"
path = /obj/item/clothing/accessory/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 /datum/gear/accessory/holster
display_name = "holster, armpit" display_name = "holster, armpit"
path = /obj/item/clothing/accessory/holster/armpit path = /obj/item/clothing/accessory/holster/armpit

View File

@@ -21,8 +21,7 @@
if(istype(W, /obj/item/weapon/spacecash/ewallet)) return 0 if(istype(W, /obj/item/weapon/spacecash/ewallet)) return 0
var/obj/item/weapon/spacecash/SC = W var/obj/item/weapon/spacecash/SC = W
SC.worth += src.worth SC.adjust_worth(src.worth)
SC.update_icon()
if(istype(user, /mob/living/carbon/human)) if(istype(user, /mob/living/carbon/human))
var/mob/living/carbon/human/h_user = user var/mob/living/carbon/human/h_user = user
h_user.drop_from_inventory(src) h_user.drop_from_inventory(src)
@@ -59,26 +58,32 @@
src.overlays += banknote src.overlays += banknote
src.desc = "They are worth [worth] Thalers." 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() /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 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)) amount = round(Clamp(amount, 0, src.worth))
if(amount==0) return 0 if(!amount)
return
src.worth -= amount adjust_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) var/obj/item/weapon/spacecash/SC = new (usr.loc)
SC.worth = amount SC.set_worth(amount)
SC.update_icon()
usr.put_in_hands(SC) usr.put_in_hands(SC)
if(!worth)
qdel(src)
/obj/item/weapon/spacecash/c1 /obj/item/weapon/spacecash/c1
name = "1 Thaler" name = "1 Thaler"
@@ -130,8 +135,7 @@
proc/spawn_money(var/sum, spawnloc, mob/living/carbon/human/human_user as mob) proc/spawn_money(var/sum, spawnloc, mob/living/carbon/human/human_user as mob)
var/obj/item/weapon/spacecash/SC = new (spawnloc) var/obj/item/weapon/spacecash/SC = new (spawnloc)
SC.worth = sum SC.set_worth(sum)
SC.update_icon()
if (ishuman(human_user) && !human_user.get_active_hand()) if (ishuman(human_user) && !human_user.get_active_hand())
human_user.put_in_hands(SC) human_user.put_in_hands(SC)
return return