Files
TiviPlus 78bc9dba91 Keyboard presses (and thus keybindings) will now report the turf the mouse was over when a player presses or releases a key (#90480)
## About The Pull Request

Semi WIP cus I need to probably make an issue report for lummox, but
apart from that ready for review

Uses the new mouse-pos so we can combine it with screen size and size to
estimate very accurately the mouse position in turf terms. In future
also will need to add a way to continously poll the users mouse pos but
this alone is very useful

## Why It's Good For The Game

This isnt used yet, but the benefits are pretty damn obvious (hitting E
and dashing towards where your mouse??? 1990s features?????)

## Changelog
🆑
refactor: Added the possibility for keybindings to report the turf they
clicked on.
/🆑

---------

Co-authored-by: TiviPlus <572233640+TiviPlus@users.noreply.com>
2025-05-22 21:17:28 -04:00

86 lines
2.2 KiB
Plaintext

/datum/keybinding/robot
category = CATEGORY_ROBOT
weight = WEIGHT_ROBOT
/datum/keybinding/robot/can_use(client/user)
return iscyborg(user.mob)
/datum/keybinding/robot/moduleone
hotkey_keys = list("1")
name = "module_one"
full_name = "Toggle module 1"
description = "Equips or unequips the first module"
keybind_signal = COMSIG_KB_SILICON_TOGGLEMODULEONE_DOWN
/datum/keybinding/robot/moduleone/down(client/user, turf/target)
. = ..()
if(.)
return
var/mob/living/silicon/robot/R = user.mob
R.toggle_module(1)
return TRUE
/datum/keybinding/robot/moduletwo
hotkey_keys = list("2")
name = "module_two"
full_name = "Toggle module 2"
description = "Equips or unequips the second module"
keybind_signal = COMSIG_KB_SILICON_TOGGLEMODULETWO_DOWN
/datum/keybinding/robot/moduletwo/down(client/user, turf/target)
. = ..()
if(.)
return
var/mob/living/silicon/robot/R = user.mob
R.toggle_module(2)
return TRUE
/datum/keybinding/robot/modulethree
hotkey_keys = list("3")
name = "module_three"
full_name = "Toggle module 3"
description = "Equips or unequips the third module"
keybind_signal = COMSIG_KB_SILICON_TOGGLEMODULETHREE_DOWN
/datum/keybinding/robot/modulethree/down(client/user, turf/target)
. = ..()
if(.)
return
var/mob/living/silicon/robot/R = user.mob
R.toggle_module(3)
return TRUE
/datum/keybinding/robot/unequip_module
hotkey_keys = list("Q")
name = "unequip_module"
full_name = "Unequip module"
description = "Unequips the active module"
keybind_signal = COMSIG_KB_SILICON_UNEQUIPMODULE_DOWN
/datum/keybinding/robot/unequip_module/down(client/user, turf/target)
. = ..()
if(.)
return
var/mob/living/silicon/robot/R = user.mob
R.uneq_active()
return TRUE
/datum/keybinding/robot/undeploy
category = CATEGORY_AI
hotkey_keys = list("=")
name = "undeploy"
full_name = "Disconnect from shell"
description = "Returns you to your AI core"
keybind_signal = COMSIG_KB_SILION_UNDEPLOY_DOWN
/datum/keybinding/robot/undeploy/down(client/user, turf/target)
. = ..()
if(.)
return
var/mob/living/silicon/robot/shell/our_shell = user.mob
//We make sure our shell is actually a shell
if(our_shell.shell == FALSE)
return
our_shell.undeploy()
return TRUE