mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-10 09:42:29 +00:00
[MIRROR] Painting improvement: Added a palette component for spraycans and palette items. [MDB IGNORE] (#12219)
* Painting improvement: Added a palette component for spraycans and palette items. (#65577) * Painting improvement: Added a palette component for spraycans and palettes. * Painting improvement: Added a palette component for spraycans and palette items. Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
@@ -25,15 +25,26 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
||||
var/next_page = FALSE
|
||||
var/tooltips = FALSE
|
||||
|
||||
/atom/movable/screen/radial/slice/set_parent(new_value)
|
||||
. = ..()
|
||||
if(parent)
|
||||
icon_state = parent.radial_slice_icon
|
||||
|
||||
/atom/movable/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)
|
||||
openToolTip(usr, src, params, title = name)
|
||||
|
||||
/atom/movable/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)
|
||||
closeToolTip(usr)
|
||||
|
||||
@@ -42,7 +53,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
||||
if(next_page)
|
||||
parent.next_page()
|
||||
else
|
||||
parent.element_chosen(choice,usr)
|
||||
parent.element_chosen(choice, usr, params)
|
||||
|
||||
/atom/movable/screen/radial/center
|
||||
name = "Close Menu"
|
||||
@@ -101,6 +112,9 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
||||
var/entry_animation = TRUE
|
||||
var/icon_path = 'icons/hud/radial.dmi' //SKYRAT EDIT ADDITION - GUNPOINT
|
||||
|
||||
///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
|
||||
/datum/radial_menu/proc/check_screen_border(mob/user)
|
||||
var/atom/movable/AM = anchor
|
||||
@@ -132,7 +146,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
||||
starting_angle = 180
|
||||
ending_angle = 45
|
||||
|
||||
/datum/radial_menu/proc/setup_menu(use_tooltips)
|
||||
/datum/radial_menu/proc/setup_menu(use_tooltips, set_page = 1)
|
||||
if(ending_angle > starting_angle)
|
||||
zone = ending_angle - starting_angle
|
||||
else
|
||||
@@ -169,7 +183,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
||||
|
||||
page_data[page] = current
|
||||
pages = page
|
||||
current_page = 1
|
||||
current_page = clamp(set_page, 1, pages)
|
||||
update_screen_objects(anim = entry_animation)
|
||||
|
||||
/datum/radial_menu/proc/update_screen_objects(anim = FALSE)
|
||||
@@ -215,9 +229,14 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
||||
if(choice_id == NEXT_PAGE_ID)
|
||||
E.name = "Next Page"
|
||||
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")
|
||||
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]
|
||||
else if(ispath(choices_values[choice_id],/atom))
|
||||
var/atom/A = choices_values[choice_id]
|
||||
@@ -230,13 +249,11 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
||||
E.next_page = FALSE
|
||||
if(choices_icons[choice_id])
|
||||
E.add_overlay(choices_icons[choice_id])
|
||||
if (choice_datums[choice_id])
|
||||
var/datum/radial_menu_choice/choice_datum = choice_datums[choice_id]
|
||||
if (choice_datum.info)
|
||||
var/obj/effect/abstract/info/info_button = new(E, choice_datum.info)
|
||||
info_button.plane = ABOVE_HUD_PLANE
|
||||
info_button.layer = RADIAL_CONTENT_LAYER
|
||||
E.vis_contents += info_button
|
||||
if (choice_datum?.info)
|
||||
var/obj/effect/abstract/info/info_button = new(E, choice_datum.info)
|
||||
info_button.plane = ABOVE_HUD_PLANE
|
||||
info_button.layer = RADIAL_CONTENT_LAYER
|
||||
E.vis_contents += info_button
|
||||
|
||||
/datum/radial_menu/New()
|
||||
close_button = new
|
||||
@@ -246,6 +263,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
||||
choices.Cut()
|
||||
choices_icons.Cut()
|
||||
choices_values.Cut()
|
||||
choice_datums.Cut()
|
||||
current_page = 1
|
||||
|
||||
/datum/radial_menu/proc/element_chosen(choice_id,mob/user)
|
||||
@@ -254,7 +272,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
||||
/datum/radial_menu/proc/get_next_id()
|
||||
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, set_page = 1)
|
||||
if(choices.len)
|
||||
Reset()
|
||||
for(var/E in new_choices)
|
||||
@@ -268,7 +286,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
||||
|
||||
if (istype(new_choices[E], /datum/radial_menu_choice))
|
||||
choice_datums[id] = new_choices[E]
|
||||
setup_menu(use_tooltips)
|
||||
setup_menu(use_tooltips, set_page)
|
||||
|
||||
/datum/radial_menu/proc/extract_image(to_extract_from)
|
||||
if (istype(to_extract_from, /datum/radial_menu_choice))
|
||||
@@ -327,7 +345,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
||||
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
|
||||
*/
|
||||
/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)
|
||||
/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")
|
||||
if(!user || !anchor || !length(choices))
|
||||
return
|
||||
if(!uniqueid)
|
||||
@@ -346,6 +364,7 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
||||
if(istype(custom_check))
|
||||
menu.custom_check_callback = custom_check
|
||||
menu.anchor = 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.set_choices(choices, tooltips)
|
||||
menu.show_to(user)
|
||||
@@ -365,6 +384,9 @@ GLOBAL_LIST_EMPTY(radial_menus)
|
||||
/// 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
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
/atom/movable/screen/radial/persistent/center/Click(location, control, params)
|
||||
if(usr.client == parent.current_user)
|
||||
parent.element_chosen(null,usr)
|
||||
parent.element_chosen(null, usr, params)
|
||||
|
||||
/atom/movable/screen/radial/persistent/center/MouseEntered(location, control, params)
|
||||
. = ..()
|
||||
@@ -29,15 +29,17 @@
|
||||
close_button.set_parent(src)
|
||||
|
||||
|
||||
/datum/radial_menu/persistent/element_chosen(choice_id,mob/user)
|
||||
select_proc_callback.Invoke(choices_values[choice_id])
|
||||
/datum/radial_menu/persistent/element_chosen(choice_id, mob/user, params)
|
||||
select_proc_callback.Invoke(choices_values[choice_id], params)
|
||||
|
||||
|
||||
/datum/radial_menu/persistent/proc/change_choices(list/newchoices, tooltips)
|
||||
/datum/radial_menu/persistent/proc/change_choices(list/newchoices, tooltips = FALSE, animate = FALSE, keep_same_page = FALSE)
|
||||
if(!newchoices.len)
|
||||
return
|
||||
entry_animation = FALSE
|
||||
var/target_page = keep_same_page ? current_page : 1 //Stores the current_page value before it's set back to 1 on Reset()
|
||||
Reset()
|
||||
set_choices(newchoices,tooltips)
|
||||
set_choices(newchoices,tooltips, set_page = target_page)
|
||||
|
||||
/datum/radial_menu/persistent/Destroy()
|
||||
QDEL_NULL(select_proc_callback)
|
||||
@@ -53,7 +55,7 @@
|
||||
Select_proc is the proc to be called each time an element on the menu is clicked, and should accept the chosen element as its final argument
|
||||
Clicking the center button will return a choice of null
|
||||
*/
|
||||
/proc/show_radial_menu_persistent(mob/user, atom/anchor, list/choices, datum/callback/select_proc, uniqueid, radius, tooltips = FALSE)
|
||||
/proc/show_radial_menu_persistent(mob/user, atom/anchor, list/choices, datum/callback/select_proc, uniqueid, radius, tooltips = FALSE, radial_slice_icon = "radial_slice")
|
||||
if(!user || !anchor || !length(choices) || !select_proc)
|
||||
return
|
||||
if(!uniqueid)
|
||||
@@ -67,6 +69,7 @@
|
||||
GLOB.radial_menus[uniqueid] = menu
|
||||
if(radius)
|
||||
menu.radius = radius
|
||||
menu.radial_slice_icon = radial_slice_icon
|
||||
menu.select_proc_callback = select_proc
|
||||
menu.anchor = anchor
|
||||
menu.check_screen_border(user) //Do what's needed to make it look good near borders or on hud
|
||||
|
||||
Reference in New Issue
Block a user