Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds keybinds for pixel shifting items #7029

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions code/__DEFINES/keybinding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
92 changes: 92 additions & 0 deletions code/datums/keybinding/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading