mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 02:34:00 +00:00
[MIRROR] Kitchen UI Update (#9567)
Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
f9843e1ddf
commit
08156ced8c
@@ -189,6 +189,10 @@ What is the naming convention for planes or layers?
|
|||||||
#define PLANE_PLAYER_HUD_ABOVE 97 //Things above the player hud
|
#define PLANE_PLAYER_HUD_ABOVE 97 //Things above the player hud
|
||||||
#define PLANE_PLAYER_SPLASH 98 //Splash screen //CHOMPEdit
|
#define PLANE_PLAYER_SPLASH 98 //Splash screen //CHOMPEdit
|
||||||
|
|
||||||
|
#define RADIAL_BACKGROUND_LAYER 0
|
||||||
|
///1000 is an unimportant number, it's just to normalize copied layers
|
||||||
|
#define RADIAL_CONTENT_LAYER 1000
|
||||||
|
|
||||||
#define PLANE_ADMIN3 99 //Purely for shenanigans (above HUD)
|
#define PLANE_ADMIN3 99 //Purely for shenanigans (above HUD)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,33 +3,52 @@
|
|||||||
|
|
||||||
GLOBAL_LIST_EMPTY(radial_menus)
|
GLOBAL_LIST_EMPTY(radial_menus)
|
||||||
|
|
||||||
// Ported from TG
|
|
||||||
|
|
||||||
/obj/screen/radial
|
/obj/screen/radial
|
||||||
icon = 'icons/mob/radial.dmi'
|
icon = 'icons/mob/radial.dmi'
|
||||||
layer = LAYER_HUD_ABOVE
|
|
||||||
plane = PLANE_PLAYER_HUD_ABOVE
|
plane = PLANE_PLAYER_HUD_ABOVE
|
||||||
|
vis_flags = VIS_INHERIT_PLANE
|
||||||
|
var/click_on_hover = FALSE
|
||||||
var/datum/radial_menu/parent
|
var/datum/radial_menu/parent
|
||||||
|
|
||||||
|
/obj/screen/radial/proc/set_parent(new_value)
|
||||||
|
if(parent)
|
||||||
|
UnregisterSignal(parent, COMSIG_PARENT_QDELETING)
|
||||||
|
parent = new_value
|
||||||
|
if(parent)
|
||||||
|
RegisterSignal(parent, COMSIG_PARENT_QDELETING, PROC_REF(handle_parent_del))
|
||||||
|
|
||||||
|
/obj/screen/radial/proc/handle_parent_del()
|
||||||
|
SIGNAL_HANDLER
|
||||||
|
set_parent(null)
|
||||||
|
|
||||||
/obj/screen/radial/slice
|
/obj/screen/radial/slice
|
||||||
icon_state = "radial_slice"
|
icon_state = "radial_slice"
|
||||||
var/choice
|
var/choice
|
||||||
var/next_page = FALSE
|
var/next_page = FALSE
|
||||||
var/tooltips = FALSE
|
var/tooltips = FALSE
|
||||||
|
|
||||||
/obj/screen/radial/Destroy()
|
/obj/screen/radial/slice/set_parent(new_value)
|
||||||
parent = null
|
. = ..()
|
||||||
return ..()
|
if(parent)
|
||||||
|
icon_state = parent.radial_slice_icon
|
||||||
|
|
||||||
/obj/screen/radial/slice/MouseEntered(location, control, params)
|
/obj/screen/radial/slice/MouseEntered(location, control, params)
|
||||||
. = ..()
|
. = ..()
|
||||||
icon_state = "radial_slice_focus"
|
if(next_page || !parent)
|
||||||
|
icon_state = "radial_slice_focus"
|
||||||
|
else
|
||||||
|
icon_state = "[parent.radial_slice_icon]_focus"
|
||||||
if(tooltips)
|
if(tooltips)
|
||||||
openToolTip(usr, src, params, title = name)
|
openToolTip(usr, src, params, title = name)
|
||||||
|
if (click_on_hover && !isnull(usr) && !isnull(parent))
|
||||||
|
Click(location, control, params)
|
||||||
|
|
||||||
/obj/screen/radial/slice/MouseExited(location, control, params)
|
/obj/screen/radial/slice/MouseExited(location, control, params)
|
||||||
. = ..()
|
. = ..()
|
||||||
icon_state = "radial_slice"
|
if(next_page || !parent)
|
||||||
|
icon_state = "radial_slice"
|
||||||
|
else
|
||||||
|
icon_state = parent.radial_slice_icon
|
||||||
if(tooltips)
|
if(tooltips)
|
||||||
closeToolTip(usr)
|
closeToolTip(usr)
|
||||||
|
|
||||||
@@ -38,7 +57,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
if(next_page)
|
if(next_page)
|
||||||
parent.next_page()
|
parent.next_page()
|
||||||
else
|
else
|
||||||
parent.element_chosen(choice,usr)
|
parent.element_chosen(choice, usr, params)
|
||||||
|
|
||||||
/obj/screen/radial/center
|
/obj/screen/radial/center
|
||||||
name = "Close Menu"
|
name = "Close Menu"
|
||||||
@@ -57,9 +76,18 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
parent.finished = TRUE
|
parent.finished = TRUE
|
||||||
|
|
||||||
/datum/radial_menu
|
/datum/radial_menu
|
||||||
var/list/choices = list() //List of choice id's
|
/// List of choice IDs
|
||||||
var/list/choices_icons = list() //choice_id -> icon
|
var/list/choices = list()
|
||||||
var/list/choices_values = list() //choice_id -> choice
|
|
||||||
|
/// choice_id -> icon
|
||||||
|
var/list/choices_icons = list()
|
||||||
|
|
||||||
|
/// choice_id -> choice
|
||||||
|
var/list/choices_values = list()
|
||||||
|
|
||||||
|
/// choice_id -> /datum/radial_menu_choice
|
||||||
|
var/list/choice_datums = list()
|
||||||
|
|
||||||
var/list/page_data = list() //list of choices per page
|
var/list/page_data = list() //list of choices per page
|
||||||
|
|
||||||
|
|
||||||
@@ -87,6 +115,9 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
var/py_shift = 0
|
var/py_shift = 0
|
||||||
var/entry_animation = TRUE
|
var/entry_animation = TRUE
|
||||||
|
|
||||||
|
///A replacement icon state for the generic radial slice bg icon. Doesn't affect the next page nor the center buttons
|
||||||
|
var/radial_slice_icon
|
||||||
|
|
||||||
//If we swap to vis_contens inventory these will need a redo
|
//If we swap to vis_contens inventory these will need a redo
|
||||||
/datum/radial_menu/proc/check_screen_border(mob/user)
|
/datum/radial_menu/proc/check_screen_border(mob/user)
|
||||||
var/atom/movable/AM = anchor
|
var/atom/movable/AM = anchor
|
||||||
@@ -98,6 +129,8 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
else
|
else
|
||||||
py_shift = 32
|
py_shift = 32
|
||||||
restrict_to_dir(NORTH) //I was going to parse screen loc here but that's more effort than it's worth.
|
restrict_to_dir(NORTH) //I was going to parse screen loc here but that's more effort than it's worth.
|
||||||
|
else if(hudfix_method && AM.loc)
|
||||||
|
anchor = get_atom_on_turf(anchor)
|
||||||
|
|
||||||
//Sets defaults
|
//Sets defaults
|
||||||
//These assume 45 deg min_angle
|
//These assume 45 deg min_angle
|
||||||
@@ -116,7 +149,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
starting_angle = 180
|
starting_angle = 180
|
||||||
ending_angle = 45
|
ending_angle = 45
|
||||||
|
|
||||||
/datum/radial_menu/proc/setup_menu(use_tooltips)
|
/datum/radial_menu/proc/setup_menu(use_tooltips, set_page = 1, click_on_hover = FALSE)
|
||||||
if(ending_angle > starting_angle)
|
if(ending_angle > starting_angle)
|
||||||
zone = ending_angle - starting_angle
|
zone = ending_angle - starting_angle
|
||||||
else
|
else
|
||||||
@@ -129,7 +162,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
for(var/i in 1 to elements_to_add) //Create all elements
|
for(var/i in 1 to elements_to_add) //Create all elements
|
||||||
var/obj/screen/radial/slice/new_element = new /obj/screen/radial/slice
|
var/obj/screen/radial/slice/new_element = new /obj/screen/radial/slice
|
||||||
new_element.tooltips = use_tooltips
|
new_element.tooltips = use_tooltips
|
||||||
new_element.parent = src
|
new_element.set_parent(src)
|
||||||
elements += new_element
|
elements += new_element
|
||||||
|
|
||||||
var/page = 1
|
var/page = 1
|
||||||
@@ -152,22 +185,31 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
|
|
||||||
page_data[page] = current
|
page_data[page] = current
|
||||||
pages = page
|
pages = page
|
||||||
current_page = 1
|
current_page = clamp(set_page, 1, pages)
|
||||||
update_screen_objects(anim = entry_animation)
|
update_screen_objects(entry_animation, click_on_hover)
|
||||||
|
|
||||||
/datum/radial_menu/proc/update_screen_objects(anim = FALSE)
|
/datum/radial_menu/proc/update_screen_objects(anim = FALSE, click_on_hover = FALSE)
|
||||||
var/list/page_choices = page_data[current_page]
|
var/list/page_choices = page_data[current_page]
|
||||||
var/angle_per_element = round(zone / page_choices.len)
|
var/angle_per_element = round(zone / page_choices.len)
|
||||||
for(var/i in 1 to elements.len)
|
for(var/i in 1 to elements.len)
|
||||||
var/obj/screen/radial/E = elements[i]
|
var/obj/screen/radial/element = elements[i]
|
||||||
var/angle = WRAP(starting_angle + (i - 1) * angle_per_element,0,360)
|
var/angle = WRAP(starting_angle + (i - 1) * angle_per_element,0,360)
|
||||||
if(i > page_choices.len)
|
if(i > page_choices.len)
|
||||||
HideElement(E)
|
HideElement(element)
|
||||||
|
element.click_on_hover = FALSE
|
||||||
else
|
else
|
||||||
SetElement(E,page_choices[i],angle,anim = anim,anim_order = i)
|
SetElement(element,page_choices[i],angle,anim = anim,anim_order = i)
|
||||||
|
// Only activate click on hover after the animation plays
|
||||||
|
if (!click_on_hover)
|
||||||
|
continue
|
||||||
|
if (anim)
|
||||||
|
addtimer(VARSET_CALLBACK(element, click_on_hover, TRUE), i * 0.5)
|
||||||
|
else
|
||||||
|
element.click_on_hover = TRUE
|
||||||
|
|
||||||
/datum/radial_menu/proc/HideElement(obj/screen/radial/slice/E)
|
/datum/radial_menu/proc/HideElement(obj/screen/radial/slice/E)
|
||||||
E.cut_overlays()
|
E.cut_overlays()
|
||||||
|
E.vis_contents.Cut()
|
||||||
E.alpha = 0
|
E.alpha = 0
|
||||||
E.name = "None"
|
E.name = "None"
|
||||||
E.maptext = null
|
E.maptext = null
|
||||||
@@ -194,13 +236,22 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
E.alpha = 255
|
E.alpha = 255
|
||||||
E.mouse_opacity = MOUSE_OPACITY_ICON
|
E.mouse_opacity = MOUSE_OPACITY_ICON
|
||||||
E.cut_overlays()
|
E.cut_overlays()
|
||||||
|
E.vis_contents.Cut()
|
||||||
if(choice_id == NEXT_PAGE_ID)
|
if(choice_id == NEXT_PAGE_ID)
|
||||||
E.name = "Next Page"
|
E.name = "Next Page"
|
||||||
E.next_page = TRUE
|
E.next_page = TRUE
|
||||||
|
E.icon_state = "radial_slice" // Resets the bg icon state to the default for next page buttons.
|
||||||
E.add_overlay("radial_next")
|
E.add_overlay("radial_next")
|
||||||
else
|
else
|
||||||
if(istext(choices_values[choice_id]))
|
//This isn't granted to exist, so use the ?. operator for conditionals that use it.
|
||||||
|
var/datum/radial_menu_choice/choice_datum = choice_datums[choice_id]
|
||||||
|
if(choice_datum?.name)
|
||||||
|
E.name = choice_datum.name
|
||||||
|
else if(istext(choices_values[choice_id]))
|
||||||
E.name = choices_values[choice_id]
|
E.name = choices_values[choice_id]
|
||||||
|
else if(ispath(choices_values[choice_id],/atom))
|
||||||
|
var/atom/A = choices_values[choice_id]
|
||||||
|
E.name = initial(A.name)
|
||||||
else
|
else
|
||||||
var/atom/movable/AM = choices_values[choice_id] //Movables only
|
var/atom/movable/AM = choices_values[choice_id] //Movables only
|
||||||
E.name = AM.name
|
E.name = AM.name
|
||||||
@@ -209,15 +260,21 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
E.next_page = FALSE
|
E.next_page = FALSE
|
||||||
if(choices_icons[choice_id])
|
if(choices_icons[choice_id])
|
||||||
E.add_overlay(choices_icons[choice_id])
|
E.add_overlay(choices_icons[choice_id])
|
||||||
|
if (choice_datum?.info)
|
||||||
|
var/obj/effect/abstract/info/info_button = new(E, choice_datum.info)
|
||||||
|
info_button.plane = PLANE_PLAYER_HUD_ABOVE
|
||||||
|
info_button.layer = RADIAL_CONTENT_LAYER
|
||||||
|
E.vis_contents += info_button
|
||||||
|
|
||||||
/datum/radial_menu/New()
|
/datum/radial_menu/New()
|
||||||
close_button = new
|
close_button = new
|
||||||
close_button.parent = src
|
close_button.set_parent(src)
|
||||||
|
|
||||||
/datum/radial_menu/proc/Reset()
|
/datum/radial_menu/proc/Reset()
|
||||||
choices.Cut()
|
choices.Cut()
|
||||||
choices_icons.Cut()
|
choices_icons.Cut()
|
||||||
choices_values.Cut()
|
choices_values.Cut()
|
||||||
|
choice_datums.Cut()
|
||||||
current_page = 1
|
current_page = 1
|
||||||
|
|
||||||
/datum/radial_menu/proc/element_chosen(choice_id,mob/user)
|
/datum/radial_menu/proc/element_chosen(choice_id,mob/user)
|
||||||
@@ -226,7 +283,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
/datum/radial_menu/proc/get_next_id()
|
/datum/radial_menu/proc/get_next_id()
|
||||||
return "c_[choices.len]"
|
return "c_[choices.len]"
|
||||||
|
|
||||||
/datum/radial_menu/proc/set_choices(list/new_choices, use_tooltips)
|
/datum/radial_menu/proc/set_choices(list/new_choices, use_tooltips, click_on_hover = FALSE, set_page = 1)
|
||||||
if(choices.len)
|
if(choices.len)
|
||||||
Reset()
|
Reset()
|
||||||
for(var/E in new_choices)
|
for(var/E in new_choices)
|
||||||
@@ -237,13 +294,20 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
var/I = extract_image(new_choices[E])
|
var/I = extract_image(new_choices[E])
|
||||||
if(I)
|
if(I)
|
||||||
choices_icons[id] = I
|
choices_icons[id] = I
|
||||||
setup_menu(use_tooltips)
|
|
||||||
|
|
||||||
|
if (istype(new_choices[E], /datum/radial_menu_choice))
|
||||||
|
choice_datums[id] = new_choices[E]
|
||||||
|
setup_menu(use_tooltips, set_page, click_on_hover)
|
||||||
|
|
||||||
/datum/radial_menu/proc/extract_image(E)
|
/datum/radial_menu/proc/extract_image(to_extract_from)
|
||||||
var/mutable_appearance/MA = new /mutable_appearance(E)
|
if (istype(to_extract_from, /datum/radial_menu_choice))
|
||||||
|
var/datum/radial_menu_choice/choice = to_extract_from
|
||||||
|
to_extract_from = choice.image
|
||||||
|
|
||||||
|
var/mutable_appearance/MA = new /mutable_appearance(to_extract_from)
|
||||||
if(MA)
|
if(MA)
|
||||||
MA.layer = LAYER_HUD_ABOVE
|
MA.plane = PLANE_PLAYER_HUD_ABOVE
|
||||||
|
MA.layer = RADIAL_CONTENT_LAYER
|
||||||
MA.appearance_flags |= RESET_TRANSFORM
|
MA.appearance_flags |= RESET_TRANSFORM
|
||||||
return MA
|
return MA
|
||||||
|
|
||||||
@@ -253,17 +317,16 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
current_page = WRAP(current_page + 1,1,pages+1)
|
current_page = WRAP(current_page + 1,1,pages+1)
|
||||||
update_screen_objects()
|
update_screen_objects()
|
||||||
|
|
||||||
/datum/radial_menu/proc/show_to(mob/M)
|
/datum/radial_menu/proc/show_to(mob/M, offset_x = 0, offset_y = 0)
|
||||||
if(current_user)
|
if(current_user)
|
||||||
hide()
|
hide()
|
||||||
if(!M.client || !anchor)
|
if(!M.client || !anchor)
|
||||||
return
|
return
|
||||||
current_user = M.client
|
current_user = M.client
|
||||||
//Blank
|
//Blank
|
||||||
menu_holder = image(icon='icons/effects/effects.dmi',loc=anchor,icon_state="nothing",layer = LAYER_HUD_ABOVE)
|
menu_holder = image(icon='icons/effects/effects.dmi',loc=anchor,icon_state="nothing", layer = RADIAL_BACKGROUND_LAYER, pixel_x = offset_x, pixel_y = offset_y)
|
||||||
menu_holder.plane = PLANE_PLAYER_HUD_ABOVE //CHOMPEdit - fixed plane
|
menu_holder.plane = PLANE_PLAYER_HUD_ABOVE
|
||||||
menu_holder.appearance_flags |= RESET_TRANSFORM //CHOMPEdit - fix radial scaling improperly based on mob size
|
menu_holder.appearance_flags |= KEEP_APART|RESET_ALPHA|RESET_COLOR|RESET_TRANSFORM
|
||||||
menu_holder.appearance_flags |= KEEP_APART
|
|
||||||
menu_holder.vis_contents += elements + close_button
|
menu_holder.vis_contents += elements + close_button
|
||||||
current_user.images += menu_holder
|
current_user.images += menu_holder
|
||||||
|
|
||||||
@@ -285,9 +348,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
/datum/radial_menu/Destroy()
|
/datum/radial_menu/Destroy()
|
||||||
Reset()
|
Reset()
|
||||||
hide()
|
hide()
|
||||||
QDEL_LIST_NULL(elements)
|
custom_check_callback = null
|
||||||
QDEL_NULL(close_button)
|
|
||||||
QDEL_NULL(custom_check_callback)
|
|
||||||
. = ..()
|
. = ..()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -295,30 +356,66 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
|||||||
Choices should be a list where list keys are movables or text used for element names and return value
|
Choices should be a list where list keys are movables or text used for element names and return value
|
||||||
and list values are movables/icons/images used for element icons
|
and list values are movables/icons/images used for element icons
|
||||||
*/
|
*/
|
||||||
/proc/show_radial_menu(mob/user, atom/anchor, list/choices, uniqueid, radius, datum/callback/custom_check, require_near = FALSE, tooltips = FALSE)
|
/proc/show_radial_menu(mob/user, atom/anchor, list/choices, uniqueid, radius, datum/callback/custom_check, require_near = FALSE, tooltips = FALSE, no_repeat_close = FALSE, radial_slice_icon = "radial_slice", autopick_single_option = TRUE, entry_animation = TRUE, click_on_hover = FALSE, user_space = FALSE)
|
||||||
if(!user || !anchor || !length(choices))
|
if(!user || !anchor || !length(choices))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if(length(choices)==1 && autopick_single_option)
|
||||||
|
return choices[1]
|
||||||
|
|
||||||
if(!uniqueid)
|
if(!uniqueid)
|
||||||
uniqueid = "defmenu_[REF(user)]_[REF(anchor)]"
|
uniqueid = "defmenu_[REF(user)]_[REF(anchor)]"
|
||||||
|
|
||||||
if(GLOB.radial_menus[uniqueid])
|
if(GLOB.radial_menus[uniqueid])
|
||||||
|
if(!no_repeat_close)
|
||||||
|
var/datum/radial_menu/menu = GLOB.radial_menus[uniqueid]
|
||||||
|
menu.finished = TRUE
|
||||||
return
|
return
|
||||||
|
|
||||||
var/datum/radial_menu/menu = new
|
var/datum/radial_menu/menu = new
|
||||||
|
menu.entry_animation = entry_animation
|
||||||
GLOB.radial_menus[uniqueid] = menu
|
GLOB.radial_menus[uniqueid] = menu
|
||||||
if(radius)
|
if(radius)
|
||||||
menu.radius = radius
|
menu.radius = radius
|
||||||
if(istype(custom_check))
|
if(istype(custom_check))
|
||||||
menu.custom_check_callback = custom_check
|
menu.custom_check_callback = custom_check
|
||||||
menu.anchor = anchor
|
menu.anchor = user_space ? user : anchor
|
||||||
|
menu.radial_slice_icon = radial_slice_icon
|
||||||
menu.check_screen_border(user) //Do what's needed to make it look good near borders or on hud
|
menu.check_screen_border(user) //Do what's needed to make it look good near borders or on hud
|
||||||
menu.set_choices(choices, tooltips)
|
menu.set_choices(choices, tooltips, click_on_hover)
|
||||||
menu.show_to(user)
|
var/offset_x = 0
|
||||||
|
var/offset_y = 0
|
||||||
|
if (user_space)
|
||||||
|
var/turf/user_turf = get_turf(user)
|
||||||
|
var/turf/anchor_turf = get_turf(anchor)
|
||||||
|
offset_x = (anchor_turf.x - user_turf.x) * ICON_SIZE_X + anchor.pixel_x - user.pixel_x
|
||||||
|
offset_y = (anchor_turf.y - user_turf.y) * ICON_SIZE_Y + anchor.pixel_y - user.pixel_y
|
||||||
|
menu.show_to(user, offset_x, offset_y)
|
||||||
menu.wait(user, anchor, require_near)
|
menu.wait(user, anchor, require_near)
|
||||||
var/answer = menu.selected_choice
|
var/answer = menu.selected_choice
|
||||||
QDEL_NULL(menu)
|
qdel(menu)
|
||||||
GLOB.radial_menus -= uniqueid
|
GLOB.radial_menus -= uniqueid
|
||||||
|
if(require_near && !in_range(anchor, user))
|
||||||
|
return
|
||||||
|
if(istype(custom_check))
|
||||||
|
if(!custom_check.Invoke())
|
||||||
|
return
|
||||||
return answer
|
return answer
|
||||||
|
|
||||||
|
/// Can be provided to choices in radial menus if you want to provide more information
|
||||||
|
/datum/radial_menu_choice
|
||||||
|
/// Required -- what to display for this button
|
||||||
|
var/image
|
||||||
|
|
||||||
|
/// If provided, this will be the name the radial slice hud button. This has priority over everything else.
|
||||||
|
var/name
|
||||||
|
|
||||||
|
/// If provided, will display an info button that will put this text in your chat
|
||||||
|
var/info
|
||||||
|
|
||||||
|
/datum/radial_menu_choice/Destroy(force)
|
||||||
|
. = ..()
|
||||||
|
QDEL_NULL(image)
|
||||||
|
|
||||||
#undef NEXT_PAGE_ID
|
#undef NEXT_PAGE_ID
|
||||||
#undef DEFAULT_CHECK_DELAY
|
#undef DEFAULT_CHECK_DELAY
|
||||||
|
|||||||
28
code/game/objects/effects/info.dm
Normal file
28
code/game/objects/effects/info.dm
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
/// An info button that, when clicked, puts some text in the user's chat
|
||||||
|
/obj/effect/abstract/info
|
||||||
|
name = "info"
|
||||||
|
icon = 'icons/effects/effects.dmi'
|
||||||
|
icon_state = "info"
|
||||||
|
|
||||||
|
mouse_opacity = MOUSE_OPACITY_OPAQUE
|
||||||
|
|
||||||
|
/// What should the info button display when clicked?
|
||||||
|
var/info_text
|
||||||
|
|
||||||
|
/obj/effect/abstract/info/Initialize(mapload, info_text)
|
||||||
|
. = ..()
|
||||||
|
|
||||||
|
if (!isnull(info_text))
|
||||||
|
src.info_text = info_text
|
||||||
|
|
||||||
|
/obj/effect/abstract/info/Click()
|
||||||
|
. = ..()
|
||||||
|
to_chat(usr, info_text)
|
||||||
|
|
||||||
|
/obj/effect/abstract/info/MouseEntered(location, control, params)
|
||||||
|
. = ..()
|
||||||
|
icon_state = "info_hovered"
|
||||||
|
|
||||||
|
/obj/effect/abstract/info/MouseExited()
|
||||||
|
. = ..()
|
||||||
|
icon_state = initial(icon_state)
|
||||||
@@ -43,6 +43,11 @@
|
|||||||
var/combine_first = FALSE // If TRUE, this appliance will do combination cooking before checking recipes
|
var/combine_first = FALSE // If TRUE, this appliance will do combination cooking before checking recipes
|
||||||
var/food_safety = FALSE //RS ADD - If true, the appliance automatically ejects food instead of burning it
|
var/food_safety = FALSE //RS ADD - If true, the appliance automatically ejects food instead of burning it
|
||||||
|
|
||||||
|
var/static/radial_eject = image(icon = 'icons/mob/radial.dmi', icon_state = "radial_eject")
|
||||||
|
var/static/radial_power = image(icon = 'icons/mob/radial.dmi', icon_state = "radial_power")
|
||||||
|
var/static/radial_safety = image(icon = 'icons/mob/radial.dmi', icon_state = "radial_safety")
|
||||||
|
var/static/radial_output = image(icon = 'icons/mob/radial.dmi', icon_state = "radial_change_output")
|
||||||
|
|
||||||
/obj/machinery/appliance/Initialize()
|
/obj/machinery/appliance/Initialize()
|
||||||
. = ..()
|
. = ..()
|
||||||
|
|
||||||
@@ -611,8 +616,31 @@
|
|||||||
if(..())
|
if(..())
|
||||||
return
|
return
|
||||||
|
|
||||||
if(cooking_objs.len)
|
interact(user)
|
||||||
removal_menu(user)
|
|
||||||
|
/obj/machinery/appliance/interact(mob/user)
|
||||||
|
var/list/options = list(
|
||||||
|
"power" = radial_power,
|
||||||
|
"safety" = radial_safety,
|
||||||
|
)
|
||||||
|
|
||||||
|
if(LAZYLEN(cooking_objs))
|
||||||
|
options["remove"] = radial_eject
|
||||||
|
|
||||||
|
if(LAZYLEN(output_options))
|
||||||
|
options["select_output"] = radial_output
|
||||||
|
|
||||||
|
var/choice = show_radial_menu(user, src, options, require_near = !issilicon(user))
|
||||||
|
|
||||||
|
switch(choice)
|
||||||
|
if("power")
|
||||||
|
toggle_power()
|
||||||
|
if("safety")
|
||||||
|
toggle_safety()
|
||||||
|
if("remove")
|
||||||
|
removal_menu(user)
|
||||||
|
if("select_output")
|
||||||
|
choose_output()
|
||||||
|
|
||||||
/obj/machinery/appliance/proc/removal_menu(var/mob/user)
|
/obj/machinery/appliance/proc/removal_menu(var/mob/user)
|
||||||
if (can_remove_items(user))
|
if (can_remove_items(user))
|
||||||
|
|||||||
@@ -26,11 +26,15 @@
|
|||||||
/obj/machinery/appliance/cooker/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
|
/obj/machinery/appliance/cooker/tgui_data(mob/user, datum/tgui/ui, datum/tgui_state/state)
|
||||||
var/list/data = ..()
|
var/list/data = ..()
|
||||||
|
|
||||||
|
data["on"] = !(stat & POWEROFF)
|
||||||
|
data["safety"] = food_safety
|
||||||
data["temperature"] = round(temperature - T0C, 0.1)
|
data["temperature"] = round(temperature - T0C, 0.1)
|
||||||
data["optimalTemp"] = round(optimal_temp - T0C, 0.1)
|
data["optimalTemp"] = round(optimal_temp - T0C, 0.1)
|
||||||
data["temperatureEnough"] = temperature >= min_temp
|
data["temperatureEnough"] = temperature >= min_temp
|
||||||
data["efficiency"] = round(get_efficiency(), 0.1)
|
data["efficiency"] = round(get_efficiency(), 0.1)
|
||||||
data["containersRemovable"] = can_remove_items(user, show_warning = FALSE)
|
data["containersRemovable"] = can_remove_items(user, show_warning = FALSE)
|
||||||
|
data["selected_option"] = selected_option
|
||||||
|
data["show_selected_option"] = LAZYLEN(output_options)
|
||||||
|
|
||||||
var/list/our_contents = list()
|
var/list/our_contents = list()
|
||||||
for(var/i in 1 to max_contents)
|
for(var/i in 1 to max_contents)
|
||||||
@@ -56,6 +60,15 @@
|
|||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
switch(action)
|
switch(action)
|
||||||
|
if("toggle_power")
|
||||||
|
attempt_toggle_power(usr)
|
||||||
|
return TRUE
|
||||||
|
if("toggle_safety")
|
||||||
|
toggle_safety()
|
||||||
|
return TRUE
|
||||||
|
if("change_output")
|
||||||
|
choose_output()
|
||||||
|
return TRUE
|
||||||
if("slot")
|
if("slot")
|
||||||
var/slot = params["slot"]
|
var/slot = params["slot"]
|
||||||
var/obj/item/I = usr.get_active_hand()
|
var/obj/item/I = usr.get_active_hand()
|
||||||
|
|||||||
@@ -215,14 +215,7 @@ var/global/list/ore_reagents = list( //have a number of reageents divisible by R
|
|||||||
if(length(holdingitems))
|
if(length(holdingitems))
|
||||||
options["grind"] = radial_grind
|
options["grind"] = radial_grind
|
||||||
|
|
||||||
var/choice
|
var/choice = show_radial_menu(user, src, options, require_near = !issilicon(user), autopick_single_option = FALSE)
|
||||||
if(length(options) < 1)
|
|
||||||
return
|
|
||||||
if(length(options) == 1)
|
|
||||||
for(var/key in options)
|
|
||||||
choice = key
|
|
||||||
else
|
|
||||||
choice = show_radial_menu(user, src, options, require_near = !issilicon(user))
|
|
||||||
|
|
||||||
// post choice verification
|
// post choice verification
|
||||||
if(inuse || (isAI(user) && stat & NOPOWER) || user.incapacitated())
|
if(inuse || (isAI(user) && stat & NOPOWER) || user.incapacitated())
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 425 KiB After Width: | Height: | Size: 426 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@@ -12,6 +12,10 @@ import {
|
|||||||
import { Window } from '../layouts';
|
import { Window } from '../layouts';
|
||||||
|
|
||||||
type Data = {
|
type Data = {
|
||||||
|
on: BooleanLike;
|
||||||
|
safety: BooleanLike;
|
||||||
|
selected_option: string | null;
|
||||||
|
show_selected_option: BooleanLike;
|
||||||
temperature: number;
|
temperature: number;
|
||||||
optimalTemp: number;
|
optimalTemp: number;
|
||||||
temperatureEnough: BooleanLike;
|
temperatureEnough: BooleanLike;
|
||||||
@@ -29,6 +33,10 @@ export const CookingAppliance = (props) => {
|
|||||||
const { act, data } = useBackend<Data>();
|
const { act, data } = useBackend<Data>();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
on,
|
||||||
|
safety,
|
||||||
|
selected_option,
|
||||||
|
show_selected_option,
|
||||||
temperature,
|
temperature,
|
||||||
optimalTemp,
|
optimalTemp,
|
||||||
temperatureEnough,
|
temperatureEnough,
|
||||||
@@ -40,8 +48,41 @@ export const CookingAppliance = (props) => {
|
|||||||
return (
|
return (
|
||||||
<Window width={600} height={600}>
|
<Window width={600} height={600}>
|
||||||
<Window.Content scrollable>
|
<Window.Content scrollable>
|
||||||
<Section title="Status">
|
<Section
|
||||||
|
title="Status"
|
||||||
|
buttons={
|
||||||
|
<Button
|
||||||
|
selected={on}
|
||||||
|
icon="power-off"
|
||||||
|
onClick={() => act('toggle_power')}
|
||||||
|
>
|
||||||
|
{on ? 'On' : 'Off'}
|
||||||
|
</Button>
|
||||||
|
}
|
||||||
|
>
|
||||||
<LabeledList>
|
<LabeledList>
|
||||||
|
<LabeledList.Item label="Safety">
|
||||||
|
<Button
|
||||||
|
fluid
|
||||||
|
selected={safety}
|
||||||
|
icon={safety ? 'shield-alt' : 'exclamation-triangle'}
|
||||||
|
onClick={() => act('toggle_safety')}
|
||||||
|
>
|
||||||
|
{safety ? 'On' : 'Off'}
|
||||||
|
</Button>
|
||||||
|
</LabeledList.Item>
|
||||||
|
{!!show_selected_option && (
|
||||||
|
<LabeledList.Item label="Selected Output">
|
||||||
|
<Button
|
||||||
|
icon="pencil"
|
||||||
|
fluid
|
||||||
|
onClick={() => act('change_output')}
|
||||||
|
tooltip="Change Output"
|
||||||
|
>
|
||||||
|
{selected_option || 'Default'}
|
||||||
|
</Button>
|
||||||
|
</LabeledList.Item>
|
||||||
|
)}
|
||||||
<LabeledList.Item label="Temperature">
|
<LabeledList.Item label="Temperature">
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
color={temperatureEnough ? 'good' : 'blue'}
|
color={temperatureEnough ? 'good' : 'blue'}
|
||||||
|
|||||||
@@ -1295,6 +1295,7 @@
|
|||||||
#include "code\game\objects\effects\explosion_particles.dm"
|
#include "code\game\objects\effects\explosion_particles.dm"
|
||||||
#include "code\game\objects\effects\gibs.dm"
|
#include "code\game\objects\effects\gibs.dm"
|
||||||
#include "code\game\objects\effects\glowshroom.dm"
|
#include "code\game\objects\effects\glowshroom.dm"
|
||||||
|
#include "code\game\objects\effects\info.dm"
|
||||||
#include "code\game\objects\effects\item_pickup_ghost.dm"
|
#include "code\game\objects\effects\item_pickup_ghost.dm"
|
||||||
#include "code\game\objects\effects\job_start_landmarks.dm"
|
#include "code\game\objects\effects\job_start_landmarks.dm"
|
||||||
#include "code\game\objects\effects\landmarks.dm"
|
#include "code\game\objects\effects\landmarks.dm"
|
||||||
|
|||||||
Reference in New Issue
Block a user