Casino sentient prize item TF + Global item TF List (#18498)

* Adds item TF functionality to the casino sentient prize handler

* Adds more possible items, moves item selection to a global item TF list

* Formatting fixes

* Extremely minor formatting fix
This commit is contained in:
Ryumi
2025-10-14 06:48:41 -07:00
committed by GitHub
parent 57a221e8a7
commit 2d5701bba9
3 changed files with 142 additions and 0 deletions
+52
View File
@@ -581,6 +581,7 @@
to_chat(user, span_notice("Name: [selected_collar.sentientprizename]"))
to_chat(user, span_notice("Description: [selected_collar.sentientprizeflavor]"))
to_chat(user, span_notice("OOC: [selected_collar.sentientprizeooc]"))
to_chat(user, span_notice("Allows item prize TF: [selected_collar.sentientprizeitemtf ? "Yes (you may choose to turn your prize into an item when claiming!)" : "No"]"))
if(selected_collar.ownername != null)
to_chat(user, span_warning("This prize is already owned by [selected_collar.ownername]"))
@@ -601,6 +602,10 @@
var/confirm = tgui_alert(user, "Are you sure you want to become a sentient prize?", "Confirm Sentient Prize", list("Yes", "No"))
if(confirm != "Yes")
return
var/confirmitemtf = tgui_alert(user, "Would you like to allow others to turn you into an item upon claiming you if they choose to?", "Confirm Item TF Preference", list("Yes", "No"))
var/allowitemtf = FALSE
if(confirmitemtf != "No")
allowitemtf = TRUE
to_chat(user, span_warning("You are now a prize!"))
if(safety_ckey in sentientprizes_ckeys_list)
to_chat(user, span_warning("The SPASM beeps in an upset manner, you already have a collar!"))
@@ -611,6 +616,7 @@
C.sentientprizeckey = "[user.ckey]"
C.sentientprizeflavor = user.flavor_text
C.sentientprizeooc = user.ooc_notes
C.sentientprizeitemtf = allowitemtf
C.name = "Sentient Prize Collar: Available! [user.name] purchaseable at the SPASM!"
C.desc = "SPASM collar. The tags shows in flashy colorful text the wearer is [user.name] and is currently available to buy at the Sentient Prize Automated Sales Machinery!"
C.icon_state = "casinoslave_available"
@@ -719,6 +725,35 @@
if("Change Prize Value")
setprice(user)
/obj/machinery/casinosentientprize_handler/proc/do_item_tf(mob/living/sentient_prize, var/target_item_name)
var/item_type = GLOB.item_tf_options[target_item_name]
var/obj/item/newitem = new item_type(null) // Starts off in nullspace while we customize!
var/item_color = newitem.color
var/item_name = tgui_input_text(sentient_prize, "Choose your item name for \the [newitem] (Leave blank or cancel to use its default name)", "TF Item Name")
var/item_desc = tgui_input_text(sentient_prize, "Choose your item description for \the [newitem] (Leave blank or cancel to use its default description)", "TF Item Description")
var/choice_color = tgui_alert(sentient_prize, "Do you want to customize your item's color?", "Item TF Color", list("Yes", "No"))
if(choice_color == "Yes")
item_color = tgui_color_picker(sentient_prize, "Choose the color for \the [newitem].", "Item TF Color", newitem.color)
// Sanity check in case the item got garbage collected or something while customizing
if(!newitem)
newitem = new item_type(get_turf(sentient_prize))
// We apply the customization options afterward for the same reason as the sanity check.
if(LAZYLEN(item_name))
newitem.name = item_name
if(LAZYLEN(item_desc))
newitem.desc = item_desc
newitem.color = item_color
// Once that's all done, TF the prize up!
newitem.forceMove(get_turf(sentient_prize)) // This might be a bad idea, but if the prize is in something/someone it would be potentially diastrous to use loc. Better to move 'em out than move it in!
sentient_prize.tf_into(newitem, TRUE, item_name)
return newitem
/obj/machinery/casinosentientprize_handler/proc/insert_chip(var/obj/item/spacecasinocash/cashmoney, mob/user, var/buystate)
if(cashmoney.worth < casinosentientprize_price)
to_chat(user,span_notice("You dont have enough chips to pay for the sentient prize!"))
@@ -745,6 +780,23 @@
if(buystate == "buy")
to_chat(user,span_notice("You put [casinosentientprize_price] credits worth of chips into the SPASM and it pings to inform you bought [selected_collar.sentientprizename]!"))
// If the sentient prize opted in to be TF'd into an item....
if(selected_collar.sentientprizeitemtf)
// ... prompt the buyer asking if they want to do that!
var/confirm_item_tf_claim = tgui_alert(user, "This prize has opted in to being transformed into an item! Would you like to claim your prize as an item?", "Confirm Prize Item Transformation", list("Yes", "No"))
if(confirm_item_tf_claim == "Yes")
// Show the claimer a list of options to turn their prize into.
var/item_choice = tgui_input_list(user, "Choose the item to claim your prize as. (Cancelling will default you to claiming your prize without transformation!)", "Choose Sentient Prize Item", GLOB.item_tf_options)
if(LAZYLEN(item_choice))
var/mob/living/sentient_prize = selected_collar.wearer.resolve()
if(sentient_prize)
do_item_tf(selected_collar.wearer, item_choice)
else
log_runtime(EXCEPTION("Casino sentient prize collar \"[selected_collar]\" didn't have a living mob as its wearer and couldn't item TF!"))
to_chat(user,span_warning("\The [src] couldn't transform your prize due to the prize's collar not being able to resolve its wearer as a living mob. Contact a coder."))
to_chat(user,span_infoplain("Falling back to claiming your prize as normal. An admin can help transform your prize!"))
else
to_chat(user,span_notice("You decided to claim your prize without transformation."))
selected_collar.icon_state = "casinoslave_owned"
selected_collar.update_icon()
selected_collar.ownername = user.name
@@ -628,6 +628,7 @@
var/sentientprizeckey = null //Ckey for system to check who is the person and ensure no abuse of system or errors
var/sentientprizeflavor = null //Description to show on the SPASM
var/sentientprizeooc = null //OOC text to show on the SPASM
var/sentientprizeitemtf = FALSE //Whether the person opted in to allowing themselves to be item TF'd as a prize
/obj/item/clothing/accessory/collar/casinosentientprize/attack_self(mob/user as mob)
//keeping it blank so people don't tag and reset collar status