diff --git a/code/__DEFINES/keybinding.dm b/code/__DEFINES/keybinding.dm index 4b8fd9bd58b3..5b039ecf2140 100644 --- a/code/__DEFINES/keybinding.dm +++ b/code/__DEFINES/keybinding.dm @@ -48,15 +48,15 @@ #define COMSIG_KB_HUMAN_ISSUE_ORDER_MOVE "keybinding_human_issue_order_move" #define COMSIG_KB_HUMAN_ISSUE_ORDER_HOLD "keybinding_human_issue_order_hold" #define COMSIG_KB_HUMAN_ISSUE_ORDER_FOCUS "keybinding_human_issue_order_focus" - #define COMSIG_KB_HUMAN_SPECIALIST_ACTIVATION_ONE "keybinding_human_specialist_activation_one" #define COMSIG_KB_HUMAN_SPECIALIST_ACTIVATION_TWO "keybinding_human_specialist_activation_two" - #define COMSIG_KB_HUMAN_ROTATE_CHAIR "keybinding_human_rotate_chair" - #define COMSIG_KB_HUMAN_SHOW_HELD_ITEM "keybinding_human_show_held_item" - #define COMSIG_KB_HUMAN_CYCLE_HELMET_HUD "keybinding_human_cycle_helmet_hud" +#define COMSIG_KB_HUMAN_PIXEL_SHIFT_GRABBED_NORTH "keybinding_human_pixel_shift_grabbed_north" +#define COMSIG_KB_HUMAN_PIXEL_SHIFT_GRABBED_SOUTH "keybinding_human_pixel_shift_grabbed_south" +#define COMSIG_KB_HUMAN_PIXEL_SHIFT_GRABBED_EAST "keybinding_human_pixel_shift_grabbed_east" +#define COMSIG_KB_HUMAN_PIXEL_SHIFT_GRABBED_WEST "keybinding_human_pixel_shift_grabbed_west" // Human Inventory Navigation #define COMSIG_KB_HUMAN_INTERACT_OTHER_HAND "keybinding_human_interact_other_hand" diff --git a/code/datums/keybinding/human.dm b/code/datums/keybinding/human.dm index 810ee828880b..202811b6b6a6 100644 --- a/code/datums/keybinding/human.dm +++ b/code/datums/keybinding/human.dm @@ -135,3 +135,95 @@ cycle_action?.set_action_overlay(cycled_hud) return TRUE + +/datum/keybinding/human/pixel_shift + hotkey_keys = list("Unbound") + classic_keys = list("Unbound") + +/datum/keybinding/human/pixel_shift/can_use(client/user) + . = ..() + if(!.) + return + + var/mob/living/carbon/human/human_user = user.mob + var/obj/item/grab/grab = human_user.get_active_hand() + if(!istype(grab)) + return FALSE + var/obj/grabbed_atom = grab.grabbed_thing + if(ishuman(grabbed_atom)) + return FALSE + if(grabbed_atom.anchored) + return FALSE + return TRUE + +/datum/keybinding/human/pixel_shift/north + name = "pixel_shift_grabbed_north" + full_name = "Pixel Shift Grabbed - North" + keybind_signal = COMSIG_KB_HUMAN_PIXEL_SHIFT_GRABBED_NORTH + +/datum/keybinding/human/pixel_shift/north/down(client/user) + . = ..() + if(.) + return + var/mob/living/carbon/human/human_user = user.mob + var/obj/item/grab/grab = human_user.get_active_hand() + var/obj/grabbed = grab.grabbed_thing + + if(grabbed.pixel_y >= 16) + return + grabbed.pixel_y += 1 + return TRUE + +/datum/keybinding/human/pixel_shift/south + name = "pixel_shift_grabbed_south" + full_name = "Pixel Shift Grabbed - South" + keybind_signal = COMSIG_KB_HUMAN_PIXEL_SHIFT_GRABBED_SOUTH + +/datum/keybinding/human/pixel_shift/south/down(client/user) + . = ..() + if(.) + return + var/mob/living/carbon/human/human_user = user.mob + var/obj/item/grab/grab = human_user.get_active_hand() + var/obj/grabbed = grab.grabbed_thing + + if(grabbed.pixel_y <= -16) + return + grabbed.pixel_y -= 1 + return TRUE + +/datum/keybinding/human/pixel_shift/east + name = "pixel_shift_grabbed_east" + full_name = "Pixel Shift Grabbed - East" + keybind_signal = COMSIG_KB_HUMAN_PIXEL_SHIFT_GRABBED_EAST + +/datum/keybinding/human/pixel_shift/east/down(client/user) + . = ..() + if(.) + return + var/mob/living/carbon/human/human_user = user.mob + var/obj/item/grab/grab = human_user.get_active_hand() + var/obj/grabbed = grab.grabbed_thing + + if(grabbed.pixel_x >= 16) + return + grabbed.pixel_x += 1 + return TRUE + +/datum/keybinding/human/pixel_shift/west + name = "pixel_shift_grabbed_west" + full_name = "Pixel Shift Grabbed - West" + keybind_signal = COMSIG_KB_HUMAN_PIXEL_SHIFT_GRABBED_WEST + +/datum/keybinding/human/pixel_shift/west/down(client/user) + . = ..() + if(.) + return + var/mob/living/carbon/human/human_user = user.mob + var/obj/item/grab/grab = human_user.get_active_hand() + var/obj/grabbed = grab.grabbed_thing + + if(grabbed.pixel_x <= -16) + return + grabbed.pixel_x -= 1 + return TRUE