mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com> Co-authored-by: Guti <32563288+TheCaramelion@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: CHOMPStation2 <chompsation2@gmail.com> Co-authored-by: Raeschen <rycoop29@gmail.com> Co-authored-by: Changelogs <action@github.com> Co-authored-by: Aroliacue <96730930+Aroliacue@users.noreply.github.com> Co-authored-by: Eli <fracshun@gmail.com> Co-authored-by: tacoguy7765093 <karokaromaro@gmail.com> Co-authored-by: Nadyr <41974248+Darlantanis@users.noreply.github.com> Co-authored-by: TheGreatKitsune <88862343+TheGreatKitsune@users.noreply.github.com> Co-authored-by: Missile597 <150307788+Missile597@users.noreply.github.com>
99 lines
3.1 KiB
Plaintext
99 lines
3.1 KiB
Plaintext
/*****************************Money bag********************************/
|
|
|
|
/obj/item/weapon/moneybag
|
|
icon = 'icons/obj/storage.dmi'
|
|
name = "Money bag"
|
|
icon_state = "moneybag"
|
|
force = 10.0
|
|
throwforce = 2.0
|
|
w_class = ITEMSIZE_LARGE
|
|
|
|
/obj/item/weapon/moneybag/attack_hand(user as mob)
|
|
var/amt_gold = 0
|
|
var/amt_silver = 0
|
|
var/amt_diamond = 0
|
|
var/amt_iron = 0
|
|
var/amt_phoron = 0
|
|
var/amt_uranium = 0
|
|
|
|
for (var/obj/item/weapon/coin/C in contents)
|
|
if (istype(C,/obj/item/weapon/coin/diamond))
|
|
amt_diamond++;
|
|
if (istype(C,/obj/item/weapon/coin/phoron))
|
|
amt_phoron++;
|
|
if (istype(C,/obj/item/weapon/coin/iron))
|
|
amt_iron++;
|
|
if (istype(C,/obj/item/weapon/coin/silver))
|
|
amt_silver++;
|
|
if (istype(C,/obj/item/weapon/coin/gold))
|
|
amt_gold++;
|
|
if (istype(C,/obj/item/weapon/coin/uranium))
|
|
amt_uranium++;
|
|
|
|
var/dat = text("<b>The contents of the moneybag reveal...</b><br>")
|
|
if (amt_gold)
|
|
dat += text("Gold coins: [amt_gold] <A href='?src=\ref[src];remove=gold'>Remove one</A><br>")
|
|
if (amt_silver)
|
|
dat += text("Silver coins: [amt_silver] <A href='?src=\ref[src];remove=silver'>Remove one</A><br>")
|
|
if (amt_iron)
|
|
dat += text("Metal coins: [amt_iron] <A href='?src=\ref[src];remove=iron'>Remove one</A><br>")
|
|
if (amt_diamond)
|
|
dat += text("Diamond coins: [amt_diamond] <A href='?src=\ref[src];remove=diamond'>Remove one</A><br>")
|
|
if (amt_phoron)
|
|
dat += text("Phoron coins: [amt_phoron] <A href='?src=\ref[src];remove=phoron'>Remove one</A><br>")
|
|
if (amt_uranium)
|
|
dat += text("Uranium coins: [amt_uranium] <A href='?src=\ref[src];remove=uranium'>Remove one</A><br>")
|
|
user << browse("[dat]", "window=moneybag")
|
|
|
|
/obj/item/weapon/moneybag/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|
..()
|
|
if (istype(W, /obj/item/weapon/coin))
|
|
var/obj/item/weapon/coin/C = W
|
|
to_chat(user, span_blue("You add the [C.name] into the bag."))
|
|
usr.drop_item()
|
|
contents += C
|
|
if (istype(W, /obj/item/weapon/moneybag))
|
|
var/obj/item/weapon/moneybag/C = W
|
|
for (var/obj/O in C.contents)
|
|
contents += O;
|
|
to_chat(user, span_blue("You empty the [C.name] into the bag."))
|
|
return
|
|
|
|
/obj/item/weapon/moneybag/Topic(href, href_list)
|
|
if(..())
|
|
return 1
|
|
usr.set_machine(src)
|
|
src.add_fingerprint(usr)
|
|
if(href_list["remove"])
|
|
var/obj/item/weapon/coin/COIN
|
|
switch(href_list["remove"])
|
|
if("gold")
|
|
COIN = locate(/obj/item/weapon/coin/gold,src.contents)
|
|
if("silver")
|
|
COIN = locate(/obj/item/weapon/coin/silver,src.contents)
|
|
if("iron")
|
|
COIN = locate(/obj/item/weapon/coin/iron,src.contents)
|
|
if("diamond")
|
|
COIN = locate(/obj/item/weapon/coin/diamond,src.contents)
|
|
if("phoron")
|
|
COIN = locate(/obj/item/weapon/coin/phoron,src.contents)
|
|
if("uranium")
|
|
COIN = locate(/obj/item/weapon/coin/uranium,src.contents)
|
|
if(!COIN)
|
|
return
|
|
COIN.loc = src.loc
|
|
return
|
|
|
|
|
|
|
|
/obj/item/weapon/moneybag/vault
|
|
|
|
/obj/item/weapon/moneybag/vault/New()
|
|
..()
|
|
new /obj/item/weapon/coin/silver(src)
|
|
new /obj/item/weapon/coin/silver(src)
|
|
new /obj/item/weapon/coin/silver(src)
|
|
new /obj/item/weapon/coin/silver(src)
|
|
new /obj/item/weapon/coin/gold(src)
|
|
new /obj/item/weapon/coin/gold(src)
|