Refactor: Moves throwing and giving items from /mob/living/carbon to /mob/living (#91049)

Given the existence of basic mobs with hand slots, it feels like
throwing and giving items shouldn't be something exclusive to carbon
mobs, so I've pulled things around to make this happen. The only basic
mobs with hands at time of writing are gorillas and dextrous
holoparasites, but the inability to throw things when you're a gorilla
just doesn't seem right to me.

Some more details about what I've done here:

- Made the dextrous component optionally enable throwing for the mob
it's added to.
- Moved offer/give item functionality to /mob/living (I can't see any
reason why only carbon mobs should have this option)
- Moved throwing and give item hotkeys from carbon to "human" (where all
the other /mob/living hotkeys go) and, as a result, removed carbon
hotkeys (nothing is left in them).
- Moved throwing code and item offering code to its own file because
living.dm is 3000+ lines long and should probably be broken up some day
(I'm not brave enough for that)
- Cleaned up an unused global signal that hasn't been used since dogs
got moved to basic mobs.
- Other miscellaneous cleanup where I noticed it.
- In terms of testing: Tested using gorillas (only checked the dextrous
holoparasite to confirm the button and hotkeys worked). Things that were
working:
  - Can throw items if the mob is set up to allow it.
- Can give items as a gorilla to a human, as a human to a gorilla, and
as a human to a human.
- Can give a high five to a gorilla (and the gorilla can receive it).
Gorillas can't give a high five back, though (they don't have the
emote), this already ballooned in scope, someone else can make that
happen.
- There are an alarmingly high amount of niche
emote-into-item-into-giving behaviours I suspect half the playerbase or
more aren't even aware of (does anyone offer their hand to someone to
get them up off of the ground?) and I don't know if I broke any of them
with this, but the fact high fives work gives me some hope they're
probably still fine.

Lets gorillas and dextrous holoparasites throw things and give things,
but most importantly sets up more framework for any future dextrous
basic mobs to also be able to do this. There's no real reason to keep
this functionality confined to carbon mobs when dextrous basic mobs are
a thing.

🆑
add: Gorillas can now throw things and offer items to players.
refactor: Moved throwing and offering item code to be based on living
mobs, not just carbon mobs.
/🆑

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
Cirrial
2025-05-22 21:35:53 -04:00
committed by Roxy
co-authored by Copilot Ghom
parent 0060c53767
commit fb69fbb8a2
26 changed files with 380 additions and 337 deletions
-58
View File
@@ -1,58 +0,0 @@
/datum/keybinding/carbon
category = CATEGORY_CARBON
weight = WEIGHT_MOB
/datum/keybinding/carbon/can_use(client/user)
return iscarbon(user.mob)
/datum/keybinding/carbon/toggle_throw_mode
hotkey_keys = list("R", "Southwest") // END
name = "toggle_throw_mode"
full_name = "Toggle throw mode"
description = "Toggle throwing the current item or not."
category = CATEGORY_CARBON
keybind_signal = COMSIG_KB_CARBON_TOGGLETHROWMODE_DOWN
/datum/keybinding/carbon/toggle_throw_mode/down(client/user, turf/target)
. = ..()
if(.)
return
var/mob/living/carbon/C = user.mob
C.toggle_throw_mode()
return TRUE
/datum/keybinding/carbon/hold_throw_mode
hotkey_keys = list("Space")
name = "hold_throw_mode"
full_name = "Hold throw mode"
description = "Hold this to turn on throw mode, and release it to turn off throw mode"
category = CATEGORY_CARBON
keybind_signal = COMSIG_KB_CARBON_HOLDTHROWMODE_DOWN
/datum/keybinding/carbon/hold_throw_mode/down(client/user, turf/target)
. = ..()
if(.)
return
var/mob/living/carbon/carbon_user = user.mob
carbon_user.throw_mode_on(THROW_MODE_HOLD)
/datum/keybinding/carbon/hold_throw_mode/up(client/user, turf/target)
. = ..()
if(.)
return
var/mob/living/carbon/carbon_user = user.mob
carbon_user.throw_mode_off(THROW_MODE_HOLD)
/datum/keybinding/carbon/give
hotkey_keys = list("G")
name = "Give_Item"
full_name = "Give item"
description = "Give the item you're currently holding"
keybind_signal = COMSIG_KB_CARBON_GIVEITEM_DOWN
/datum/keybinding/carbon/give/down(client/user, turf/target)
. = ..()
if(.)
return
var/mob/living/carbon/carbon_user = user.mob
carbon_user.give()
return TRUE
+62
View File
@@ -167,3 +167,65 @@
var/mob/living/M = user.mob
M.toggle_move_intent()
return TRUE
/datum/keybinding/living/toggle_throw_mode
hotkey_keys = list("R", "Southwest") // END
name = "toggle_throw_mode"
full_name = "Toggle throw mode"
description = "Toggle throwing the current item or not."
keybind_signal = COMSIG_KB_LIVING_TOGGLETHROWMODE_DOWN
/datum/keybinding/living/toggle_throw_mode/down(client/user)
. = ..()
if(.)
return
var/mob/living/living_user = user.mob
living_user.toggle_throw_mode()
return TRUE
/datum/keybinding/living/hold_throw_mode
hotkey_keys = list("Space")
name = "hold_throw_mode"
full_name = "Hold throw mode"
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)
. = ..()
if(.)
return
var/mob/living/living_user = user.mob
living_user.throw_mode_on(THROW_MODE_HOLD)
/datum/keybinding/living/hold_throw_mode/up(client/user, turf/target)
. = ..()
if(.)
return
var/mob/living/living_user = user.mob
living_user.throw_mode_off(THROW_MODE_HOLD)
/datum/keybinding/living/give
hotkey_keys = list("G")
name = "Give_Item"
full_name = "Give item"
description = "Give the item you're currently holding"
keybind_signal = COMSIG_KB_LIVING_GIVEITEM_DOWN
/datum/keybinding/living/give/can_use(client/user)
. = ..()
if (!.)
return FALSE
if(!user.mob)
return FALSE
if(!HAS_TRAIT(user.mob, TRAIT_CAN_HOLD_ITEMS))
return FALSE
return TRUE
/datum/keybinding/living/give/down(client/user, turf/target)
. = ..()
if(.)
return
var/mob/living/living_user = user.mob
if(!HAS_TRAIT(living_user, TRAIT_CAN_HOLD_ITEMS))
return
living_user.give()