From 465166d46db5b1824d9ffb3f00427b82154685c0 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 24 Mar 2019 18:27:03 +0100 Subject: [PATCH 1/6] fixed antidrop and give --- code/modules/mob/living/carbon/give.dm | 8 ++++++++ .../mob/living/carbon/human/inventory.dm | 4 ++-- code/modules/mob/living/living.dm | 18 ++++++++++++------ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/code/modules/mob/living/carbon/give.dm b/code/modules/mob/living/carbon/give.dm index 473715367b4..60ee4d94558 100644 --- a/code/modules/mob/living/carbon/give.dm +++ b/code/modules/mob/living/carbon/give.dm @@ -33,10 +33,18 @@ to_chat(usr, " You need to stay in reaching distance while giving an object.") to_chat(target, " [usr.name] moved too far away.") return + if((I.flags & NODROP) || (I.flags & ABSTRACT)) + to_chat(usr, "\the [I.name] stays stuck to your hand when you try to give it!") + to_chat(target, "\the [I.name] stays stuck to [usr.name]'s hand when you try to take it!") + return if((usr.hand && usr.l_hand != I) || (!usr.hand && usr.r_hand != I)) to_chat(usr, " You need to keep the item in your active hand.") to_chat(target, " [usr.name] seem to have given up on giving \the [I.name] to you.") return + if(target.resting) + to_chat(usr, " They are resting and can't accept \the [I.name].") + to_chat(target, " You can't can't accept \the [I.name] while resting.") + return if(target.r_hand != null && target.l_hand != null) to_chat(target, " Your hands are full.") to_chat(usr, " Their hands are full.") diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 7d83c7eaa1d..8d4ed90cada 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -434,11 +434,11 @@ if(slot_l_hand) if(l_hand) return 0 - return 1 + return !resting if(slot_r_hand) if(r_hand) return 0 - return 1 + return !resting if(slot_wear_mask) if(wear_mask) return 0 diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index bf933f568d4..0d077172e34 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -749,19 +749,25 @@ // Override if a certain mob should be behave differently when placing items (can't, for example) /mob/living/stripPanelEquip(obj/item/what, mob/who, where, var/silent = 0) what = get_active_hand() - if(what && (what.flags & NODROP)) - to_chat(src, "You can't put \the [what.name] on [who], it's stuck to your hand!") - return if(what) + if(what.flags & NODROP) + to_chat(src, "You can't put \the [what.name] on [who], it's stuck to your hand!") + return if(!what.mob_can_equip(who, where, 1)) + if(isliving(who)) + var/mob/living/L = who + if(L.resting) + to_chat(src, "[who.name] can't hold \the [what.name] while resting.") + return to_chat(src, "\The [what.name] doesn't fit in that place!") return if(!silent) visible_message("[src] tries to put [what] on [who].") if(do_mob(src, who, what.put_on_delay)) - if(what && Adjacent(who)) - unEquip(what) - who.equip_to_slot_if_possible(what, where, 0, 1) + if(what && Adjacent(who) && !(what.flags & NODROP)) + unEquip(what) + if(!who.equip_to_slot_if_possible(what, where, 0, 1)) + what.loc = who.loc add_attack_logs(src, who, "Equipped [what]") /mob/living/singularity_act() From 0a50a0e748d9c043dff7a92ae4f00dc314ec5bb0 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 24 Mar 2019 19:38:35 +0100 Subject: [PATCH 2/6] only when the target is resting --- code/modules/mob/living/living.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 0d077172e34..7dab672fd91 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -754,7 +754,7 @@ to_chat(src, "You can't put \the [what.name] on [who], it's stuck to your hand!") return if(!what.mob_can_equip(who, where, 1)) - if(isliving(who)) + if((where == slot_l_hand || where == slot_r_hand) && isliving(who)) var/mob/living/L = who if(L.resting) to_chat(src, "[who.name] can't hold \the [what.name] while resting.") From a559b3b468ee50305cca7e0b0671f7ebf31b88a9 Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 24 Mar 2019 21:14:07 +0100 Subject: [PATCH 3/6] Feedback fixes --- code/modules/mob/living/carbon/give.dm | 42 +++++-------------- .../mob/living/carbon/human/inventory.dm | 4 +- code/modules/mob/living/living.dm | 14 ++----- 3 files changed, 17 insertions(+), 43 deletions(-) diff --git a/code/modules/mob/living/carbon/give.dm b/code/modules/mob/living/carbon/give.dm index 60ee4d94558..092995f22ea 100644 --- a/code/modules/mob/living/carbon/give.dm +++ b/code/modules/mob/living/carbon/give.dm @@ -4,22 +4,15 @@ if(!iscarbon(target)) //something is bypassing the give arguments, no clue what, adding a sanity check JIC to_chat(usr, "Wait a second... \the [target] HAS NO HANDS! AHH!")//cheesy messages ftw + return + if(target.incapacitated() || usr.incapacitated() || target.client == null) return - if(target.stat == 2 || usr.stat == 2|| target.client == null) - return - var/obj/item/I - if(!usr.hand && usr.r_hand == null) - to_chat(usr, " You don't have anything in your right hand to give to [target.name]") - return - if(usr.hand && usr.l_hand == null) - to_chat(usr, " You don't have anything in your left hand to give to [target.name]") - return - if(usr.hand) - I = usr.l_hand - else if(!usr.hand) - I = usr.r_hand + + var/obj/item/I = get_active_hand() + if(!I) + to_chat(usr, " You don't have anything in your hand to give to [target.name]") return if((I.flags & NODROP) || (I.flags & ABSTRACT)) to_chat(usr, "That's not exactly something you can give.") @@ -29,6 +22,8 @@ if("Yes") if(!I) return + if(target.incapacitated() || usr.incapacitated()) + return if(!Adjacent(target)) to_chat(usr, " You need to stay in reaching distance while giving an object.") to_chat(target, " [usr.name] moved too far away.") @@ -37,32 +32,17 @@ to_chat(usr, "\the [I.name] stays stuck to your hand when you try to give it!") to_chat(target, "\the [I.name] stays stuck to [usr.name]'s hand when you try to take it!") return - if((usr.hand && usr.l_hand != I) || (!usr.hand && usr.r_hand != I)) + if(I != get_active_hand()) to_chat(usr, " You need to keep the item in your active hand.") to_chat(target, " [usr.name] seem to have given up on giving \the [I.name] to you.") return - if(target.resting) - to_chat(usr, " They are resting and can't accept \the [I.name].") - to_chat(target, " You can't can't accept \the [I.name] while resting.") - return if(target.r_hand != null && target.l_hand != null) to_chat(target, " Your hands are full.") to_chat(usr, " Their hands are full.") return - else - usr.drop_item() - if(target.r_hand == null) - target.r_hand = I - else - target.l_hand = I - I.loc = target - I.layer = 20 - I.plane = HUD_PLANE + usr.unEquip(I) + target.put_in_hands(I) I.add_fingerprint(target) - src.update_inv_l_hand() - src.update_inv_r_hand() - target.update_inv_l_hand() - target.update_inv_r_hand() target.visible_message(" [usr.name] handed \the [I.name] to [target.name].") I.on_give(usr, target) if("No") diff --git a/code/modules/mob/living/carbon/human/inventory.dm b/code/modules/mob/living/carbon/human/inventory.dm index 8d4ed90cada..79b41e47cc3 100644 --- a/code/modules/mob/living/carbon/human/inventory.dm +++ b/code/modules/mob/living/carbon/human/inventory.dm @@ -434,11 +434,11 @@ if(slot_l_hand) if(l_hand) return 0 - return !resting + return !incapacitated() if(slot_r_hand) if(r_hand) return 0 - return !resting + return !incapacitated() if(slot_wear_mask) if(wear_mask) return 0 diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 7dab672fd91..aa2ae7930ac 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -749,16 +749,11 @@ // Override if a certain mob should be behave differently when placing items (can't, for example) /mob/living/stripPanelEquip(obj/item/what, mob/who, where, var/silent = 0) what = get_active_hand() + if(what && what.flags & NODROP) + to_chat(src, "You can't put \the [what.name] on [who], it's stuck to your hand!") + return if(what) - if(what.flags & NODROP) - to_chat(src, "You can't put \the [what.name] on [who], it's stuck to your hand!") - return if(!what.mob_can_equip(who, where, 1)) - if((where == slot_l_hand || where == slot_r_hand) && isliving(who)) - var/mob/living/L = who - if(L.resting) - to_chat(src, "[who.name] can't hold \the [what.name] while resting.") - return to_chat(src, "\The [what.name] doesn't fit in that place!") return if(!silent) @@ -766,8 +761,7 @@ if(do_mob(src, who, what.put_on_delay)) if(what && Adjacent(who) && !(what.flags & NODROP)) unEquip(what) - if(!who.equip_to_slot_if_possible(what, where, 0, 1)) - what.loc = who.loc + who.equip_to_slot_if_possible(what, where, 0, 1) add_attack_logs(src, who, "Equipped [what]") /mob/living/singularity_act() From 2965046af7ac2d4fef36f947caa020829fdb0d9d Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 24 Mar 2019 21:15:27 +0100 Subject: [PATCH 4/6] brackets --- code/modules/mob/living/living.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index aa2ae7930ac..3b098e3cd26 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -749,7 +749,7 @@ // Override if a certain mob should be behave differently when placing items (can't, for example) /mob/living/stripPanelEquip(obj/item/what, mob/who, where, var/silent = 0) what = get_active_hand() - if(what && what.flags & NODROP) + if(what && (what.flags & NODROP)) to_chat(src, "You can't put \the [what.name] on [who], it's stuck to your hand!") return if(what) @@ -760,7 +760,7 @@ visible_message("[src] tries to put [what] on [who].") if(do_mob(src, who, what.put_on_delay)) if(what && Adjacent(who) && !(what.flags & NODROP)) - unEquip(what) + unEquip(what) who.equip_to_slot_if_possible(what, where, 0, 1) add_attack_logs(src, who, "Equipped [what]") From e7275d85eca9bd1ba66f24de874552d838a2216b Mon Sep 17 00:00:00 2001 From: joep van der velden Date: Sun, 24 Mar 2019 21:39:39 +0100 Subject: [PATCH 5/6] fixes put_in_hands --- code/modules/mob/inventory.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index e53e3c9fd4d..471f82c1511 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -35,7 +35,7 @@ /mob/proc/put_in_l_hand(var/obj/item/W) if(!put_in_hand_check(W)) return 0 - if(!l_hand) + if(!l_hand && has_left_hand()) W.forceMove(src) //TODO: move to equipped? l_hand = W W.layer = 20 //TODO: move to equipped? @@ -51,7 +51,7 @@ /mob/proc/put_in_r_hand(var/obj/item/W) if(!put_in_hand_check(W)) return 0 - if(!r_hand) + if(!r_hand && has_right_hand()) W.forceMove(src) r_hand = W W.layer = 20 From 2922578c6bc30386c24d17d3b3efc4c839a9ce7d Mon Sep 17 00:00:00 2001 From: farie82 Date: Mon, 1 Apr 2019 23:31:46 +0200 Subject: [PATCH 6/6] no more \the --- code/modules/mob/living/carbon/give.dm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/modules/mob/living/carbon/give.dm b/code/modules/mob/living/carbon/give.dm index 092995f22ea..c0dba9b77e5 100644 --- a/code/modules/mob/living/carbon/give.dm +++ b/code/modules/mob/living/carbon/give.dm @@ -29,12 +29,12 @@ to_chat(target, " [usr.name] moved too far away.") return if((I.flags & NODROP) || (I.flags & ABSTRACT)) - to_chat(usr, "\the [I.name] stays stuck to your hand when you try to give it!") - to_chat(target, "\the [I.name] stays stuck to [usr.name]'s hand when you try to take it!") + to_chat(usr, "[I] stays stuck to your hand when you try to give it!") + to_chat(target, "[I] stays stuck to [usr.name]'s hand when you try to take it!") return if(I != get_active_hand()) to_chat(usr, " You need to keep the item in your active hand.") - to_chat(target, " [usr.name] seem to have given up on giving \the [I.name] to you.") + to_chat(target, " [usr.name] seem to have given up on giving [I] to you.") return if(target.r_hand != null && target.l_hand != null) to_chat(target, " Your hands are full.") @@ -43,9 +43,9 @@ usr.unEquip(I) target.put_in_hands(I) I.add_fingerprint(target) - target.visible_message(" [usr.name] handed \the [I.name] to [target.name].") + target.visible_message(" [usr.name] handed [I] to [target.name].") I.on_give(usr, target) if("No") - target.visible_message(" [usr.name] tried to hand [I.name] to [target.name] but [target.name] didn't want it.") + target.visible_message(" [usr.name] tried to hand [I] to [target.name] but [target.name] didn't want it.") else to_chat(usr, " [target.name]'s hands are full.")