From e550d50a42fd9f5913ccc8d7fc56e71adf32b9e9 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 29 Mar 2024 19:29:06 +0100 Subject: [PATCH] [MIRROR] Allows borgs to use ranged rightclicks (#27096) * Allows borgs to use ranged rightclicks (#82265) ## About The Pull Request No idea why this is all copypaste snowflake code but here we are. Borgs can now use ranged rightlicks just like anyone else. I honestly have barely any idea as to what I am doing, does anyone have a diagram of the attack chain? But I can assure you, it does work. ## Why It's Good For The Game Future borg parity with EVERYTHING ELSE. Will make crushers and other weapons with rightclick functionality work if one decides to add them to borgos. Even if not, it's good to keep the parity. ## Changelog :cl: code: Borgo rightclick ranged code /:cl: --------- Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com> * Allows borgs to use ranged rightclicks --------- Co-authored-by: Waterpig <49160555+Majkl-J@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com> --- code/_onclick/cyborg.dm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/code/_onclick/cyborg.dm b/code/_onclick/cyborg.dm index 9abc5be2e80..8cad6f772e0 100644 --- a/code/_onclick/cyborg.dm +++ b/code/_onclick/cyborg.dm @@ -79,12 +79,18 @@ if(!isturf(loc)) return - // cyborgs are prohibited from using storage items so we can I think safely remove (A.loc && isturf(A.loc.loc)) + // cyborg rightclick code, allowing borgos to use weapons at range if(CanReach(A,W)) W.melee_attack_chain(src, A, params) return - if(isturf(A) || isturf(A.loc)) - W.afterattack(A, src, 0, params) + else if(isturf(A) || isturf(A.loc)) + if(LAZYACCESS(modifiers, RIGHT_CLICK)) + var/after_attack_secondary_result = W.afterattack_secondary(A, src, FALSE, params) + + if(after_attack_secondary_result == SECONDARY_ATTACK_CALL_NORMAL) + W.afterattack(A, src, FALSE, params) + else + W.afterattack(A, src, FALSE, params) //Give cyborgs hotkey clicks without breaking existing uses of hotkey clicks // for non-doors/apcs