diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm
index bc37ba6662f..cf6061596dd 100644
--- a/code/game/objects/items/weapons/stunbaton.dm
+++ b/code/game/objects/items/weapons/stunbaton.dm
@@ -35,11 +35,13 @@
/obj/item/weapon/melee/baton/proc/deductcharge(var/chrgdeductamt)
if(bcell)
+ if(bcell.charge < (hitcost+chrgdeductamt)) // If after the deduction the baton doesn't have enough charge for a stun hit it turns off.
+ status = 0
+ update_icon()
+ playsound(loc, "sparks", 75, 1, -1)
if(bcell.use(chrgdeductamt))
return 1
else
- status = 0
- update_icon()
return 0
/obj/item/weapon/melee/baton/update_icon()
@@ -60,14 +62,18 @@
/obj/item/weapon/melee/baton/attackby(obj/item/weapon/W, mob/user)
if(istype(W, /obj/item/weapon/stock_parts/cell))
- if(!bcell)
+ var/obj/item/weapon/stock_parts/cell/C = W
+ if(bcell)
+ user << "[src] already has a cell."
+ else
+ if(C.maxcharge < hitcost)
+ user << "[src] requires a higher capacity cell."
+ return
user.drop_item()
W.loc = src
bcell = W
user << "You install a cell in [src]."
update_icon()
- else
- user << "[src] already has a cell."
else if(istype(W, /obj/item/weapon/screwdriver))
if(bcell)
@@ -86,13 +92,13 @@
status = !status
user << "[src] is now [status ? "on" : "off"]."
playsound(loc, "sparks", 75, 1, -1)
- update_icon()
else
status = 0
if(!bcell)
user << "[src] does not have a power source!"
else
user << "[src] is out of charge."
+ update_icon()
add_fingerprint(user)
/obj/item/weapon/melee/baton/attack(mob/M, mob/user)
@@ -158,4 +164,4 @@
throwforce = 5
stunforce = 5
hitcost = 2500
- slot_flags = null
\ No newline at end of file
+ slot_flags = null