mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-27 15:17:01 +01:00
Mining voucher redeem selection now uses a radial menu (#66421)
Mining voucher redeem selection is now using a radial menu when choosing a voucher rewards instead of an input menu. In addition to looking better, the menu now provides an additional information about specific reward set when a corresponding info button is clicked.
This commit is contained in:
@@ -159,7 +159,7 @@
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/attackby(obj/item/I, mob/user, params)
|
||||
if(istype(I, /obj/item/mining_voucher))
|
||||
RedeemVoucher(I, user)
|
||||
redeem_voucher(I, user)
|
||||
return
|
||||
if(default_deconstruction_screwdriver(user, "mining-open", "mining", I))
|
||||
return
|
||||
@@ -167,39 +167,57 @@
|
||||
return
|
||||
return ..()
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/proc/RedeemVoucher(obj/item/mining_voucher/voucher, mob/redeemer)
|
||||
var/items = list("Survival Capsule and Explorer's Webbing", "Resonator Kit", "Minebot Kit", "Extraction and Rescue Kit", "Crusher Kit", "Mining Conscription Kit")
|
||||
/**
|
||||
* Allows user to redeem a mining voucher for one set of a mining equipment
|
||||
*
|
||||
* * Arguments:
|
||||
* * voucher The mining voucher that is being used to redeem the mining equipment
|
||||
* * redeemer The mob that is redeeming the mining equipment
|
||||
*/
|
||||
/obj/machinery/mineral/equipment_vendor/proc/redeem_voucher(obj/item/mining_voucher/voucher, mob/redeemer)
|
||||
var/static/list/set_types
|
||||
if(!set_types)
|
||||
set_types = list()
|
||||
for(var/datum/voucher_set/static_set as anything in subtypesof(/datum/voucher_set))
|
||||
set_types[initial(static_set.name)] = new static_set
|
||||
|
||||
var/selection = tgui_input_list(redeemer, "Pick your equipment", "Mining Voucher Redemption", sort_list(items))
|
||||
if(isnull(selection))
|
||||
var/list/items = list()
|
||||
for(var/set_name in set_types)
|
||||
var/datum/voucher_set/current_set = set_types[set_name]
|
||||
var/datum/radial_menu_choice/option = new
|
||||
option.image = image(icon = current_set.icon, icon_state = current_set.icon_state)
|
||||
option.info = span_boldnotice(current_set.description)
|
||||
items[set_name] = option
|
||||
|
||||
var/selection = show_radial_menu(redeemer, src, items, custom_check = CALLBACK(src, .proc/check_menu, voucher, redeemer), radius = 38, require_near = TRUE, tooltips = TRUE)
|
||||
if(!selection)
|
||||
return
|
||||
if(!Adjacent(redeemer) || QDELETED(voucher) || voucher.loc != redeemer)
|
||||
return
|
||||
var/drop_location = drop_location()
|
||||
switch(selection)
|
||||
if("Survival Capsule and Explorer's Webbing")
|
||||
new /obj/item/storage/belt/mining/vendor(drop_location)
|
||||
if("Resonator Kit")
|
||||
new /obj/item/extinguisher/mini(drop_location)
|
||||
new /obj/item/resonator(drop_location)
|
||||
if("Minebot Kit")
|
||||
new /mob/living/simple_animal/hostile/mining_drone(drop_location)
|
||||
new /obj/item/weldingtool/hugetank(drop_location)
|
||||
new /obj/item/clothing/head/welding(drop_location)
|
||||
new /obj/item/borg/upgrade/modkit/minebot_passthrough(drop_location)
|
||||
if("Extraction and Rescue Kit")
|
||||
new /obj/item/extraction_pack(drop_location)
|
||||
new /obj/item/fulton_core(drop_location)
|
||||
new /obj/item/stack/marker_beacon/thirty(drop_location)
|
||||
if("Crusher Kit")
|
||||
new /obj/item/extinguisher/mini(drop_location)
|
||||
new /obj/item/kinetic_crusher(drop_location)
|
||||
if("Mining Conscription Kit")
|
||||
new /obj/item/storage/backpack/duffelbag/mining_conscript(drop_location)
|
||||
|
||||
var/datum/voucher_set/chosen_set = set_types[selection]
|
||||
for(var/item in chosen_set.set_items)
|
||||
new item(drop_location())
|
||||
|
||||
SSblackbox.record_feedback("tally", "mining_voucher_redeemed", 1, selection)
|
||||
qdel(voucher)
|
||||
|
||||
/**
|
||||
* Checks if we are allowed to interact with a radial menu
|
||||
*
|
||||
* * Arguments:
|
||||
* * voucher The mining voucher that is being used to redeem a mining equipment
|
||||
* * redeemer The living mob interacting with the menu
|
||||
*/
|
||||
/obj/machinery/mineral/equipment_vendor/proc/check_menu(obj/item/mining_voucher/voucher, mob/living/redeemer)
|
||||
if(!istype(redeemer))
|
||||
return FALSE
|
||||
if(redeemer.incapacitated())
|
||||
return FALSE
|
||||
if(QDELETED(voucher))
|
||||
return FALSE
|
||||
if(!redeemer.is_holding(voucher))
|
||||
return FALSE
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/mineral/equipment_vendor/ex_act(severity, target)
|
||||
do_sparks(5, TRUE, src)
|
||||
if(severity > EXPLODE_LIGHT && prob(17 * severity))
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* # Voucher Set
|
||||
*
|
||||
* A set consisting of a various equipment that can be then used as a reward for redeeming a mining voucher.
|
||||
*
|
||||
*/
|
||||
/datum/voucher_set
|
||||
/// Name of the set
|
||||
var/name
|
||||
/// Description of the set
|
||||
var/description
|
||||
/// Icon of the set
|
||||
var/icon
|
||||
/// Icon state of the set
|
||||
var/icon_state
|
||||
/// List of items contained in the set
|
||||
var/list/set_items = list()
|
||||
|
||||
/datum/voucher_set/crusher_kit
|
||||
name = "Crusher Kit"
|
||||
description = "Contains a kinetic crusher and a pocket fire extinguisher. Kinetic crusher is a versatile melee mining tool capable both of mining and fighting local fauna, however it is difficult to use effectively for anyone but most skilled and/or suicidal miners."
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "crusher"
|
||||
set_items = list(
|
||||
/obj/item/extinguisher/mini,
|
||||
/obj/item/kinetic_crusher,
|
||||
)
|
||||
|
||||
/datum/voucher_set/extraction_kit
|
||||
name = "Extraction and Rescue Kit"
|
||||
description = "Contains a fulton extraction pack and a beacon signaller, which allows you to send back home minerals, items and dead bodies without having to use the mining shuttle. And as a bonus, you get 30 marker beacons to help you better mark your path."
|
||||
icon = 'icons/obj/fulton.dmi'
|
||||
icon_state = "extraction_pack"
|
||||
set_items = list(
|
||||
/obj/item/extraction_pack,
|
||||
/obj/item/fulton_core,
|
||||
/obj/item/stack/marker_beacon/thirty,
|
||||
)
|
||||
|
||||
/datum/voucher_set/resonator_kit
|
||||
name = "Resonator Kit"
|
||||
description = "Contains a resonator and a pocket fire extinguisher. Resonator is a handheld device that creates small fields of energy that resonate until they detonate, crushing rock. It does increased damage in low pressure."
|
||||
icon = 'icons/obj/mining.dmi'
|
||||
icon_state = "resonator"
|
||||
set_items = list(
|
||||
/obj/item/extinguisher/mini,
|
||||
/obj/item/resonator,
|
||||
)
|
||||
|
||||
/datum/voucher_set/survival_capsule
|
||||
name = "Survival Capsule and Explorer's Webbing"
|
||||
description = "Contains an explorer's webbing, which allows you to carry even more mining equipment and already has a spare shelter capsule in it."
|
||||
icon = 'icons/obj/clothing/belts.dmi'
|
||||
icon_state = "explorer1"
|
||||
set_items = list(
|
||||
/obj/item/storage/belt/mining/vendor,
|
||||
)
|
||||
|
||||
/datum/voucher_set/minebot_kit
|
||||
name = "Minebot Kit"
|
||||
description = "Contains a little minebot companion that helps you in storing ore and hunting wildlife. Also comes with an upgraded industrial welding tool (80u), a welding mask and a KA modkit that allows shots to pass through the minebot."
|
||||
icon = 'icons/mob/aibots.dmi'
|
||||
icon_state = "mining_drone"
|
||||
set_items = list(
|
||||
/mob/living/simple_animal/hostile/mining_drone,
|
||||
/obj/item/weldingtool/hugetank,
|
||||
/obj/item/clothing/head/welding,
|
||||
/obj/item/borg/upgrade/modkit/minebot_passthrough,
|
||||
)
|
||||
|
||||
/datum/voucher_set/conscription_kit
|
||||
name = "Mining Conscription Kit"
|
||||
description = "Contains a whole new mining starter kit for one crewmember, consisting of a proto-kinetic accelerator, a survival knife, a seclite, an explorer's suit, a mesons, an automatic mining scanner, a mining satchel, a gas mask, a mining radio key and a special ID card with a basic mining access."
|
||||
icon = 'icons/obj/storage.dmi'
|
||||
icon_state = "duffel-explorer"
|
||||
set_items = list(
|
||||
/obj/item/storage/backpack/duffelbag/mining_conscript,
|
||||
)
|
||||
Reference in New Issue
Block a user