From a3c2ed0b5259af5ee4030d56df693f0caccb7e24 Mon Sep 17 00:00:00 2001 From: Ghommie Date: Sat, 15 Jun 2019 02:19:57 +0200 Subject: [PATCH] fixes. --- code/game/objects/items/stunbaton.dm | 12 ++++++++---- code/game/objects/items/teleprod.dm | 5 ++--- code/modules/power/cell.dm | 6 +++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/code/game/objects/items/stunbaton.dm b/code/game/objects/items/stunbaton.dm index 2a22ab8c27..bfe630ba01 100644 --- a/code/game/objects/items/stunbaton.dm +++ b/code/game/objects/items/stunbaton.dm @@ -58,7 +58,9 @@ //if a stun is applied or not copper_top.use(min(chrgdeductamt, copper_top.charge), explode) - if(status && (!(copper_top?.charge) || (chargecheck && copper_top.charge < (hitcost * STUNBATON_CHARGE_LENIENCY)))) + if(QDELETED(src)) + return FALSE + if(status && (!copper_top || !copper_top.charge || (chargecheck && copper_top.charge < (hitcost * STUNBATON_CHARGE_LENIENCY)))) //we're below minimum, turn off switch_status(FALSE) @@ -74,7 +76,6 @@ update_icon() /obj/item/melee/baton/process() - . = ..() deductcharge(hitcost * 0.004, FALSE, FALSE) /obj/item/melee/baton/update_icon() @@ -174,6 +175,7 @@ var/stunpwr = stunforce var/obj/item/stock_parts/cell/our_cell = get_cell() if(!our_cell) + switch_status(FALSE) return FALSE var/stuncharge = our_cell.charge deductcharge(hitcost, FALSE) @@ -181,8 +183,8 @@ return FALSE if(stuncharge < hitcost) if(stuncharge < (hitcost * STUNBATON_CHARGE_LENIENCY)) - L.visible_message("[user] has prodded [L] with [src]. Luckily it is out of charge.", \ - "[user] has prodded you with [src]. Luckily it is out of charge.") + L.visible_message("[user] has prodded [L] with [src]. Luckily it was out of charge.", \ + "[user] has prodded you with [src]. Luckily it was out of charge.") return FALSE stunpwr *= round(stuncharge/hitcost, 0.1) @@ -210,7 +212,9 @@ /obj/item/melee/baton/proc/clowning_around(mob/living/user) user.visible_message("[user] accidentally hits [user.p_them()]self with [src]!", \ "You accidentally hit yourself with [src]!") + SEND_SIGNAL(user, COMSIG_LIVING_MINOR_SHOCK) user.Knockdown(stunforce*3) + playsound(loc, 'sound/weapons/egloves.ogg', 50, 1, -1) deductcharge(hitcost) /obj/item/melee/baton/emp_act(severity) diff --git a/code/game/objects/items/teleprod.dm b/code/game/objects/items/teleprod.dm index c514e5e926..341c85fa1c 100644 --- a/code/game/objects/items/teleprod.dm +++ b/code/game/objects/items/teleprod.dm @@ -10,15 +10,14 @@ . = ..() if(!. || !istype(M) || M.anchored) return - else - SEND_SIGNAL(M, COMSIG_LIVING_MINOR_SHOCK) - do_teleport(M, get_turf(M), 15) + do_teleport(M, get_turf(M), 15) /obj/item/melee/baton/cattleprod/teleprod/clowning_around(mob/living/user) user.visible_message("[user] accidentally hits [user.p_them()]self with [src]!", \ "You accidentally hit yourself with [src]!") SEND_SIGNAL(user, COMSIG_LIVING_MINOR_SHOCK) user.Knockdown(stunforce*3) + playsound(loc, 'sound/weapons/egloves.ogg', 50, 1, -1) if(do_teleport(user, get_turf(user), 50)) deductcharge(hitcost) else diff --git a/code/modules/power/cell.dm b/code/modules/power/cell.dm index 5c1df573b3..3e93d9f42b 100644 --- a/code/modules/power/cell.dm +++ b/code/modules/power/cell.dm @@ -26,7 +26,8 @@ /obj/item/stock_parts/cell/Initialize(mapload, override_maxcharge) . = ..() - START_PROCESSING(SSobj, src) + if(self_recharge) + START_PROCESSING(SSobj, src) create_reagents(5, INJECTABLE | DRAINABLE) if (override_maxcharge) maxcharge = override_maxcharge @@ -103,9 +104,8 @@ return (FIRELOSS) /obj/item/stock_parts/cell/on_reagent_change(changetype) - rigged = !isnull(reagents.has_reagent("plasma", 5)) //has_reagent returns the reagent datum ..() - + rigged = reagents?.has_reagent("plasma", 5) ? TRUE : FALSE //has_reagent returns the reagent datum /obj/item/stock_parts/cell/proc/explode() var/turf/T = get_turf(src.loc)