Adds cult action bar (#26052)

* cult actions list

* moved blood spear a little to the side

* pixel offset

* Update code/__DEFINES/action_button_defines.dm

Co-authored-by: Spaghetti-bit <yumyumkillkill@gmail.com>
Signed-off-by: HMBGERDO <61080616+HMBGERDO@users.noreply.github.com>

* review

* eh, why not

---------

Signed-off-by: HMBGERDO <61080616+HMBGERDO@users.noreply.github.com>
Co-authored-by: Spaghetti-bit <yumyumkillkill@gmail.com>
This commit is contained in:
HMBGERDO
2024-07-01 23:14:45 +00:00
committed by GitHub
co-authored by Spaghetti-bit
parent f64932f1f3
commit bc303a85bd
8 changed files with 36 additions and 30 deletions
+11
View File
@@ -508,6 +508,8 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
listed_actions.insert_action(button)
if(SCRN_OBJ_IN_PALETTE)
palette_actions.insert_action(button)
if(SCRN_OBJ_CULT_LIST)
cult_actions.insert_action(button)
else // If we don't have it as a define, this is a screen_loc, and we should be floating
floating_actions += button
button.screen_loc = position
@@ -523,6 +525,8 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
listed_actions.insert_action(button, listed_actions.index_of(relative_to))
if(SCRN_OBJ_IN_PALETTE)
palette_actions.insert_action(button, palette_actions.index_of(relative_to))
if(SCRN_OBJ_CULT_LIST)
cult_actions.insert_action(button, cult_actions.index_of(relative_to))
if(SCRN_OBJ_FLOATING) // If we don't have it as a define, this is a screen_loc, and we should be floating
floating_actions += button
var/client/our_client = mymob.client
@@ -543,6 +547,8 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
floating_actions -= button
if(SCRN_OBJ_IN_LIST)
listed_actions.remove_action(button)
if(SCRN_OBJ_CULT_LIST)
cult_actions.remove_action(button)
if(SCRN_OBJ_IN_PALETTE)
palette_actions.remove_action(button)
button.screen_loc = null
@@ -551,11 +557,13 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
/datum/hud/proc/generate_landings(atom/movable/screen/movable/action_button/button)
listed_actions.generate_landing()
palette_actions.generate_landing()
cult_actions.generate_landing()
/// Clears all currently visible landings
/datum/hud/proc/hide_landings()
listed_actions.clear_landing()
palette_actions.clear_landing()
cult_actions.clear_landing()
// Updates any existing "owned" visuals, ensures they continue to be visible
/datum/hud/proc/update_our_owner()
@@ -563,6 +571,7 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
palette_down.refresh_owner()
palette_up.refresh_owner()
listed_actions.update_landing()
cult_actions.update_landing()
palette_actions.update_landing()
/// Ensures all of our buttons are properly within the bounds of our client's view, moves them if they're not
@@ -570,6 +579,7 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
var/our_view = mymob?.client?.view
if(!our_view)
return
cult_actions.check_against_view()
listed_actions.check_against_view()
palette_actions.check_against_view()
for(var/atom/movable/screen/movable/action_button/floating_button as anything in floating_actions)
@@ -579,6 +589,7 @@ GLOBAL_LIST_INIT(palette_removed_matrix, list(1.4,0,0,0, 0.7,0.4,0,0, 0.4,0,0.6,
/// Generates and fills new action groups with our mob's current actions
/datum/hud/proc/build_action_groups()
cult_actions = new(src)
listed_actions = new(src)
palette_actions = new(src)
floating_actions = list()
+15 -3
View File
@@ -5,6 +5,8 @@
var/list/atom/movable/screen/movable/action_button/actions
/// The initial vertical offset of our action buttons
var/north_offset = 0
/// The initial horizontal offset of our action buttons
var/west_offset = 0
/// The pixel vertical offset of our action buttons
var/pixel_north_offset = 0
/// The pixel horizontal offset of our action buttons
@@ -88,10 +90,10 @@
var/visual_row = row + north_offset
var/coord_row = visual_row ? "-[visual_row]" : "+0"
var/visual_column = number % column_max
var/visual_column = west_offset + number % column_max
var/coord_col = "+[visual_column]"
var/coord_col_offset = 4 + 2 * (visual_column + 1)
var/coord_row_offset = pixel_north_offset + 2 * (1 * visual_row)
var/coord_col_offset = pixel_horiz_offset + 2 * (number % column_max + 1)
var/coord_row_offset = pixel_north_offset + 2 * (1 * row)
return "WEST[coord_col]:[coord_col_offset],NORTH[coord_row]:-[coord_row_offset]"
/datum/action_group/proc/check_against_view()
@@ -214,6 +216,7 @@
/datum/action_group/listed
pixel_horiz_offset = 4
pixel_north_offset = 6
column_max = 10
location = SCRN_OBJ_IN_LIST
@@ -221,3 +224,12 @@
/datum/action_group/listed/refresh_actions()
. = ..()
owner?.palette_actions.refresh_actions() // We effect them, so we gotta refresh em
/datum/action_group/listed/cult
north_offset = 11
pixel_north_offset = 2
west_offset = 6
pixel_horiz_offset = -29
column_max = 4
location = SCRN_OBJ_CULT_LIST
max_rows = 2
+4
View File
@@ -39,6 +39,8 @@
var/atom/movable/screen/palette_scroll/up/palette_up
/// the groups of actions, such as palette (previously normal) actions
var/datum/action_group/palette/palette_actions
/// action group for cult spell actions
var/datum/action_group/listed/cult/cult_actions
/// action group for expanded actions, the normal action set
var/datum/action_group/listed/listed_actions
/// A list of action buttons which aren't owned by any action group, and are just floating somewhere on the hud.
@@ -77,6 +79,7 @@
var/list/all_action_buttons = list()
all_action_buttons += palette_actions.actions
all_action_buttons += listed_actions.actions
all_action_buttons += cult_actions.actions
return all_action_buttons
/datum/hud/New(mob/owner)
@@ -110,6 +113,7 @@
QDEL_NULL(palette_up)
QDEL_NULL(palette_actions)
QDEL_NULL(listed_actions)
QDEL_NULL(cult_actions)
QDEL_LIST_CONTENTS(floating_actions)
QDEL_NULL(module_store_icon)