Alt+Click adjacent human to give item.

This commit is contained in:
Chris
2014-09-27 09:24:20 -05:00
parent 8c41dbd968
commit 0a9f3f8ee3
2 changed files with 32 additions and 25 deletions

View File

@@ -268,6 +268,9 @@
return
/atom/proc/AltClick(var/mob/user)
if(ishuman(src) && user.Adjacent(src))
src:give_item(user)
return
var/turf/T = get_turf(src)
if(T && T.Adjacent(user))
if(user.listed_turf == T)

View File

@@ -2,43 +2,47 @@
set category = "IC"
set name = "Give"
set src in view(1)
if(src.stat == 2 || usr.stat == 2 || src.client == null)
give_item(usr)
/mob/living/carbon/proc/give_item(mob/living/human/user)
if(src.stat == 2 || user.stat == 2 || src.client == null)
return
if(src == usr)
usr << "\red I feel stupider, suddenly."
if(src == user)
user << "\red I feel stupider, suddenly."
return
var/obj/item/I
if(!usr.hand && usr.r_hand == null)
usr << "\red You don't have anything in your right hand to give to [src.name]"
if(!user.hand && user.r_hand == null)
user << "\red You don't have anything in your right hand to give to [src.name]"
return
if(usr.hand && usr.l_hand == null)
usr << "\red You don't have anything in your left hand to give to [src.name]"
if(user.hand && user.l_hand == null)
user << "\red You don't have anything in your left hand to give to [src.name]"
return
if(usr.hand)
I = usr.l_hand
else if(!usr.hand)
I = usr.r_hand
if(user.hand)
I = user.l_hand
else if(!user.hand)
I = user.r_hand
if(!I)
return
if(src.r_hand == null || src.l_hand == null)
switch(alert(src,"[usr] wants to give you \a [I]?",,"Yes","No"))
switch(alert(src,"[user] wants to give you \a [I]?",,"Yes","No"))
if("Yes")
if(!I)
return
if(!Adjacent(usr))
usr << "\red You need to stay in reaching distance while giving an object."
src << "\red [usr.name] moved too far away."
if(!Adjacent(user))
user << "\red You need to stay in reaching distance while giving an object."
src << "\red [user.name] moved too far away."
return
if((usr.hand && usr.l_hand != I) || (!usr.hand && usr.r_hand != I))
usr << "\red You need to keep the item in your active hand."
src << "\red [usr.name] seem to have given up on giving \the [I.name] to you."
if((user.hand && user.l_hand != I) || (!user.hand && user.r_hand != I))
user << "\red You need to keep the item in your active hand."
src << "\red [user.name] seem to have given up on giving \the [I.name] to you."
return
if(src.r_hand != null && src.l_hand != null)
src << "\red Your hands are full."
usr << "\red Their hands are full."
user << "\red Their hands are full."
return
else
usr.drop_item()
user.drop_item()
if(src.r_hand == null)
src.r_hand = I
else
@@ -48,10 +52,10 @@
I.add_fingerprint(src)
src.update_inv_l_hand()
src.update_inv_r_hand()
usr.update_inv_l_hand()
usr.update_inv_r_hand()
src.visible_message("\blue [usr.name] handed \the [I.name] to [src.name].")
user.update_inv_l_hand()
user.update_inv_r_hand()
src.visible_message("\blue [user.name] handed \the [I.name] to [src.name].")
if("No")
src.visible_message("\red [usr.name] tried to hand [I.name] to [src.name] but [src.name] didn't want it.")
src.visible_message("\red [user.name] tried to hand [I.name] to [src.name] but [src.name] didn't want it.")
else
usr << "\red [src.name]'s hands are full."
user << "\red [src.name]'s hands are full."