Files
Bubberstation/code/datums/keybinding/_keybindings.dm
TiviPlus d53fb89b86 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-16 22:03:01 -07:00

30 lines
820 B
Plaintext

/datum/keybinding
var/list/hotkey_keys
var/list/classic_keys
var/name
var/full_name
var/description = ""
var/category = CATEGORY_MISC
var/weight = WEIGHT_LOWEST
var/keybind_signal
/datum/keybinding/New()
if(!keybind_signal)
CRASH("Keybind [src] called unredefined down() without a keybind_signal.")
// Default keys to the master "hotkey_keys"
if(LAZYLEN(hotkey_keys) && !LAZYLEN(classic_keys))
classic_keys = hotkey_keys.Copy()
/datum/keybinding/proc/down(client/user, turf/target)
SHOULD_CALL_PARENT(TRUE)
return SEND_SIGNAL(user.mob, keybind_signal, target) & COMSIG_KB_ACTIVATED
/datum/keybinding/proc/up(client/user, turf/target)
SHOULD_CALL_PARENT(TRUE)
SEND_SIGNAL(user.mob, DEACTIVATE_KEYBIND(keybind_signal), target)
return FALSE
/datum/keybinding/proc/can_use(client/user)
return TRUE