Adds a keybind for 'precise' dropping (like SS14) (#93790)

## About The Pull Request


https://github.com/user-attachments/assets/531f1456-72a1-4215-ae9e-4f4bf143b8c5

<img width="429" height="93" alt="image"
src="https://github.com/user-attachments/assets/1440fb60-a6b8-46c3-9bee-5a30017e2265"
/>

## Why It's Good For The Game

There's been SS14 players moving to SS13 and finding dropping in 14 is
better, which I kinda agree as it allows you to be more precise with x/y
dropping.

## Changelog

🆑
qol: There's a keybind (default is Ctrl+X, rebindable) for the drop
hotkey to drop where your mouse is (similar to SS14).
/🆑
This commit is contained in:
John Willard
2025-11-18 17:39:20 -07:00
committed by GitHub
parent be95c994ac
commit 2ef5704c30
13 changed files with 81 additions and 56 deletions
+1 -1
View File
@@ -16,7 +16,7 @@
if(LAZYLEN(hotkey_keys) && !LAZYLEN(classic_keys))
classic_keys = hotkey_keys.Copy()
/datum/keybinding/proc/down(client/user, turf/target)
/datum/keybinding/proc/down(client/user, turf/target, mousepos_x, mousepos_y)
SHOULD_CALL_PARENT(TRUE)
return SEND_SIGNAL(user.mob, keybind_signal, target) & COMSIG_KB_ACTIVATED
+9 -9
View File
@@ -19,7 +19,7 @@
description = "Go ghost"
keybind_signal = COMSIG_KB_ADMIN_AGHOST_DOWN
/datum/keybinding/admin/admin_ghost/down(client/user, turf/target)
/datum/keybinding/admin/admin_ghost/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -33,7 +33,7 @@
description = "Opens up the new player panel"
keybind_signal = COMSIG_KB_ADMIN_PLAYERPANELNEW_DOWN
/datum/keybinding/admin/player_panel_new/down(client/user, turf/target)
/datum/keybinding/admin/player_panel_new/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -47,7 +47,7 @@
description = "Toggles buildmode"
keybind_signal = COMSIG_KB_ADMIN_TOGGLEBUILDMODE_DOWN
/datum/keybinding/admin/toggle_buildmode_self/down(client/user, turf/target)
/datum/keybinding/admin/toggle_buildmode_self/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -61,7 +61,7 @@
description = "Enters stealth mode"
keybind_signal = COMSIG_KB_ADMIN_STEALTHMODETOGGLE_DOWN
/datum/keybinding/admin/stealthmode/down(client/user, turf/target)
/datum/keybinding/admin/stealthmode/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -75,7 +75,7 @@
description = "Toggles ghost-like invisibility (Don't abuse this)"
keybind_signal = COMSIG_KB_ADMIN_INVISIMINTOGGLE_DOWN
/datum/keybinding/admin/invisimin/down(client/user, turf/target)
/datum/keybinding/admin/invisimin/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -89,7 +89,7 @@
description = "Allows you to send a message to dead chat"
keybind_signal = COMSIG_KB_ADMIN_DSAY_DOWN
/datum/keybinding/admin/deadsay/down(client/user, turf/target)
/datum/keybinding/admin/deadsay/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -103,7 +103,7 @@
description = "Shed your admin powers"
keybind_signal = COMSIG_KB_ADMIN_DEADMIN_DOWN
/datum/keybinding/admin/deadmin/down(client/user, turf/target)
/datum/keybinding/admin/deadmin/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -117,7 +117,7 @@
description = "Regain your admin powers"
keybind_signal = COMSIG_KB_ADMIN_READMIN_DOWN
/datum/keybinding/admin/readmin/down(client/user, turf/target)
/datum/keybinding/admin/readmin/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -131,7 +131,7 @@
description = "Open the View-Tags menu"
keybind_signal = COMSIG_KB_ADMIN_VIEWTAGS_DOWN
/datum/keybinding/admin/view_tags/down(client/user, turf/target)
/datum/keybinding/admin/view_tags/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -12,7 +12,7 @@
description = "Reconnects you to your most recently used AI shell"
keybind_signal = COMSIG_KB_SILICON_RECONNECT_DOWN
/datum/keybinding/artificial_intelligence/reconnect/down(client/user, turf/target)
/datum/keybinding/artificial_intelligence/reconnect/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
+5 -5
View File
@@ -10,7 +10,7 @@
description = "Ask an admin for help."
keybind_signal = COMSIG_KB_CLIENT_GETHELP_DOWN
/datum/keybinding/client/admin_help/down(client/user, turf/target)
/datum/keybinding/client/admin_help/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -25,7 +25,7 @@
description = "Take a screenshot."
keybind_signal = COMSIG_KB_CLIENT_SCREENSHOT_DOWN
/datum/keybinding/client/screenshot/down(client/user, turf/target)
/datum/keybinding/client/screenshot/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -39,7 +39,7 @@
description = "Makes the game window fullscreen."
keybind_signal = COMSIG_KB_CLIENT_FULLSCREEN_DOWN
/datum/keybinding/client/toggle_fullscreen/down(client/user, turf/target)
/datum/keybinding/client/toggle_fullscreen/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -53,7 +53,7 @@
description = "Hide most HUD features"
keybind_signal = COMSIG_KB_CLIENT_MINIMALHUD_DOWN
/datum/keybinding/client/minimal_hud/down(client/user, turf/target)
/datum/keybinding/client/minimal_hud/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -67,7 +67,7 @@
description = "Closes all UI windows you have open."
keybind_signal = COMSIG_KB_CLIENT_CLOSEUI_DOWN
/datum/keybinding/client/close_every_ui/down(client/user, turf/target)
/datum/keybinding/client/close_every_ui/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
+4 -4
View File
@@ -7,7 +7,7 @@
full_name = "IC Say"
keybind_signal = COMSIG_KB_CLIENT_SAY_DOWN
/datum/keybinding/client/communication/say/down(client/user, turf/target)
/datum/keybinding/client/communication/say/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -21,7 +21,7 @@
full_name = "IC Radio (;)"
keybind_signal = COMSIG_KB_CLIENT_RADIO_DOWN
/datum/keybinding/client/communication/radio/down(client/user, turf/target)
/datum/keybinding/client/communication/radio/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -35,7 +35,7 @@
full_name = "Out Of Character Say (OOC)"
keybind_signal = COMSIG_KB_CLIENT_OOC_DOWN
/datum/keybinding/client/communication/ooc/down(client/user, turf/target)
/datum/keybinding/client/communication/ooc/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -49,7 +49,7 @@
full_name = "Custom Emote (/Me)"
keybind_signal = COMSIG_KB_CLIENT_ME_DOWN
/datum/keybinding/client/communication/me/down(client/user, turf/target)
/datum/keybinding/client/communication/me/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
+1 -1
View File
@@ -11,7 +11,7 @@
name = initial(faketype.key)
full_name = capitalize(initial(faketype.key))
/datum/keybinding/emote/down(client/user, turf/target)
/datum/keybinding/emote/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
+2 -2
View File
@@ -12,7 +12,7 @@
description = "Quickly puts an item in the best slot available"
keybind_signal = COMSIG_KB_HUMAN_QUICKEQUIP_DOWN
/datum/keybinding/human/quick_equip/down(client/user, turf/target)
/datum/keybinding/human/quick_equip/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -31,7 +31,7 @@
var/slot_item_name = "belt"
keybind_signal = COMSIG_KB_HUMAN_QUICKEQUIPBELT_DOWN
/datum/keybinding/human/quick_equip_belt/down(client/user, turf/target)
/datum/keybinding/human/quick_equip_belt/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
+11 -11
View File
@@ -12,7 +12,7 @@
description = "Break free of your current state. Handcuffed? on fire? Resist!"
keybind_signal = COMSIG_KB_LIVING_RESIST_DOWN
/datum/keybinding/living/resist/down(client/user, turf/target)
/datum/keybinding/living/resist/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -37,7 +37,7 @@
description = "Look up at the next z-level. Only works if directly below open space."
keybind_signal = COMSIG_KB_LIVING_LOOKUP_DOWN
/datum/keybinding/living/look_up/down(client/user, turf/target)
/datum/keybinding/living/look_up/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -58,7 +58,7 @@
description = "Look down at the previous z-level. Only works if directly above open space."
keybind_signal = COMSIG_KB_LIVING_LOOKDOWN_DOWN
/datum/keybinding/living/look_down/down(client/user, turf/target)
/datum/keybinding/living/look_down/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -79,7 +79,7 @@
description = "Lay down, or get up."
keybind_signal = COMSIG_KB_LIVING_REST_DOWN
/datum/keybinding/living/rest/down(client/user, turf/target)
/datum/keybinding/living/rest/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -95,7 +95,7 @@
keybind_signal = COMSIG_KB_LIVING_TOGGLE_COMBAT_DOWN
/datum/keybinding/living/toggle_combat_mode/down(client/user, turf/target)
/datum/keybinding/living/toggle_combat_mode/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -109,7 +109,7 @@
description = "Enable combat mode."
keybind_signal = COMSIG_KB_LIVING_ENABLE_COMBAT_DOWN
/datum/keybinding/living/enable_combat_mode/down(client/user, turf/target)
/datum/keybinding/living/enable_combat_mode/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -123,7 +123,7 @@
description = "Disable combat mode."
keybind_signal = COMSIG_KB_LIVING_DISABLE_COMBAT_DOWN
/datum/keybinding/living/disable_combat_mode/down(client/user, turf/target)
/datum/keybinding/living/disable_combat_mode/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -137,7 +137,7 @@
description = "Held down to cycle to the other move intent, release to cycle back"
keybind_signal = COMSIG_KB_LIVING_TOGGLEMOVEINTENT_DOWN
/datum/keybinding/living/toggle_move_intent/down(client/user, turf/target)
/datum/keybinding/living/toggle_move_intent/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -158,7 +158,7 @@
description = "Pressing this cycle to the opposite move intent, does not cycle back"
keybind_signal = COMSIG_KB_LIVING_TOGGLEMOVEINTENTALT_DOWN
/datum/keybinding/living/toggle_move_intent_alternative/down(client/user, turf/target)
/datum/keybinding/living/toggle_move_intent_alternative/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -188,7 +188,7 @@
description = "Hold this to turn on throw mode, and release it to turn off throw mode"
keybind_signal = COMSIG_KB_LIVING_HOLDTHROWMODE_DOWN
/datum/keybinding/living/hold_throw_mode/down(client/user, turf/target)
/datum/keybinding/living/hold_throw_mode/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -219,7 +219,7 @@
return FALSE
return TRUE
/datum/keybinding/living/give/down(client/user, turf/target)
/datum/keybinding/living/give/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
+38 -13
View File
@@ -9,7 +9,7 @@
description = ""
keybind_signal = COMSIG_KB_MOB_STOPPULLING_DOWN
/datum/keybinding/mob/stop_pulling/down(client/user, turf/target)
/datum/keybinding/mob/stop_pulling/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -27,7 +27,7 @@
description = ""
keybind_signal = COMSIG_KB_MOB_SWAPHANDS_DOWN
/datum/keybinding/mob/swap_hands/down(client/user, turf/target)
/datum/keybinding/mob/swap_hands/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -52,7 +52,7 @@
keybind_signal = COMSIG_KB_MOB_SELECTLEFTHAND_DOWN
hand_index = LEFT_HANDS
/datum/keybinding/mob/select_hand/down(client/user, turf/target)
/datum/keybinding/mob/select_hand/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -72,7 +72,7 @@
description = "Uses whatever item you have inhand"
keybind_signal = COMSIG_KB_MOB_ACTIVATEINHAND_DOWN
/datum/keybinding/mob/activate_inhand/down(client/user, turf/target)
/datum/keybinding/mob/activate_inhand/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -84,24 +84,49 @@
hotkey_keys = list("X")
name = "drop_item"
full_name = "Drop Item"
description = ""
description = "Drops the item in your active hand to the ground."
keybind_signal = COMSIG_KB_MOB_DROPITEM_DOWN
/datum/keybinding/mob/drop_item/down(client/user, turf/target)
/datum/keybinding/mob/drop_item/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
if(iscyborg(user.mob)) //cyborgs can't drop items
return FALSE
var/mob/M = user.mob
var/obj/item/I = M.get_active_held_item()
if(!I)
var/mob/user_mob = user.mob
var/obj/item/item_dropped = user_mob.get_active_held_item()
if(!item_dropped)
to_chat(user, span_warning("You have nothing to drop in your hand!"))
else
user.mob.dropItemToGround(I)
return TRUE
user.mob.dropItemToGround(item_dropped)
return TRUE
/datum/keybinding/mob/target/down(client/user, turf/target)
/datum/keybinding/mob/drop_item_specific
hotkey_keys = list("CtrlX")
name = "drop_item_specific"
full_name = "Drop Item (Specific)"
description = "Drops the item in your active where your mouse cursor is, if in range."
keybind_signal = COMSIG_KB_MOB_DROPITEM_DOWN
/datum/keybinding/mob/drop_item_specific/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
if(iscyborg(user.mob)) //cyborgs can't drop items
return FALSE
var/mob/user_mob = user.mob
var/obj/item/item_dropped = user_mob.get_active_held_item()
if(!item_dropped)
to_chat(user, span_warning("You have nothing to drop in your hand!"))
return TRUE
if(!user_mob.Adjacent(target) || target.is_blocked_turf(source_atom = item_dropped))
return TRUE
var/x_value = (mousepos_x >= 0) ? mousepos_x - ICON_SIZE_X / 2 : mousepos_x + ICON_SIZE_X / 2
var/y_value = (mousepos_y >= 0) ? mousepos_y - ICON_SIZE_Y / 2 : mousepos_y + ICON_SIZE_Y / 2
user_mob.transfer_item_to_turf(item_dropped, target, x_value, y_value)
return TRUE
/datum/keybinding/mob/target/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return .
@@ -210,7 +235,7 @@
description = "Prevents you from moving"
keybind_signal = COMSIG_KB_MOB_BLOCKMOVEMENT_DOWN
/datum/keybinding/mob/prevent_movement/down(client/user, turf/target)
/datum/keybinding/mob/prevent_movement/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
+2 -2
View File
@@ -37,7 +37,7 @@
description = "Moves your character up a z-level if possible"
keybind_signal = COMSIG_KB_MOVEMENT_ZLEVEL_MOVEUP_DOWN
/datum/keybinding/movement/zlevel_upwards/down(client/user, turf/target)
/datum/keybinding/movement/zlevel_upwards/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -51,7 +51,7 @@
description = "Moves your character down a z-level if possible"
keybind_signal = COMSIG_KB_MOVEMENT_ZLEVEL_MOVEDOWN_DOWN
/datum/keybinding/movement/zlevel_downwards/down(client/user, turf/target)
/datum/keybinding/movement/zlevel_downwards/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
+5 -5
View File
@@ -12,7 +12,7 @@
description = "Equips or unequips the first module"
keybind_signal = COMSIG_KB_SILICON_TOGGLEMODULEONE_DOWN
/datum/keybinding/robot/moduleone/down(client/user, turf/target)
/datum/keybinding/robot/moduleone/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -27,7 +27,7 @@
description = "Equips or unequips the second module"
keybind_signal = COMSIG_KB_SILICON_TOGGLEMODULETWO_DOWN
/datum/keybinding/robot/moduletwo/down(client/user, turf/target)
/datum/keybinding/robot/moduletwo/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -42,7 +42,7 @@
description = "Equips or unequips the third module"
keybind_signal = COMSIG_KB_SILICON_TOGGLEMODULETHREE_DOWN
/datum/keybinding/robot/modulethree/down(client/user, turf/target)
/datum/keybinding/robot/modulethree/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -57,7 +57,7 @@
description = "Unequips the active module"
keybind_signal = COMSIG_KB_SILICON_UNEQUIPMODULE_DOWN
/datum/keybinding/robot/unequip_module/down(client/user, turf/target)
/datum/keybinding/robot/unequip_module/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return
@@ -73,7 +73,7 @@
description = "Returns you to your AI core"
keybind_signal = COMSIG_KB_SILION_UNDEPLOY_DOWN
/datum/keybinding/robot/undeploy/down(client/user, turf/target)
/datum/keybinding/robot/undeploy/down(client/user, turf/target, mousepos_x, mousepos_y)
. = ..()
if(.)
return