Multi-Purpose Throwing (#12094)

* Multi-Purpose Throwing

* help intent not not harm intent
This commit is contained in:
Geeves
2021-07-03 18:48:05 -03:00
committed by GitHub
parent 2faa015445
commit 8b1e7aa512
3 changed files with 33 additions and 7 deletions
+21 -5
View File
@@ -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("<b>[src]</b> 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, "<span class='notice'>You set [item] down gently on the ground.</span>")
+5 -2
View File
@@ -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("<b>[usr]</b> hands [target] \a [I].", SPAN_NOTICE("You give \the [target] a [I]."))
usr.visible_message("<b>[usr]</b> hands [target] \a [I].", SPAN_NOTICE("You give \the [target] a [I]."))