diff --git a/code/_onclick/item_attack.dm b/code/_onclick/item_attack.dm
index 22c8a11300..7ff3e1d63f 100644
--- a/code/_onclick/item_attack.dm
+++ b/code/_onclick/item_attack.dm
@@ -24,11 +24,11 @@
/obj/item/proc/attack(mob/living/M as mob, mob/living/user as mob, def_zone)
if (!istype(M)) // not sure if this is the right thing...
- return
+ return 0
var/messagesource = M
if (can_operate(M)) //Checks if mob is lying down on table for surgery
if (do_surgery(M,user,src))
- return
+ return 0
if (istype(M,/mob/living/carbon/brain))
messagesource = M:container
if (hitsound)
@@ -140,7 +140,7 @@
if(istype(M, /mob/living/carbon/human))
- return M:attacked_by(src, user, def_zone)
+ return M:attacked_by(src, user, def_zone) //make sure to return whether we have hit or miss
else
switch(damtype)
if("brute")
diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm
index 2e497863a6..dfdbb130c8 100644
--- a/code/game/objects/items/weapons/stunbaton.dm
+++ b/code/game/objects/items/weapons/stunbaton.dm
@@ -12,10 +12,11 @@
w_class = 3
origin_tech = "combat=2"
attack_verb = list("beaten")
- var/stunforce = 7
- var/status = 0
- var/obj/item/weapon/cell/high/bcell = null
- var/hitcost = 1000
+ var/stunforce = 0
+ var/agonyforce = 60
+ var/status = 0 //whether the thing is on or not
+ var/obj/item/weapon/cell/bcell = null
+ var/hitcost = 1000 //oh god why do power cells carry so much charge? We probably need to make a distinction between "industrial" sized power cells for APCs and power cells for everything else.
/obj/item/weapon/melee/baton/suicide_act(mob/user)
user.visible_message("[user] is putting the live [name] in \his mouth! It looks like \he's trying to commit suicide.")
@@ -26,10 +27,9 @@
update_icon()
return
-
/obj/item/weapon/melee/baton/loaded/New() //this one starts with a cell pre-installed.
..()
- bcell = new(src)
+ bcell = new/obj/item/weapon/cell/high(src)
update_icon()
return
@@ -103,49 +103,77 @@
if(!isliving(M))
return
+ var/agony = agonyforce
var/mob/living/L = M
+ var/contact = 1
if(user.a_intent == "harm")
- ..()
-
- if(!status)
- L.visible_message("[L] has been prodded with [src] by [user]. Luckily it was off.")
- return
+ contact = ..()
+ agony *= 0.5 //whacking someone causes a much poorer contact than prodding them.
+ else
+ //copied from human_defense.dm
+ if (ishuman(L))
+ user.lastattacked = L //are these used at all, if we have logs?
+ L.lastattacker = user
- var/stunroll = (rand(1,100))
-
- if(ishuman(L) && status)
- user.lastattacked = L
- L.lastattacker = user
- if(user == L) // Attacking yourself can't miss
- stunroll = 100
- if(stunroll < 40)
+ var/target_zone = get_zone_with_miss_chance(user.zone_sel.selecting, L)
+ if(user == L) // Attacking yourself can't miss
+ target_zone = user.zone_sel.selecting
+ if(!target_zone)
+ contact = 0
+ else
+ switch (target_zone)
+ if("head")
+ agony *= 1.25
+ //if("l_hand", "r_hand") //TODO
+ //if("l_foot", "r_foot") //TODO
+
+ //put this here to avoid duplicate messages and logs from ..() above
+ if (!contact)
L.visible_message("\red [user] misses [L] with \the [src]!")
- msg_admin_attack("[key_name(user)] attempted to stun [key_name(L)] with the [src].")
- return
- L.Stun(stunforce)
- L.Weaken(stunforce)
- L.apply_effect(STUTTER, stunforce)
+ else
+ if(!status)
+ L.visible_message("[L] has been prodded with [src] by [user]. Luckily it was off.")
+ else
+ L.visible_message("[L] has been prodded with [src] by [user]!")
+ msg_admin_attack("[key_name(user)] attempted to stun [key_name(L)] with the [src].")
- L.visible_message("[L] has been stunned with [src] by [user]!")
+ //stun effects
+ if (contact)
+ if (stunforce)
+ L.Stun(stunforce)
+ L.Weaken(stunforce)
+ L.apply_effect(STUTTER, stunforce)
+
+ if (agony)
+ //Siemens coefficient?
+ //TODO: Merge this with taser effects
+ L.apply_effect(agony,AGONY,0)
+ L.apply_effect(STUTTER, agony/10)
+ L.apply_effect(EYE_BLUR, agony/10)
+ L.flash_pain()
+
playsound(loc, 'sound/weapons/Egloves.ogg', 50, 1, -1)
-
msg_admin_attack("[key_name(user)] stunned [key_name(L)] with the [src].")
- if(isrobot(loc))
- var/mob/living/silicon/robot/R = loc
- if(R && R.cell)
- R.cell.use(hitcost)
- else
- deductcharge(hitcost)
+ deductcharge(hitcost)
/obj/item/weapon/melee/baton/emp_act(severity)
if(bcell)
- deductcharge(1000 / severity)
- if(bcell.reliability != 100 && prob(50/severity))
- bcell.reliability -= 10 / severity
+ bcell.emp_act(severity) //let's not duplicate code everywhere if we don't have to please.
..()
+//secborg stun baton module
+/obj/item/weapon/melee/baton/robot/attack_self(mob/user)
+ //try to find our power cell
+ var/mob/living/silicon/robot/R = loc
+ if (istype(R))
+ bcell = R.cell
+ return ..()
+
+/obj/item/weapon/melee/baton/robot/attackby(obj/item/weapon/W, mob/user)
+ return
+
//Makeshift stun baton. Replacement for stun gloves.
/obj/item/weapon/melee/baton/cattleprod
name = "stunprod"
@@ -154,6 +182,8 @@
item_state = "prod"
force = 3
throwforce = 5
- stunforce = 5
+ stunforce = 0
+ agonyforce = 60 //same force as a stunbaton, but uses way more charge.
hitcost = 2500
+ attack_verb = list("poked")
slot_flags = null
diff --git a/code/modules/mob/living/silicon/robot/robot_modules.dm b/code/modules/mob/living/silicon/robot/robot_modules.dm
index d0d744b0a4..87301e4b9b 100644
--- a/code/modules/mob/living/silicon/robot/robot_modules.dm
+++ b/code/modules/mob/living/silicon/robot/robot_modules.dm
@@ -238,7 +238,7 @@
src.modules += new /obj/item/device/flash(src)
src.modules += new /obj/item/borg/sight/hud/sec(src)
src.modules += new /obj/item/weapon/handcuffs/cyborg(src)
- src.modules += new /obj/item/weapon/melee/baton/loaded(src)
+ src.modules += new /obj/item/weapon/melee/baton/robot(src)
src.modules += new /obj/item/weapon/gun/energy/taser/cyborg(src)
src.modules += new /obj/item/taperoll/police(src)
src.emag = new /obj/item/weapon/gun/energy/laser/cyborg(src)