From cb45bebdc357cbb16fac0748a7229d8c83dbfd22 Mon Sep 17 00:00:00 2001 From: CHOMPStation2 <58959929+CHOMPStation2@users.noreply.github.com> Date: Fri, 18 Oct 2024 12:20:38 -0700 Subject: [PATCH] [MIRROR] General improvements to Action Buttons (#9250) Co-authored-by: ShadowLarkens Co-authored-by: Kashargul --- code/__defines/_click.dm | 56 ++++++++ code/__defines/_helpers.dm | 15 ++ code/__defines/action.dm | 5 + code/__defines/misc.dm | 5 - code/_helpers/screen_objs.dm | 115 +++++++++++++++ code/_helpers/view.dm | 11 +- code/_onclick/hud/{ => action}/action.dm | 135 +++++++----------- .../hud/action/action_screen_objects.dm | 69 +++++++++ code/_onclick/hud/movable_screen_objects.dm | 40 +++--- code/_onclick/rig.dm | 28 ++-- code/modules/mob/living/living_defense.dm | 53 ------- icons/effects/mouse_pointers/screen_drag.dmi | Bin 0 -> 326 bytes vorestation.dme | 5 +- 13 files changed, 364 insertions(+), 173 deletions(-) create mode 100644 code/__defines/_click.dm create mode 100644 code/_helpers/screen_objs.dm rename code/_onclick/hud/{ => action}/action.dm (65%) create mode 100644 code/_onclick/hud/action/action_screen_objects.dm create mode 100644 icons/effects/mouse_pointers/screen_drag.dmi diff --git a/code/__defines/_click.dm b/code/__defines/_click.dm new file mode 100644 index 0000000000..3bc9c08734 --- /dev/null +++ b/code/__defines/_click.dm @@ -0,0 +1,56 @@ +//Defines file for byond click related parameters +//this is mostly for ease of use and for finding all the things that use say RIGHT_CLICK rather then just searching "right" + +//Mouse buttons held +#define RIGHT_CLICK "right" +#define MIDDLE_CLICK "middle" +#define LEFT_CLICK "left" + +///Mouse button that was just clicked/released +///if(modifiers[BUTTON] == LEFT_CLICK) +#define BUTTON "button" + +//Keys held down during the mouse action +#define CTRL_CLICK "ctrl" +#define ALT_CLICK "alt" +#define SHIFT_CLICK "shift" + +//Cells involved if using a Grid control +#define DRAG_CELL "drag-cell" +#define DROP_CELL "drop-cell" + +//The button used for dragging (only sent for unrelated mouse up/down messages during a drag) +#define DRAG "drag" + +//If the mouse is over a link in maptext, or this event is related to clicking such a link +#define LINK "link" + +//Pixel coordinates relative to the icon's position on screen +#define VIS_X "vis-x" +#define VIS_Y "vis-y" + +//Pixel coordinates within the icon, in the icon's coordinate space +#define ICON_X "icon-x" +#define ICON_Y "icon-y" + +//Pixel coordinates in screen_loc format ("[tile_x]:[pixel_x],[tile_y]:[pixel_y]") +#define SCREEN_LOC "screen-loc" + +//https://secure.byond.com/docs/ref/info.html#/atom/var/mouse_opacity +/// Objects will ignore being clicked on regardless of their transparency (used in parallax, lighting effects, holograms, lasers, etc.) +#define MOUSE_OPACITY_TRANSPARENT 0 +/// Objects will be clicked on if it is the topmost object and the pixel isn't transparent at the position of the mouse (default behavior for 99.99% of game objects) +#define MOUSE_OPACITY_ICON 1 +/// Objects will be always be clicked on regardless of pixel transparency or other objects at that location (used in space vines, storage containers) +#define MOUSE_OPACITY_OPAQUE 2 + +/// Whatever the base action datum thinks is best +#define SCRN_OBJ_DEFAULT "default" +/// Floating somewhere on the hud, not in any predefined place +#define SCRN_OBJ_FLOATING "floating" +/// In the list of buttons stored at the top of the screen +#define SCRN_OBJ_IN_LIST "list" +/// In the collapseable palette +#define SCRN_OBJ_IN_PALETTE "palette" +/// In cult spell list +#define SCRN_OBJ_CULT_LIST "cult_list" diff --git a/code/__defines/_helpers.dm b/code/__defines/_helpers.dm index 9d8a9d7ab7..aae3931cb6 100644 --- a/code/__defines/_helpers.dm +++ b/code/__defines/_helpers.dm @@ -1,2 +1,17 @@ /// Takes a datum as input, returns its ref string #define text_ref(datum) ref(datum) +// Stuff that is relatively "core" and is used in other defines/helpers + +/** + * The game's world.icon_size. \ + * Ideally divisible by 16. \ + * Ideally a number, but it + * can be a string ("32x32"), so more exotic coders + * will be sad if you use this in math. + */ +#define ICON_SIZE_ALL 32 +/// The X/Width dimension of ICON_SIZE. This will more than likely be the bigger axis. +#define ICON_SIZE_X 32 +/// The Y/Height dimension of ICON_SIZE. This will more than likely be the smaller axis. +#define ICON_SIZE_Y 32 +yy diff --git a/code/__defines/action.dm b/code/__defines/action.dm index bdbe228777..0c6b3cf89a 100644 --- a/code/__defines/action.dm +++ b/code/__defines/action.dm @@ -3,3 +3,8 @@ #define AB_CHECK_LYING 4 #define AB_CHECK_ALIVE 8 #define AB_CHECK_INSIDE 16 + +#define AB_ITEM 1 +#define AB_SPELL 2 +#define AB_INNATE 3 +#define AB_GENERIC 4 diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index b1e3c7cd60..f15d21292b 100644 --- a/code/__defines/misc.dm +++ b/code/__defines/misc.dm @@ -310,11 +310,6 @@ GLOBAL_LIST_EMPTY(##LIST_NAME);\ #define RAD_RESIST_CALC_DIV 0 // Each turf absorbs some fraction of the working radiation level #define RAD_RESIST_CALC_SUB 1 // Each turf absorbs a fixed amount of radiation -//https://secure.byond.com/docs/ref/info.html#/atom/var/mouse_opacity -#define MOUSE_OPACITY_TRANSPARENT 0 -#define MOUSE_OPACITY_ICON 1 -#define MOUSE_OPACITY_OPAQUE 2 - // Used by radios to indicate that they have sent a message via something other than subspace #define RADIO_CONNECTION_FAIL 0 #define RADIO_CONNECTION_NON_SUBSPACE 1 diff --git a/code/_helpers/screen_objs.dm b/code/_helpers/screen_objs.dm new file mode 100644 index 0000000000..00f6bd4157 --- /dev/null +++ b/code/_helpers/screen_objs.dm @@ -0,0 +1,115 @@ +/// Takes a screen loc string in the format +/// "+-left-offset:+-pixel,+-bottom-offset:+-pixel" +/// Where the :pixel is optional, and returns +/// A list in the format (x_offset, y_offset) +/// We require context to get info out of screen locs that contain relative info, so NORTH, SOUTH, etc +/proc/screen_loc_to_offset(screen_loc, view) + if(!screen_loc) + return list(64, 64) + var/list/view_size = view_to_pixels(view) + var/x = 0 + var/y = 0 + // Time to parse for directional relative offsets + if(findtext(screen_loc, "EAST")) // If you're starting from the east, we start from the east too + x += view_size[1] + if(findtext(screen_loc, "WEST")) // HHHHHHHHHHHHHHHHHHHHHH WEST is technically a 1 tile offset from the start. Shoot me please + x += ICON_SIZE_X + if(findtext(screen_loc, "NORTH")) + y += view_size[2] + if(findtext(screen_loc, "SOUTH")) + y += ICON_SIZE_Y + + var/list/x_and_y = splittext(screen_loc, ",") + + var/list/x_pack = splittext(x_and_y[1], ":") + var/list/y_pack = splittext(x_and_y[2], ":") + + var/x_coord = x_pack[1] + var/y_coord = y_pack[1] + + if (findtext(x_coord, "CENTER")) + x += view_size[1] / 2 + + if (findtext(y_coord, "CENTER")) + y += view_size[2] / 2 + + x_coord = text2num(cut_relative_direction(x_coord)) + y_coord = text2num(cut_relative_direction(y_coord)) + + x += x_coord * ICON_SIZE_X + y += y_coord * ICON_SIZE_Y + + if(length(x_pack) > 1) + x += text2num(x_pack[2]) + if(length(y_pack) > 1) + y += text2num(y_pack[2]) + return list(x, y) + +/// Takes a list in the form (x_offset, y_offset) +/// And converts it to a screen loc string +/// Accepts an optional view string/size to force the screen_loc around, so it can't go out of scope +/proc/offset_to_screen_loc(x_offset, y_offset, view = null) + if(view) + var/list/view_bounds = view_to_pixels(view) + x_offset = clamp(x_offset, ICON_SIZE_X, view_bounds[1]) + y_offset = clamp(y_offset, ICON_SIZE_Y, view_bounds[2]) + + // Round with no argument is floor, so we get the non pixel offset here + var/x = round(x_offset / ICON_SIZE_X) + var/pixel_x = x_offset % ICON_SIZE_X + var/y = round(y_offset / ICON_SIZE_Y) + var/pixel_y = y_offset % ICON_SIZE_Y + + var/list/generated_loc = list() + generated_loc += "[x]" + if(pixel_x) + generated_loc += ":[pixel_x]" + generated_loc += ",[y]" + if(pixel_y) + generated_loc += ":[pixel_y]" + return jointext(generated_loc, "") + +/** + * Returns a valid location to place a screen object without overflowing the viewport + * + * * target: The target location as a purely number based screen_loc string "+-left-offset:+-pixel,+-bottom-offset:+-pixel" + * * target_offset: The amount we want to offset the target location by. We explictly don't care about direction here, we will try all 4 + * * view: The view variable of the client we're doing this for. We use this to get the size of the screen + * + * Returns a screen loc representing the valid location +**/ +/proc/get_valid_screen_location(target_loc, target_offset, view) + var/list/offsets = screen_loc_to_offset(target_loc) + var/base_x = offsets[1] + var/base_y = offsets[2] + + var/list/view_size = view_to_pixels(view) + + // Bias to the right, down, left, and then finally up + if(base_x + target_offset < view_size[1]) + return offset_to_screen_loc(base_x + target_offset, base_y, view) + if(base_y - target_offset > ICON_SIZE_Y) + return offset_to_screen_loc(base_x, base_y - target_offset, view) + if(base_x - target_offset > ICON_SIZE_X) + return offset_to_screen_loc(base_x - target_offset, base_y, view) + if(base_y + target_offset < view_size[2]) + return offset_to_screen_loc(base_x, base_y + target_offset, view) + stack_trace("You passed in a scren location {[target_loc]} and offset {[target_offset]} that can't be fit in the viewport Width {[view_size[1]]}, Height {[view_size[2]]}. what did you do lad") + return null // The fuck did you do lad + +/// Takes a screen_loc string and cut out any directions like NORTH or SOUTH +/proc/cut_relative_direction(fragment) + var/static/regex/regex = regex(@"([A-Z])\w+", "g") + return regex.Replace(fragment, "") + +/// Returns a screen_loc format for a tiling screen objects from start and end positions. Start should be bottom left corner, and end top right corner. +/proc/spanning_screen_loc(start_px, start_py, end_px, end_py) + var/starting_tile_x = round(start_px / ICON_SIZE_X) + start_px -= starting_tile_x * ICON_SIZE_X + var/starting_tile_y = round(start_py/ ICON_SIZE_Y) + start_py -= starting_tile_y * ICON_SIZE_Y + var/ending_tile_x = round(end_px / ICON_SIZE_X) + end_px -= ending_tile_x * ICON_SIZE_X + var/ending_tile_y = round(end_py / ICON_SIZE_Y) + end_py -= ending_tile_y * ICON_SIZE_Y + return "[starting_tile_x]:[start_px],[starting_tile_y]:[start_py] to [ending_tile_x]:[end_px],[ending_tile_y]:[end_py]" diff --git a/code/_helpers/view.dm b/code/_helpers/view.dm index be60a56697..4615e0c97d 100644 --- a/code/_helpers/view.dm +++ b/code/_helpers/view.dm @@ -11,6 +11,15 @@ viewY = text2num(viewrangelist[2]) return list(viewX, viewY) +/// Takes a string or num view, and converts it to pixel width/height in a list(pixel_width, pixel_height) +/proc/view_to_pixels(view) + if(!view) + return list(0, 0) + var/list/view_info = getviewsize(view) + view_info[1] *= ICON_SIZE_X + view_info[2] *= ICON_SIZE_Y + return view_info + // Used to get `atom/O as obj|mob|turf in view()` to match against strings containing apostrophes immediately after substrings that match to other objects. Somehow. - Ater /proc/_validate_atom(atom/A) - return view() \ No newline at end of file + return view() diff --git a/code/_onclick/hud/action.dm b/code/_onclick/hud/action/action.dm similarity index 65% rename from code/_onclick/hud/action.dm rename to code/_onclick/hud/action/action.dm index 288c479922..d2b0902abb 100644 --- a/code/_onclick/hud/action.dm +++ b/code/_onclick/hud/action/action.dm @@ -1,8 +1,3 @@ -#define AB_ITEM 1 -#define AB_SPELL 2 -#define AB_INNATE 3 -#define AB_GENERIC 4 - /datum/action var/name = "Generic Action" @@ -108,79 +103,63 @@ /datum/action/proc/UpdateName() return name -/obj/screen/movable/action_button - var/datum/action/owner - screen_loc = "WEST,NORTH" - -/obj/screen/movable/action_button/Click(location,control,params) - var/list/modifiers = params2list(params) - if(modifiers["shift"]) - moved = 0 - return 1 - if(!usr.checkClickCooldown()) - return - owner.Trigger() - return 1 - -/obj/screen/movable/action_button/proc/UpdateIcon() - if(!owner) - return - icon = owner.button_icon - icon_state = owner.background_icon_state - - cut_overlays() - var/image/img - if(owner.action_type == AB_ITEM && owner.target) - var/obj/item/I = owner.target - img = image(I.icon, src , I.icon_state) - else if(owner.button_icon && owner.button_icon_state) - img = image(owner.button_icon,src,owner.button_icon_state) - img.pixel_x = 0 - img.pixel_y = 0 - add_overlay(img) - - if(!owner.IsAvailable()) - color = rgb(128,0,0,128) - else - color = rgb(255,255,255,255) - -//Hide/Show Action Buttons ... Button -/obj/screen/movable/action_button/hide_toggle - name = "Hide Buttons" - icon = 'icons/mob/actions.dmi' - icon_state = "bg_default" - var/hidden = 0 - -/obj/screen/movable/action_button/hide_toggle/Click() - usr.hud_used.action_buttons_hidden = !usr.hud_used.action_buttons_hidden - - hidden = usr.hud_used.action_buttons_hidden - if(hidden) - name = "Show Buttons" - else - name = "Hide Buttons" - UpdateIcon() - usr.update_action_buttons() - - -/obj/screen/movable/action_button/hide_toggle/proc/InitialiseIcon(var/mob/living/user) - if(isalien(user)) - icon_state = "bg_alien" - else - icon_state = "bg_default" - UpdateIcon() - return - -/obj/screen/movable/action_button/hide_toggle/UpdateIcon() - cut_overlays() - var/image/img = image(icon,src,hidden?"show":"hide") - add_overlay(img) - return - //This is the proc used to update all the action buttons. Properly defined in /mob/living/ /mob/proc/update_action_buttons() return +/mob/living/update_action_buttons() + if(!hud_used) return + if(!client) return + + if(hud_used.hud_shown != 1) //Hud toggled to minimal + return + + client.screen -= hud_used.hide_actions_toggle + for(var/datum/action/A in actions) + if(A.button) + client.screen -= A.button + + if(hud_used.action_buttons_hidden) + if(!hud_used.hide_actions_toggle) + hud_used.hide_actions_toggle = new(hud_used) + hud_used.hide_actions_toggle.UpdateIcon() + + if(!hud_used.hide_actions_toggle.moved) + hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(1) + //hud_used.SetButtonCoords(hud_used.hide_actions_toggle,1) + + client.screen += hud_used.hide_actions_toggle + return + + var/button_number = 0 + for(var/datum/action/A in actions) + button_number++ + if(A.button == null) + var/obj/screen/movable/action_button/N = new(hud_used) + N.owner = A + A.button = N + + var/obj/screen/movable/action_button/B = A.button + + B.UpdateIcon() + + B.name = A.UpdateName() + + client.screen += B + + if(!B.moved) + B.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number) + //hud_used.SetButtonCoords(B,button_number) + + if(button_number > 0) + if(!hud_used.hide_actions_toggle) + hud_used.hide_actions_toggle = new(hud_used) + hud_used.hide_actions_toggle.InitialiseIcon(src) + if(!hud_used.hide_actions_toggle.moved) + hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number+1) + //hud_used.SetButtonCoords(hud_used.hide_actions_toggle,button_number+1) + client.screen += hud_used.hide_actions_toggle + #define AB_WEST_OFFSET 4 #define AB_NORTH_OFFSET 26 #define AB_MAX_COLUMNS 10 @@ -218,11 +197,5 @@ #undef AB_NORTH_OFFSET #undef AB_MAX_COLUMNS - -/datum/action/innate/ +/datum/action/innate action_type = AB_INNATE - -#undef AB_ITEM -#undef AB_SPELL -#undef AB_INNATE -#undef AB_GENERIC diff --git a/code/_onclick/hud/action/action_screen_objects.dm b/code/_onclick/hud/action/action_screen_objects.dm new file mode 100644 index 0000000000..eb5242d0a2 --- /dev/null +++ b/code/_onclick/hud/action/action_screen_objects.dm @@ -0,0 +1,69 @@ + +/obj/screen/movable/action_button + var/datum/action/owner + screen_loc = "WEST,NORTH" + +/obj/screen/movable/action_button/Click(location,control,params) + var/list/modifiers = params2list(params) + if(modifiers["shift"]) + moved = FALSE + owner?.owner?.update_action_buttons() + return 1 + if(!usr.checkClickCooldown()) + return + owner.Trigger() + return 1 + +/obj/screen/movable/action_button/proc/UpdateIcon() + if(!owner) + return + icon = owner.button_icon + icon_state = owner.background_icon_state + + cut_overlays() + var/image/img + if(owner.action_type == AB_ITEM && owner.target) + var/obj/item/I = owner.target + img = image(I.icon, src , I.icon_state) + else if(owner.button_icon && owner.button_icon_state) + img = image(owner.button_icon,src,owner.button_icon_state) + img.pixel_x = 0 + img.pixel_y = 0 + add_overlay(img) + + if(!owner.IsAvailable()) + color = rgb(128,0,0,128) + else + color = rgb(255,255,255,255) + +//Hide/Show Action Buttons ... Button +/obj/screen/movable/action_button/hide_toggle + name = "Hide Buttons" + icon = 'icons/mob/actions.dmi' + icon_state = "bg_default" + var/hidden = 0 + +/obj/screen/movable/action_button/hide_toggle/Click() + usr.hud_used.action_buttons_hidden = !usr.hud_used.action_buttons_hidden + + hidden = usr.hud_used.action_buttons_hidden + if(hidden) + name = "Show Buttons" + else + name = "Hide Buttons" + UpdateIcon() + usr.update_action_buttons() + +/obj/screen/movable/action_button/hide_toggle/proc/InitialiseIcon(var/mob/living/user) + if(isalien(user)) + icon_state = "bg_alien" + else + icon_state = "bg_default" + UpdateIcon() + return + +/obj/screen/movable/action_button/hide_toggle/UpdateIcon() + cut_overlays() + var/image/img = image(icon,src,hidden?"show":"hide") + add_overlay(img) + return diff --git a/code/_onclick/hud/movable_screen_objects.dm b/code/_onclick/hud/movable_screen_objects.dm index 39d36738aa..d3d19857a7 100644 --- a/code/_onclick/hud/movable_screen_objects.dm +++ b/code/_onclick/hud/movable_screen_objects.dm @@ -9,9 +9,10 @@ //Not tied to the grid, places it's center where the cursor is /obj/screen/movable + mouse_drag_pointer = 'icons/effects/mouse_pointers/screen_drag.dmi' var/snap2grid = FALSE var/moved = FALSE - var/x_off = -16 + var/x_off = -16 var/y_off = -16 //Snap Screen Object @@ -22,30 +23,33 @@ /obj/screen/movable/MouseDrop(over_object, src_location, over_location, src_control, over_control, params) - var/list/PM = params2list(params) - - //No screen-loc information? abort. - if(!PM || !PM["screen-loc"]) + var/position = mouse_params_to_position(params) + if(!position) return - //Split screen-loc up into X+Pixel_X and Y+Pixel_Y - var/list/screen_loc_params = splittext(PM["screen-loc"], ",") + screen_loc = position + moved = TRUE - //Split X+Pixel_X up into list(X, Pixel_X) - var/list/screen_loc_X = splittext(screen_loc_params[1],":") - screen_loc_X[1] = encode_screen_X(text2num(screen_loc_X[1])) - //Split Y+Pixel_Y up into list(Y, Pixel_Y) - var/list/screen_loc_Y = splittext(screen_loc_params[2],":") - screen_loc_Y[1] = encode_screen_Y(text2num(screen_loc_Y[1])) +/// Takes mouse parmas as input, returns a string representing the appropriate mouse position +/obj/screen/movable/proc/mouse_params_to_position(params) + var/list/modifiers = params2list(params) + + //No screen-loc information? abort. + if(!LAZYACCESS(modifiers, SCREEN_LOC)) + return + + var/client/our_client = usr.client + var/list/offset = screen_loc_to_offset(LAZYACCESS(modifiers, SCREEN_LOC), our_client?.view) if(snap2grid) //Discard Pixel Values - screen_loc = "[screen_loc_X[1]],[screen_loc_Y[1]]" - + offset[1] = FLOOR(offset[1], ICON_SIZE_X) // drops any pixel offset + offset[2] = FLOOR(offset[2], ICON_SIZE_Y) // drops any pixel offset else //Normalise Pixel Values (So the object drops at the center of the mouse, not 16 pixels off) - var/pix_X = text2num(screen_loc_X[2]) + x_off - var/pix_Y = text2num(screen_loc_Y[2]) + y_off - screen_loc = "[screen_loc_X[1]]:[pix_X],[screen_loc_Y[1]]:[pix_Y]" + offset[1] += x_off + offset[2] += y_off + return offset_to_screen_loc(offset[1], offset[2], our_client?.view) +// Must stay for now, for subtypes /obj/screen/movable/proc/encode_screen_X(X) var/view_dist = world.view if(view_dist) diff --git a/code/_onclick/rig.dm b/code/_onclick/rig.dm index 0e60512939..d8a5da269b 100644 --- a/code/_onclick/rig.dm +++ b/code/_onclick/rig.dm @@ -1,11 +1,11 @@ -#define MIDDLE_CLICK 0 -#define ALT_CLICK 1 -#define CTRL_CLICK 2 +#define HARDSUIT_MIDDLE_CLICK 0 +#define HARDSUIT_ALT_CLICK 1 +#define HARDSUIT_CTRL_CLICK 2 #define MAX_HARDSUIT_CLICK_MODE 2 /client - var/hardsuit_click_mode = MIDDLE_CLICK + var/hardsuit_click_mode = HARDSUIT_MIDDLE_CLICK /client/verb/toggle_hardsuit_mode() set name = "Toggle Hardsuit Activation Mode" @@ -17,32 +17,32 @@ hardsuit_click_mode = 0 switch(hardsuit_click_mode) - if(MIDDLE_CLICK) + if(HARDSUIT_MIDDLE_CLICK) to_chat(src, "Hardsuit activation mode set to middle-click.") - if(ALT_CLICK) + if(HARDSUIT_ALT_CLICK) to_chat(src, "Hardsuit activation mode set to alt-click.") - if(CTRL_CLICK) + if(HARDSUIT_CTRL_CLICK) to_chat(src, "Hardsuit activation mode set to control-click.") else // should never get here, but just in case: soft_assert(0, "Bad hardsuit click mode: [hardsuit_click_mode] - expected 0 to [MAX_HARDSUIT_CLICK_MODE]") to_chat(src, "Somehow you bugged the system. Setting your hardsuit mode to middle-click.") - hardsuit_click_mode = MIDDLE_CLICK + hardsuit_click_mode = HARDSUIT_MIDDLE_CLICK /mob/living/MiddleClickOn(atom/A) - if(client && client.hardsuit_click_mode == MIDDLE_CLICK) + if(client && client.hardsuit_click_mode == HARDSUIT_MIDDLE_CLICK) if(HardsuitClickOn(A)) return ..() /mob/living/AltClickOn(atom/A) - if(client && client.hardsuit_click_mode == ALT_CLICK) + if(client && client.hardsuit_click_mode == HARDSUIT_ALT_CLICK) if(HardsuitClickOn(A)) return ..() /mob/living/CtrlClickOn(atom/A) - if(client && client.hardsuit_click_mode == CTRL_CLICK) + if(client && client.hardsuit_click_mode == HARDSUIT_CTRL_CLICK) if(HardsuitClickOn(A)) return ..() @@ -78,7 +78,7 @@ return 1 return 0 -#undef MIDDLE_CLICK -#undef ALT_CLICK -#undef CTRL_CLICK +#undef HARDSUIT_MIDDLE_CLICK +#undef HARDSUIT_ALT_CLICK +#undef HARDSUIT_CTRL_CLICK #undef MAX_HARDSUIT_CLICK_MODE diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm index fe3b7749cc..9f365a02bb 100644 --- a/code/modules/mob/living/living_defense.dm +++ b/code/modules/mob/living/living_defense.dm @@ -546,59 +546,6 @@ I.action.Grant(src) return -/mob/living/update_action_buttons() - if(!hud_used) return - if(!client) return - - if(hud_used.hud_shown != 1) //Hud toggled to minimal - return - - client.screen -= hud_used.hide_actions_toggle - for(var/datum/action/A in actions) - if(A.button) - client.screen -= A.button - - if(hud_used.action_buttons_hidden) - if(!hud_used.hide_actions_toggle) - hud_used.hide_actions_toggle = new(hud_used) - hud_used.hide_actions_toggle.UpdateIcon() - - if(!hud_used.hide_actions_toggle.moved) - hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(1) - //hud_used.SetButtonCoords(hud_used.hide_actions_toggle,1) - - client.screen += hud_used.hide_actions_toggle - return - - var/button_number = 0 - for(var/datum/action/A in actions) - button_number++ - if(A.button == null) - var/obj/screen/movable/action_button/N = new(hud_used) - N.owner = A - A.button = N - - var/obj/screen/movable/action_button/B = A.button - - B.UpdateIcon() - - B.name = A.UpdateName() - - client.screen += B - - if(!B.moved) - B.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number) - //hud_used.SetButtonCoords(B,button_number) - - if(button_number > 0) - if(!hud_used.hide_actions_toggle) - hud_used.hide_actions_toggle = new(hud_used) - hud_used.hide_actions_toggle.InitialiseIcon(src) - if(!hud_used.hide_actions_toggle.moved) - hud_used.hide_actions_toggle.screen_loc = hud_used.ButtonNumberToScreenCoords(button_number+1) - //hud_used.SetButtonCoords(hud_used.hide_actions_toggle,button_number+1) - client.screen += hud_used.hide_actions_toggle - // Returns a number to determine if something is harder or easier to hit than normal. /mob/living/proc/get_evasion() var/result = evasion // First we get the 'base' evasion. Generally this is zero. diff --git a/icons/effects/mouse_pointers/screen_drag.dmi b/icons/effects/mouse_pointers/screen_drag.dmi new file mode 100644 index 0000000000000000000000000000000000000000..48e4fce85f7a47f6dbf35267945d64b0cf05a50c GIT binary patch literal 326 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=nN=YXB`&GO$wiq3C7Jno3=9=> zRF4~SH7H21UAXyQM1Gfh6ZaN# Y>3t^de`FVdQ&MBb@0DpvZ?EnA( literal 0 HcmV?d00001 diff --git a/vorestation.dme b/vorestation.dme index 88016dedce..b08a5ffde3 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -23,6 +23,7 @@ #include "code\names.dm" #include "code\world.dm" #include "code\__defines\__globals.dm" +#include "code\__defines\_click.dm" #include "code\__defines\_compile_options.dm" #include "code\__defines\_helpers.dm" #include "code\__defines\_lists.dm" @@ -220,6 +221,7 @@ #include "code\_helpers\names.dm" #include "code\_helpers\priority_queue_ch.dm" #include "code\_helpers\sanitize_values.dm" +#include "code\_helpers\screen_objs.dm" #include "code\_helpers\shell.dm" #include "code\_helpers\storage.dm" #include "code\_helpers\string_lists.dm" @@ -259,7 +261,6 @@ #include "code\_onclick\hud\_defines.dm" #include "code\_onclick\hud\_defines_vr.dm" #include "code\_onclick\hud\ability_screen_objects.dm" -#include "code\_onclick\hud\action.dm" #include "code\_onclick\hud\ai.dm" #include "code\_onclick\hud\alert.dm" #include "code\_onclick\hud\alert_vr.dm" @@ -287,6 +288,8 @@ #include "code\_onclick\hud\skybox.dm" #include "code\_onclick\hud\soulcatcher_guest.dm" #include "code\_onclick\hud\spell_screen_objects.dm" +#include "code\_onclick\hud\action\action.dm" +#include "code\_onclick\hud\action\action_screen_objects.dm" #include "code\ATMOSPHERICS\_atmos_setup.dm" #include "code\ATMOSPHERICS\_atmospherics_helpers.dm" #include "code\ATMOSPHERICS\atmospherics.dm"