From bfad632d1012f03bec2cf34cc0373392f93a1e5c Mon Sep 17 00:00:00 2001
From: CRUNCH <143041327+Fordoxia@users.noreply.github.com>
Date: Sat, 15 Feb 2025 07:48:22 +0000
Subject: [PATCH] Migrates `/obj/item/borg/stun` to the new attack chain.
(#28221)
* Update robot_items.dm
* if () > if()
* Apply suggestions from code review
Co-authored-by: chuga-git <98280110+chuga-git@users.noreply.github.com>
Signed-off-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com>
* Update code/game/objects/items/robot/robot_items.dm
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Signed-off-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com>
---------
Signed-off-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com>
Co-authored-by: chuga-git <98280110+chuga-git@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
---
code/game/objects/items/robot/robot_items.dm | 28 +++++++++++---------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/code/game/objects/items/robot/robot_items.dm b/code/game/objects/items/robot/robot_items.dm
index f334ed4641d..90851e1819c 100644
--- a/code/game/objects/items/robot/robot_items.dm
+++ b/code/game/objects/items/robot/robot_items.dm
@@ -12,25 +12,29 @@ Keeping it in for adminabuse but the malf one is /obj/item/melee/baton/borg_stun
/obj/item/borg/stun
name = "electrically-charged arm"
icon_state = "elecarm_active"
+ new_attack_chain = TRUE
var/charge_cost = 30
-/obj/item/borg/stun/attack__legacy__attackchain(mob/living/M, mob/living/silicon/robot/user)
- if(ishuman(M))
- var/mob/living/carbon/human/H = M
- if(H.check_shields(src, 0, "[M]'s [name]", MELEE_ATTACK))
- playsound(M, 'sound/weapons/genhit.ogg', 50, 1)
- return 0
+/obj/item/borg/stun/attack(mob/living/target, mob/living/silicon/robot/user, params)
+ if(..())
+ return FINISH_ATTACK
+
+ if(ishuman(target))
+ var/mob/living/carbon/human/H = target
+ if(H.check_shields(src, 0, "[target]'s [name]", MELEE_ATTACK))
+ playsound(target, 'sound/weapons/genhit.ogg', 50, TRUE)
+ return FINISH_ATTACK
if(isrobot(user))
if(!user.cell.use(charge_cost))
- return
+ return FINISH_ATTACK
- user.do_attack_animation(M)
- M.Weaken(10 SECONDS)
- M.apply_effect(STUTTER, 10 SECONDS)
+ user.do_attack_animation(target)
+ target.Weaken(10 SECONDS)
+ target.apply_effect(STUTTER, 10 SECONDS)
- M.visible_message("[user] has prodded [M] with [src]!", \
+ target.visible_message("[user] has prodded [target] with [src]!", \
"[user] has prodded you with [src]!")
playsound(loc, 'sound/weapons/egloves.ogg', 50, TRUE, -1)
- add_attack_logs(user, M, "Stunned with [src] ([uppertext(user.a_intent)])")
+ add_attack_logs(user, target, "Stunned with [src] ([uppertext(user.a_intent)])")