mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-28 23:59:40 +01:00
Co-authored-by: Will <7099514+Willburd@users.noreply.github.com> Co-authored-by: Cameron Lennox <killer65311@gmail.com>
51 lines
2.0 KiB
Plaintext
51 lines
2.0 KiB
Plaintext
/**********************Mint**************************/
|
|
/obj/machinery/mineral/mint
|
|
name = "coin press"
|
|
desc = "A relatively crude hand-operated coin press that turns sheets (or ingots, as the case may be) of materials into fresh coins. They're <i>probably</i> not going to be considered legal tender in most polities, but you might fool a vending machine with one..?"
|
|
icon = 'icons/obj/stationobjs.dmi'
|
|
icon_state = "coinpress0"
|
|
density = TRUE
|
|
anchored = TRUE
|
|
circuit = /obj/item/circuitboard/mat_mint
|
|
var/coinsToProduce = 6 //how many coins do we make per sheet? a sheet is 2000 units whilst a coin is 250, and some material should be lost in the process
|
|
|
|
/obj/machinery/mineral/mint/Initialize(mapload)
|
|
. = ..()
|
|
default_apply_parts()
|
|
|
|
/obj/machinery/mineral/mint/attackby(obj/item/I, mob/user)
|
|
if(default_deconstruction_screwdriver(user, I))
|
|
return
|
|
if(default_deconstruction_crowbar(user, I))
|
|
return
|
|
if(default_part_replacement(user, I))
|
|
return
|
|
if(!anchored)
|
|
user.visible_message(span_warning("\The [src] must be properly secured to operate!"))
|
|
return
|
|
if(!istype(I, /obj/item/stack/material))
|
|
return
|
|
var/obj/item/stack/material/M = I
|
|
if(!M.coin_type)
|
|
user.visible_message(span_notice("You can't make coins out of that."))
|
|
return
|
|
if(M.coin_type)
|
|
user.visible_message("[user] starts to feed a sheet of [M.default_type] into \the [src].")
|
|
while(M.amount > 0)
|
|
icon_state = "coinpress1"
|
|
if(do_after(user, 2 SECONDS, target = src))
|
|
M.amount--
|
|
while(coinsToProduce-- > 0)
|
|
new M.coin_type(user.loc)
|
|
src.visible_message(span_notice("\The [src] rattles and dispenses several [M.default_type] coins!"))
|
|
coinsToProduce = initial(coinsToProduce)
|
|
if(M.amount == 0)
|
|
icon_state = "coinpress0"
|
|
qdel(M) //clean it up just to be sure
|
|
src.visible_message(span_notice("\The [src] has run out of usable materials."))
|
|
break
|
|
else
|
|
to_chat(user,span_warning("\The [src] is hand-operated and requires your full attention!"))
|
|
icon_state = "coinpress0"
|
|
break
|