From 8c6cd7b28f4ebbc71b7187f16558ac94bc6033c6 Mon Sep 17 00:00:00 2001 From: phil235 Date: Mon, 2 Jun 2014 00:42:23 +0200 Subject: [PATCH 1/3] Stunprod Fix * Fix icon not updating when turning off baton/stunprod with a total cell charge below the hitcost. * Baton/stunprod no longer accepts cell with capacity below the hitcost(charge used per stun). * Removes being able to give one last hit (that doesn't even deduct any charge) when the cell charge gets below the hitcost. * Adds warning message when baton/stunprod turns off from being out of charge. --- code/game/objects/items/weapons/stunbaton.dm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm index bc37ba6662f..686757aafcf 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() + user << "[src] is out of charge." if(bcell.use(chrgdeductamt)) return 1 else - status = 0 - update_icon() return 0 /obj/item/weapon/melee/baton/update_icon() @@ -60,14 +62,17 @@ /obj/item/weapon/melee/baton/attackby(obj/item/weapon/W, mob/user) if(istype(W, /obj/item/weapon/stock_parts/cell)) - if(!bcell) + if(bcell) + user << "[src] already has a cell." + else + if(W.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 +91,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 +163,4 @@ throwforce = 5 stunforce = 5 hitcost = 2500 - slot_flags = null \ No newline at end of file + slot_flags = null From 2be11ab55ec1023946f0c3d6cf7e5281b39c9c21 Mon Sep 17 00:00:00 2001 From: phil235 Date: Mon, 2 Jun 2014 01:01:16 +0200 Subject: [PATCH 2/3] Fix --- code/game/objects/items/weapons/stunbaton.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm index 686757aafcf..238674da1e1 100644 --- a/code/game/objects/items/weapons/stunbaton.dm +++ b/code/game/objects/items/weapons/stunbaton.dm @@ -38,7 +38,7 @@ 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() - user << "[src] is out of charge." + usr << "[src] is out of charge." if(bcell.use(chrgdeductamt)) return 1 else @@ -62,10 +62,11 @@ /obj/item/weapon/melee/baton/attackby(obj/item/weapon/W, mob/user) if(istype(W, /obj/item/weapon/stock_parts/cell)) + var/obj/item/weapon/stock_parts/cell/C = W if(bcell) user << "[src] already has a cell." else - if(W.maxcharge < hitcost) + if(C.maxcharge < hitcost) user << "[src] requires a higher capacity cell." return user.drop_item() From 40fbe585ba5ed0ce23d8d72902bbb491f1e40785 Mon Sep 17 00:00:00 2001 From: phil235 Date: Mon, 2 Jun 2014 01:42:50 +0200 Subject: [PATCH 3/3] Warning message replaced by sparks sound --- code/game/objects/items/weapons/stunbaton.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm index 238674da1e1..cf6061596dd 100644 --- a/code/game/objects/items/weapons/stunbaton.dm +++ b/code/game/objects/items/weapons/stunbaton.dm @@ -38,7 +38,7 @@ 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() - usr << "[src] is out of charge." + playsound(loc, "sparks", 75, 1, -1) if(bcell.use(chrgdeductamt)) return 1 else