From f02e0e2a2b7605cdd0706be61cf1ee13504136d4 Mon Sep 17 00:00:00 2001 From: SteelSlayer Date: Fri, 1 May 2020 19:31:37 -0500 Subject: [PATCH 1/3] Fixes missionary staff recharge --- code/modules/clothing/suits/miscellaneous.dm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/modules/clothing/suits/miscellaneous.dm b/code/modules/clothing/suits/miscellaneous.dm index cd137f6e12b..b378ed5ddbd 100644 --- a/code/modules/clothing/suits/miscellaneous.dm +++ b/code/modules/clothing/suits/miscellaneous.dm @@ -958,7 +958,9 @@ if(linked_staff.faith >= 100) //if the linked staff is fully recharged, do nothing return - if(!(linked_staff in range(3, get_turf(src)))) //staff won't charge at range (to prevent it from being handed off / stolen and used) + // Do not allow the staff to recharge if it's more than 3 tiles away from the robe. If get_dist returns 0, the robe and the staff in the same tile. + // Using .loc instead of get_turf() here because if the turf of H is the same as the turf of the staff, get_dist() returns -1. + if(!(get_dist(H.loc, linked_staff.loc) in 0 to 3)) if(prob(10)) //10% chance per process should avoid being too spammy, can tweak if it ends up still being too frequent. to_chat(H, "Your staff is unable to charge at this range. Get closer!") return From a60bfc0fccde572b89207a28fd320dd7d4031750 Mon Sep 17 00:00:00 2001 From: SteelSlayer Date: Tue, 5 May 2020 17:20:48 -0500 Subject: [PATCH 2/3] better logic --- code/modules/clothing/suits/miscellaneous.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/modules/clothing/suits/miscellaneous.dm b/code/modules/clothing/suits/miscellaneous.dm index b378ed5ddbd..80f4e87d1c7 100644 --- a/code/modules/clothing/suits/miscellaneous.dm +++ b/code/modules/clothing/suits/miscellaneous.dm @@ -959,8 +959,8 @@ return // Do not allow the staff to recharge if it's more than 3 tiles away from the robe. If get_dist returns 0, the robe and the staff in the same tile. - // Using .loc instead of get_turf() here because if the turf of H is the same as the turf of the staff, get_dist() returns -1. - if(!(get_dist(H.loc, linked_staff.loc) in 0 to 3)) + var/staff_dist = get_dist(H, linked_staff) + if(staff_dist > 3 || staff_dist < 0) if(prob(10)) //10% chance per process should avoid being too spammy, can tweak if it ends up still being too frequent. to_chat(H, "Your staff is unable to charge at this range. Get closer!") return From a3aafa4ce4082c9ae0af36fc7bc036fbaef47910 Mon Sep 17 00:00:00 2001 From: SteelSlayer Date: Wed, 6 May 2020 02:03:15 -0500 Subject: [PATCH 3/3] this works --- code/modules/clothing/suits/miscellaneous.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/modules/clothing/suits/miscellaneous.dm b/code/modules/clothing/suits/miscellaneous.dm index 80f4e87d1c7..6a95ab7128d 100644 --- a/code/modules/clothing/suits/miscellaneous.dm +++ b/code/modules/clothing/suits/miscellaneous.dm @@ -959,8 +959,7 @@ return // Do not allow the staff to recharge if it's more than 3 tiles away from the robe. If get_dist returns 0, the robe and the staff in the same tile. - var/staff_dist = get_dist(H, linked_staff) - if(staff_dist > 3 || staff_dist < 0) + if(!(get_dist(H, linked_staff) <= 3)) if(prob(10)) //10% chance per process should avoid being too spammy, can tweak if it ends up still being too frequent. to_chat(H, "Your staff is unable to charge at this range. Get closer!") return