diff --git a/code/datums/cargoprofile.dm b/code/datums/cargoprofile.dm index e0cdba221d7..32d0cf63b1b 100644 --- a/code/datums/cargoprofile.dm +++ b/code/datums/cargoprofile.dm @@ -101,7 +101,7 @@ name = "Move Small Containers" id = "boxes" blacklist = null - whitelist = list(/obj/item/storage, /obj/item/moneybag, /obj/item/evidencebag, + whitelist = list(/obj/item/storage, /obj/item/storage/bag/money, /obj/item/evidencebag, /obj/item/storage/bag/tray, /obj/item/pizzabox, /obj/item/clipboard, /obj/item/smallDelivery, /obj/structure/bigDelivery) diff --git a/code/game/machinery/slotmachine.dm b/code/game/machinery/slotmachine.dm index 3655b22e29d..72fd23dde66 100644 --- a/code/game/machinery/slotmachine.dm +++ b/code/game/machinery/slotmachine.dm @@ -1,7 +1,7 @@ /obj/machinery/slot_machine name = "slot machine" desc = "Gambling for the antisocial." - icon = 'icons/obj/objects.dmi' + icon = 'icons/obj/economy.dmi' icon_state = "slots-off" anchored = 1 density = 1 diff --git a/code/modules/mining/coins.dm b/code/modules/mining/coins.dm index 8303326fc3e..9f4f7629c7e 100644 --- a/code/modules/mining/coins.dm +++ b/code/modules/mining/coins.dm @@ -1,7 +1,7 @@ /*****************************Coin********************************/ /obj/item/coin - icon = 'icons/obj/items.dmi' + icon = 'icons/obj/economy.dmi' name = "coin" icon_state = "coin__heads" flags = CONDUCT diff --git a/code/modules/mining/mint.dm b/code/modules/mining/mint.dm index 6c6e432ad55..794f7542252 100644 --- a/code/modules/mining/mint.dm +++ b/code/modules/mining/mint.dm @@ -2,208 +2,103 @@ /obj/machinery/mineral/mint - name = "Coin press" - icon = 'icons/obj/stationobjs.dmi' + name = "coin press" + icon = 'icons/obj/economy.dmi' icon_state = "coinpress0" - density = 1 - anchored = 1.0 - var/amt_silver = 0 //amount of silver - var/amt_gold = 0 //amount of gold - var/amt_diamond = 0 - var/amt_iron = 0 - var/amt_plasma = 0 - var/amt_uranium = 0 - var/amt_clown = 0 - var/amt_mime = 0 + density = TRUE + anchored = TRUE var/newCoins = 0 //how many coins the machine made in it's last load - var/processing = 0 - var/chosen = "metal" //which material will be used to make coins + var/processing = FALSE + var/chosen = MAT_METAL //which material will be used to make coins var/coinsToProduce = 10 - speed_process = 1 + speed_process = TRUE + + +/obj/machinery/mineral/mint/New() + ..() + AddComponent(/datum/component/material_container, list(MAT_METAL, MAT_PLASMA, MAT_SILVER, MAT_GOLD, MAT_URANIUM, MAT_DIAMOND, MAT_BANANIUM, MAT_TRANQUILLITE), MINERAL_MATERIAL_AMOUNT * 50) /obj/machinery/mineral/mint/process() - var/turf/T = get_step(src,input_dir) - if(T) - for(var/obj/item/stack/sheet/O in T) - if(istype(O, /obj/item/stack/sheet/mineral/gold)) - amt_gold += 100 * O.amount - qdel(O) - if(istype(O, /obj/item/stack/sheet/mineral/silver)) - amt_silver += 100 * O.amount - qdel(O) - if(istype(O, /obj/item/stack/sheet/mineral/diamond)) - amt_diamond += 100 * O.amount - qdel(O) - if(istype(O, /obj/item/stack/sheet/mineral/plasma)) - amt_plasma += 100 * O.amount - qdel(O) - if(istype(O, /obj/item/stack/sheet/mineral/uranium)) - amt_uranium += 100 * O.amount - qdel(O) - if(istype(O, /obj/item/stack/sheet/metal)) - amt_iron += 100 * O.amount - qdel(O) - if(istype(O, /obj/item/stack/sheet/mineral/bananium)) - amt_clown += 100 * O.amount - qdel(O) - if(istype(O, /obj/item/stack/sheet/mineral/tranquillite)) - amt_mime += 100 * O.amount - qdel(O) + var/turf/T = get_step(src, input_dir) + if(!T) + return + GET_COMPONENT(materials, /datum/component/material_container) + for(var/obj/item/stack/sheet/O in T) + materials.insert_stack(O, O.amount) -/obj/machinery/mineral/mint/attack_hand(user as mob) - +/obj/machinery/mineral/mint/attack_hand(mob/user) + if(..()) + return var/dat = "Coin Press
" - dat += text("
Gold inserted: [amt_gold] ") - if(chosen == "gold") - dat += text("chosen") - else - dat += text("Choose") - dat += text("
Silver inserted: [amt_silver] ") - if(chosen == "silver") - dat += text("chosen") - else - dat += text("Choose") - dat += text("
Iron inserted: [amt_iron] ") - if(chosen == "metal") - dat += text("chosen") - else - dat += text("Choose") - dat += text("
Diamond inserted: [amt_diamond] ") - if(chosen == "diamond") - dat += text("chosen") - else - dat += text("Choose") - dat += text("
Plasma inserted: [amt_plasma] ") - if(chosen == "plasma") - dat += text("chosen") - else - dat += text("Choose") - dat += text("
Uranium inserted: [amt_uranium] ") - if(chosen == "uranium") - dat += text("chosen") - else - dat += text("Choose") - if(amt_clown > 0) - dat += text("
Bananium inserted: [amt_clown] ") - if(chosen == "clown") - dat += text("chosen") + GET_COMPONENT(materials, /datum/component/material_container) + for(var/mat_id in materials.materials) + var/datum/material/M = materials.materials[mat_id] + if(!M.amount && chosen != mat_id) + continue + dat += "
[M.name] amount: [M.amount] cm3 " + if(chosen == mat_id) + dat += "Chosen" else - dat += text("Choose") - if(amt_mime > 0) - dat += text("
Tranquillite inserted: [amt_mime] ") - if(chosen == "mime") - dat += text("chosen") - else - dat += text("Choose") + dat += "Choose" - dat += text("

Will produce [coinsToProduce] [chosen] coins if enough materials are available.
") - //dat += text("The dial which controls the number of conins to produce seems to be stuck. A technician has already been dispatched to fix this.") - dat += text("-10 ") - dat += text("-5 ") - dat += text("-1 ") - dat += text("+1 ") - dat += text("+5 ") - dat += text("+10 ") + var/datum/material/M = materials.materials[chosen] - dat += text("

In total this machine produced [newCoins] coins.") - dat += text("
Make coins") - user << browse("[dat]", "window=mint") + dat += "

Will produce [coinsToProduce] [lowertext(M.name)] coins if enough materials are available.
" + dat += "-10 " + dat += "-5 " + dat += "-1 " + dat += "+1 " + dat += "+5 " + dat += "+10 " + + dat += "

In total this machine produced [newCoins] coins." + dat += "
Make coins" + user << browse(dat, "window=mint") /obj/machinery/mineral/mint/Topic(href, href_list) if(..()) return usr.set_machine(src) - src.add_fingerprint(usr) - if(processing==1) + add_fingerprint(usr) + if(processing == 1) to_chat(usr, "The machine is processing.") return + GET_COMPONENT(materials, /datum/component/material_container) if(href_list["choose"]) - chosen = href_list["choose"] + if(materials.materials[href_list["choose"]]) + chosen = href_list["choose"] if(href_list["chooseAmt"]) coinsToProduce = Clamp(coinsToProduce + text2num(href_list["chooseAmt"]), 0, 1000) if(href_list["makeCoins"]) var/temp_coins = coinsToProduce - processing = 1; + processing = TRUE icon_state = "coinpress1" - switch(chosen) - if("metal") - while(amt_iron > 0 && coinsToProduce > 0) - create_coins(/obj/item/coin/iron) - amt_iron -= 20 - coinsToProduce-- - newCoins++ - src.updateUsrDialog() - sleep(5) - if("gold") - while(amt_gold > 0 && coinsToProduce > 0) - create_coins(/obj/item/coin/gold) - amt_gold -= 20 - coinsToProduce-- - newCoins++ - src.updateUsrDialog() - sleep(5) - if("silver") - while(amt_silver > 0 && coinsToProduce > 0) - create_coins(/obj/item/coin/silver) - amt_silver -= 20 - coinsToProduce-- - newCoins++ - src.updateUsrDialog() - sleep(5) - if("diamond") - while(amt_diamond > 0 && coinsToProduce > 0) - create_coins(/obj/item/coin/diamond) - amt_diamond -= 20 - coinsToProduce-- - newCoins++ - src.updateUsrDialog() - sleep(5) - if("plasma") - while(amt_plasma > 0 && coinsToProduce > 0) - create_coins(/obj/item/coin/plasma) - amt_plasma -= 20 - coinsToProduce-- - newCoins++ - src.updateUsrDialog() - sleep(5) - if("uranium") - while(amt_uranium > 0 && coinsToProduce > 0) - create_coins(/obj/item/coin/uranium) - amt_uranium -= 20 - coinsToProduce-- - newCoins++ - src.updateUsrDialog() - sleep(5) - if("clown") - while(amt_clown > 0 && coinsToProduce > 0) - create_coins(/obj/item/coin/clown) - amt_clown -= 20 - coinsToProduce-- - newCoins++ - src.updateUsrDialog() - sleep(5) - if("mime") - while(amt_mime > 0 && coinsToProduce > 0) - create_coins(/obj/item/coin/mime) - amt_mime -= 20 - coinsToProduce-- - newCoins++ - src.updateUsrDialog() - sleep(5) - icon_state = "coinpress0" - processing = 0 - coinsToProduce = temp_coins - src.updateUsrDialog() - return + var/coin_mat = MINERAL_MATERIAL_AMOUNT * 0.2 + var/datum/material/M = materials.materials[chosen] + if(!M || !M.coin_type) + updateUsrDialog() + return -/obj/machinery/mineral/mint/proc/create_coins(var/P) + while(coinsToProduce > 0 && materials.use_amount_type(coin_mat, chosen)) + create_coins(M.coin_type) + coinsToProduce-- + newCoins++ + updateUsrDialog() + sleep(5) + + icon_state = "coinpress0" + processing = FALSE + coinsToProduce = temp_coins + updateUsrDialog() + +/obj/machinery/mineral/mint/proc/create_coins(P) var/turf/T = get_step(src,output_dir) if(T) var/obj/item/O = new P(src) - var/obj/item/moneybag/M = locate(/obj/item/moneybag/, T) + var/obj/item/storage/bag/money/M = locate(/obj/item/storage/bag/money, T) if(!M) - M = new /obj/item/moneybag(src) + M = new /obj/item/storage/bag/money(src) unload_mineral(M) - O.loc = M + O.forceMove(M) \ No newline at end of file diff --git a/code/modules/mining/money_bag.dm b/code/modules/mining/money_bag.dm index f4282f75cf8..80f4c894ead 100644 --- a/code/modules/mining/money_bag.dm +++ b/code/modules/mining/money_bag.dm @@ -1,117 +1,19 @@ /*****************************Money bag********************************/ -/obj/item/moneybag - icon = 'icons/obj/storage.dmi' - name = "Money bag" +/obj/item/storage/bag/money + name = "money bag" icon_state = "moneybag" - flags = CONDUCT - force = 10.0 + force = 10 throwforce = 0 burn_state = FLAMMABLE - burntime = 20 + max_integrity = 100 w_class = WEIGHT_CLASS_BULKY + max_w_class = WEIGHT_CLASS_NORMAL + storage_slots = 40 + max_combined_w_class = 40 + can_hold = list(/obj/item/coin, /obj/item/stack/spacecash) -/obj/item/moneybag/attack_hand(user as mob) - var/amt_gold = 0 - var/amt_silver = 0 - var/amt_diamond = 0 - var/amt_iron = 0 - var/amt_plasma = 0 - var/amt_uranium = 0 - var/amt_clown = 0 - var/amt_mime = 0 - var/amt_adamantine = 0 - - for(var/obj/item/coin/C in contents) - if(istype(C,/obj/item/coin/diamond)) - amt_diamond++ - if(istype(C,/obj/item/coin/plasma)) - amt_plasma++ - if(istype(C,/obj/item/coin/iron)) - amt_iron++ - if(istype(C,/obj/item/coin/silver)) - amt_silver++ - if(istype(C,/obj/item/coin/gold)) - amt_gold++ - if(istype(C,/obj/item/coin/uranium)) - amt_uranium++ - if(istype(C,/obj/item/coin/clown)) - amt_clown++ - if(istype(C,/obj/item/coin/mime)) - amt_mime++ - if(istype(C,/obj/item/coin/adamantine)) - amt_adamantine++ - - var/dat = text("The contents of the moneybag reveal...
") - if(amt_gold) - dat += text("Gold coins: [amt_gold] Remove one
") - if(amt_silver) - dat += text("Silver coins: [amt_silver] Remove one
") - if(amt_iron) - dat += text("Metal coins: [amt_iron] Remove one
") - if(amt_diamond) - dat += text("Diamond coins: [amt_diamond] Remove one
") - if(amt_plasma) - dat += text("Plasma coins: [amt_plasma] Remove one
") - if(amt_uranium) - dat += text("Uranium coins: [amt_uranium] Remove one
") - if(amt_clown) - dat += text("Bananium coins: [amt_clown] Remove one
") - if(amt_mime) - dat += text("Tranquillite coins: [amt_mime] Remove one
") - if(amt_adamantine) - dat += text("Adamantine coins: [amt_adamantine] Remove one
") - user << browse("[dat]", "window=moneybag") - -/obj/item/moneybag/attackby(obj/item/W as obj, mob/user as mob, params) - ..() - if(istype(W, /obj/item/coin)) - var/obj/item/coin/C = W - if(!user.drop_item()) - return - to_chat(user, "You add the [C.name] into the bag.") - contents += C - if(istype(W, /obj/item/moneybag)) - var/obj/item/moneybag/C = W - for(var/obj/O in C.contents) - contents += O; - to_chat(user, "You empty the [C.name] into the bag.") - return - -/obj/item/moneybag/Topic(href, href_list) - if(..()) - return - usr.set_machine(src) - src.add_fingerprint(usr) - if(href_list["remove"]) - var/obj/item/coin/COIN - switch(href_list["remove"]) - if("gold") - COIN = locate(/obj/item/coin/gold,src.contents) - if("silver") - COIN = locate(/obj/item/coin/silver,src.contents) - if("iron") - COIN = locate(/obj/item/coin/iron,src.contents) - if("diamond") - COIN = locate(/obj/item/coin/diamond,src.contents) - if("plasma") - COIN = locate(/obj/item/coin/plasma,src.contents) - if("uranium") - COIN = locate(/obj/item/coin/uranium,src.contents) - if("clown") - COIN = locate(/obj/item/coin/clown,src.contents) - if("mime") - COIN = locate(/obj/item/coin/mime,src.contents) - if("adamantine") - COIN = locate(/obj/item/coin/adamantine,src.contents) - if(!COIN) - return - COIN.loc = src.loc - return - -/obj/item/moneybag/vault - -/obj/item/moneybag/vault/New() +/obj/item/storage/bag/money/vault/New() ..() new /obj/item/coin/silver(src) new /obj/item/coin/silver(src) @@ -119,4 +21,4 @@ new /obj/item/coin/silver(src) new /obj/item/coin/gold(src) new /obj/item/coin/gold(src) - new /obj/item/coin/adamantine(src) + new /obj/item/coin/adamantine(src) \ No newline at end of file diff --git a/icons/obj/economy.dmi b/icons/obj/economy.dmi new file mode 100644 index 00000000000..4afae1bf129 Binary files /dev/null and b/icons/obj/economy.dmi differ diff --git a/icons/obj/items.dmi b/icons/obj/items.dmi index 3b74a46655b..d828f2ee9de 100644 Binary files a/icons/obj/items.dmi and b/icons/obj/items.dmi differ diff --git a/icons/obj/objects.dmi b/icons/obj/objects.dmi index cb42505cef8..900d3227793 100644 Binary files a/icons/obj/objects.dmi and b/icons/obj/objects.dmi differ diff --git a/icons/obj/stationobjs.dmi b/icons/obj/stationobjs.dmi index 0e54aaf5292..5346710e07b 100755 Binary files a/icons/obj/stationobjs.dmi and b/icons/obj/stationobjs.dmi differ