Merge pull request #14358 from faaaay/loaded-dice

Adds loaded dice + a custom item
This commit is contained in:
Heroman3003
2023-01-22 11:35:53 +10:00
committed by GitHub
5 changed files with 66 additions and 2 deletions
@@ -1463,6 +1463,12 @@
ckeywhitelist = list("yecrowbarman")
character_name = list("Lemon Yellow", "Lemon Gettler Yellow", "Lemon Lee Yellow", "Lemon Jade Yellow") //different sleeves, same char
/datum/gear/fluff/cephyra_d6
path = /obj/item/weapon/dice/loaded/ceph
display_name = "engraved d6"
ckeywhitelist = list("yeehawguvnah")
character_name = list("Cephyra")
// Z CKEYS
/datum/gear/fluff/tachika_medal
path = /obj/item/clothing/accessory/medal/conduct
+2 -1
View File
@@ -1165,7 +1165,8 @@
/obj/item/weapon/deck/schnapsen = 100,
/obj/item/weapon/deck/egy = 100)
premium = list(/obj/item/toy/bosunwhistle = 1)
contraband = list(/obj/item/toy/katana = 1)
contraband = list(/obj/item/toy/katana = 1,
/obj/item/weapon/dice/loaded = 5)
/obj/machinery/vending/loadout/overwear
name = "Big D's Best"
+44 -1
View File
@@ -6,11 +6,48 @@
w_class = ITEMSIZE_TINY
var/sides = 6
var/result = 6
var/loaded = null //Set to an integer when the die is loaded
var/cheater = FALSE //TRUE if the die is able to be weighted by hand
var/tamper_proof = FALSE //Set to TRUE if the die needs to be unable to be weighted, such as for events
attack_verb = list("diced")
/obj/item/weapon/dice/New()
icon_state = "[name][rand(1,sides)]"
/obj/item/weapon/dice/attackby(obj/item/weapon/W, mob/user)
..()
if(istype(W, /obj/item/weapon/weldingtool) || istype(W, /obj/item/weapon/flame/lighter))
if(cheater)
to_chat(user, "<span class='warning'>Wait, this [name] is already weighted!</span>")
else if(tamper_proof)
to_chat(user, "<span class='warning'>This [name] is proofed against tampering!</span>")
else
var/to_weight = input("What should the [name] be weighted towards? You can't undo this later, only change the number!","Set the desired result") as null|num
if(isnull(to_weight) || (to_weight < 1) || (to_weight > sides)) //You must input a number higher than 0 and no greater than the number of sides
return 0
else
to_chat(user, "You partially melt the [name], weighting it towards [to_weight]...")
desc = "[initial(desc)] It looks a little misshapen, somehow..."
loaded = to_weight
/obj/item/weapon/dice/AltClick(mob/user)
..()
if(cheater)
if(!loaded)
var/to_weight = input("What should the [name] be weighted towards?","Set the desired result") as null|num
if(isnull(to_weight) || (to_weight < 1) || (to_weight > sides) ) //You must input a number higher than 0 and no greater than the number of sides
return 0
else
to_chat(user, "You sneakily set the [name] to land on [to_weight]...")
loaded = to_weight
else
to_chat(user, "You set the [name] to roll randomly again.")
loaded = null
/obj/item/weapon/dice/loaded
description_info = "This is a loaded die! To change the number it's weighted to, alt-click it. To put it back to normal, alt-click it again."
cheater = TRUE
/obj/item/weapon/dice/d4
name = "d4"
desc = "A dice with four sides."
@@ -58,6 +95,12 @@
/obj/item/weapon/dice/proc/rollDice(mob/user as mob, var/silent = 0)
result = rand(1, sides)
if(loaded)
if(cheater)
if(prob(90))
result = loaded
else if(prob(75)) //makeshift weighted dice don't always work
result = loaded
icon_state = "[name][result]"
if(!silent)
@@ -158,4 +201,4 @@
/obj/item/weapon/storage/dicecup/loaded/New()
..()
for(var/i = 1 to 5)
new /obj/item/weapon/dice( src )
new /obj/item/weapon/dice( src )
@@ -1556,3 +1556,17 @@
playsound(src, 'sound/items/drop/plushie.ogg', 25, 0)
visible_message("[src] says, \"[pokephrase]\"")
last_message = world.time
//Yeehawguvnah - Cephyra
/obj/item/weapon/dice/loaded/ceph
name = "engraved d6"
desc = "A die with six sides. It's fairly well-made, made of an unclear black material with silver pips. If you were to touch it, your hands tingle slightly as though from static. On closer inspection, it's finely engraved with curving, fractal patterns."
icon_state = "ceph_d66"
/obj/item/weapon/dice/loaded/ceph/rollDice(mob/user, silent)
..()
icon_state = "ceph_d6[result]"
/obj/item/weapon/dice/loaded/ceph/New()
icon_state = "ceph_d6[rand(1,sides)]"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB