From 8b1e7aa5125d802fdc3e1e44f322a88fb6b24dc2 Mon Sep 17 00:00:00 2001 From: Geeves Date: Sat, 3 Jul 2021 23:48:05 +0200 Subject: [PATCH] Multi-Purpose Throwing (#12094) * Multi-Purpose Throwing * help intent not not harm intent --- code/modules/mob/inventory.dm | 26 ++++++++++++++++++++----- code/modules/mob/living/carbon/give.dm | 7 +++++-- html/changelogs/geeves-item_placing.yml | 7 +++++++ 3 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 html/changelogs/geeves-item_placing.yml diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index bfc2163d539..f41357fd6d0 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -342,7 +342,6 @@ var/list/slot_equipment_priority = list( \ if(!item) return - var/can_throw = TRUE if(istype(item, /obj/item/grab)) var/obj/item/grab/G = item item = G.throw_held() //throw the person instead of the grab @@ -365,13 +364,30 @@ var/list/slot_equipment_priority = list( \ qdel(G) else - can_throw = FALSE + return - if(!item || !can_throw) + if(!item) return //Grab processing has a chance of returning null - src.remove_from_mob(item) - item.loc = src.loc + if(a_intent == I_HELP && Adjacent(target) && isitem(item)) + var/obj/item/I = item + if(ishuman(target)) + var/mob/living/carbon/human/H = target + if(H.in_throw_mode && H.a_intent == I_HELP && unEquip(I)) + I.on_give(src, target) + if(!QDELETED(I)) // if on_give deletes the item, we don't want runtimes below + H.put_in_hands(I) // If this fails it will just end up on the floor, but that's fitting for things like dionaea. + visible_message("[src] hands \the [H] \a [I].", SPAN_NOTICE("You give \the [target] \a [I].")) + else + to_chat(src, SPAN_NOTICE("You offer \the [I] to \the [target].")) + do_give(H) + return + remove_from_mob(I) + make_item_drop_sound(I) + I.forceMove(get_turf(target)) + return + + remove_from_mob(item) if(is_pacified()) to_chat(src, "You set [item] down gently on the ground.") diff --git a/code/modules/mob/living/carbon/give.dm b/code/modules/mob/living/carbon/give.dm index 3c55bd5c094..53c4c9dfb72 100644 --- a/code/modules/mob/living/carbon/give.dm +++ b/code/modules/mob/living/carbon/give.dm @@ -1,7 +1,10 @@ -/mob/living/carbon/human/verb/give(var/mob/living/target in view(1)-usr) +/mob/living/carbon/verb/give(var/mob/living/target in view(1)-usr) set category = "IC" set name = "Give" + do_give(target) + +/mob/living/carbon/proc/do_give(var/mob/living/carbon/human/target) if(use_check(target)) to_chat(usr, SPAN_WARNING("[target.name] is in no condition to handle items!")) return @@ -39,4 +42,4 @@ I.on_give(usr, target) if(!QDELETED(I)) // if on_give deletes the item, we don't want runtimes below target.put_in_hands(I) // If this fails it will just end up on the floor, but that's fitting for things like dionaea. - usr.visible_message("[usr] hands [target] \a [I].", SPAN_NOTICE("You give \the [target] a [I].")) + usr.visible_message("[usr] hands [target] \a [I].", SPAN_NOTICE("You give \the [target] a [I].")) \ No newline at end of file diff --git a/html/changelogs/geeves-item_placing.yml b/html/changelogs/geeves-item_placing.yml new file mode 100644 index 00000000000..f4d9e5377f8 --- /dev/null +++ b/html/changelogs/geeves-item_placing.yml @@ -0,0 +1,7 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Throwing something at a tile adjacent to you will instead put it down gently, provided you are on help intent." + - rscadd: "Clicking on someone with an item in your hand while you have throw mode active and on help intent will offer it to them like you used the Give verb. If they're also on throw intent and on help intent, you put it into their hand directly." \ No newline at end of file