Files
Aurora.3/code/modules/mining/coins.dm
Ben 6ca59823ed Vending Machine Launch Fix (#20215)
Fixes https://github.com/Aurorastation/Aurora.3/issues/20201

Fixes runtime in SSThrowing by having non-mobs default to targeting
chest
Refactors vendor reply code to be similar to how it handles ads and
slogans
Fixes interaction involving using a string to get the coin back from
vending machine

---------

Signed-off-by: Ben <91219575+Ben10083@users.noreply.github.com>
Co-authored-by: Ben10083 <Ben10083@users.noreply.github.com>
Co-authored-by: Fluffy <65877598+FluffyGhoster@users.noreply.github.com>
Co-authored-by: Wowzewow (Wezzy) <42310821+alsoandanswer@users.noreply.github.com>
2024-12-28 18:22:42 +00:00

116 lines
3.1 KiB
Plaintext

/*****************************Coin********************************/
/obj/item/coin
icon = 'icons/obj/coins.dmi'
name = "coin"
icon_state = "coin__heads"
randpixel = 8
desc = "A flat disc or piece of metal with an official stamp. An archaic type of currency."
obj_flags = OBJ_FLAG_CONDUCTABLE
force = 0
throwforce = 0.0
w_class = WEIGHT_CLASS_TINY
slot_flags = SLOT_EARS
drop_sound = 'sound/items/drop/ring.ogg'
pickup_sound = 'sound/items/pickup/ring.ogg'
var/string_attached = FALSE
var/sides = 2
var/cmineral = null
var/last_flip = 0 //Spam limiter
/obj/item/coin/Initialize(mapload)
. = ..()
randpixel_xy()
/obj/item/coin/gold
name = "gold coin"
icon_state = "coin_gold_heads"
cmineral = "gold"
/obj/item/coin/silver
name = "silver coin"
icon_state = "coin_silver_heads"
cmineral = "silver"
/obj/item/coin/diamond
name = "diamond coin"
icon_state = "coin_diamond_heads"
cmineral = "diamond"
/obj/item/coin/iron
name = "iron coin"
icon_state = "coin_iron_heads"
cmineral = "iron"
/obj/item/coin/phoron
name = "solid phoron coin"
icon_state = "coin_phoron_heads"
cmineral = "phoron"
/obj/item/coin/uranium
name = "uranium coin"
icon_state = "coin_uranium_heads"
cmineral = "uranium"
/obj/item/coin/platinum
name = "platinum coin"
icon_state = "coin_platinum_heads"
cmineral = "platinum"
/obj/item/coin/platinum
name = "mythril coin"
icon_state = "coin_mythril_heads"
cmineral = "mythril"
/obj/item/coin/battlemonsters
name = "battlemonsters coin"
icon_state = "coin_battlemonsters_heads"
cmineral = "battlemonsters"
/obj/item/coin/mining
name = "mining coin"
desc = "A flat disc or piece of metal with an official stamp. This coin can be used at a mining vendor to gain access to additional equipment."
icon_state = "coin_mining_heads"
cmineral = "mining"
/obj/item/coin/attackby(obj/item/attacking_item, mob/user)
if(attacking_item.iscoil())
var/obj/item/stack/cable_coil/CC = attacking_item
if(string_attached)
to_chat(user, SPAN_NOTICE("There already is a string attached to this coin."))
return
if(CC.use(1))
AddOverlays("coin_string_overlay")
string_attached = TRUE
to_chat(user, SPAN_NOTICE("You attach a string to the coin."))
else
to_chat(user, SPAN_NOTICE("This cable coil appears to be empty."))
return
else if(attacking_item.iswirecutter())
if(!string_attached)
..()
return
var/obj/item/stack/cable_coil/CC = new /obj/item/stack/cable_coil(get_turf(user))
CC.amount = 1
CC.update_icon()
ClearOverlays()
string_attached = FALSE
to_chat(user, SPAN_NOTICE("You detach the string from the coin."))
else ..()
/obj/item/coin/attack_self(mob/user)
if(last_flip <= world.time - 20)
last_flip = world.time
var/result = rand(1, sides)
var/comment = ""
if(result == 1)
comment = "tails"
else if(result == 2)
comment = "heads"
flick("coin_[cmineral]_flip", src)
icon_state = "coin_[cmineral]_[comment]"
playsound(get_turf(src), 'sound/items/coinflip.ogg', 100, 1, -4)
user.visible_message(SPAN_NOTICE("\The [user] throws \the [src]. It lands on [comment]!"), \
SPAN_NOTICE("You throw \the [src]. It lands on [comment]!"))