diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 54e5bf033a..f21d69fcfb 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -46,11 +46,14 @@ /obj/item/melee/baton/loaded //this one starts with a cell pre-installed. preload_cell_type = /obj/item/stock_parts/cell/high -/obj/item/melee/baton/proc/deductcharge(chrgdeductamt, chargecheck = TRUE, obj/item/stock_parts/cell/external_cell) - if(!cell && !external_cell) +/obj/item/melee/baton/proc/deductcharge(chrgdeductamt, chargecheck = TRUE) + var/obj/item/stock_parts/cell/copper_top = cell + if(iscyborg(loc)) + var/mob/living/silicon/robot/R = loc + copper_top = R.cell + if(!copper_top) switch_status(FALSE, TRUE) return FALSE - var/obj/item/stock_parts/cell/copper_top = external_cell ? external_cell : cell //Note this value returned is significant, as it will determine //if a stun is applied or not . = copper_top.use(chrgdeductamt) @@ -165,15 +168,21 @@ playsound(L, 'sound/weapons/genhit.ogg', 50, 1) return FALSE var/stunpwr = stunforce - var/stuncharge = cell.charge - var/obj/item/stock_parts/cell/external_cell + var/obj/item/stock_parts/cell/our_cell = cell if(iscyborg(loc)) var/mob/living/silicon/robot/R = loc - external_cell = R.cell - if(!deductcharge(hitcost, FALSE, external_cell)) - stunpwr *= round(stuncharge/hitcost, 0.1) - if(stunpwr < stunforce * STUNBATON_CHARGE_LENIENCY) + our_cell = R.cell + if(!our_cell) + return FALSE + var/stuncharge = our_cell.charge + deductcharge(hitcost, FALSE) + if(stuncharge < hitcost) + if(stuncharge < hitcost * STUNBATON_CHARGE_LENIENCY) + L.visible_message("[user] has prodded [L] with [src]. Luckily it din't have enough charge left.", \ + "[user] has prodded you with [src]. Luckily it din't have enough charge left.") return FALSE + stunpwr *= round(stuncharge/hitcost, 0.1) + L.Knockdown(stunpwr) L.adjustStaminaLoss(stunpwr*0.1, affected_zone = (istype(user) ? user.zone_selected : BODY_ZONE_CHEST))//CIT CHANGE - makes stunbatons deal extra staminaloss. Todo: make this also deal pain when pain gets implemented.