Merge pull request #3832 from phil235/StunprodFix

Stunprod Fix
This commit is contained in:
Alex
2014-06-05 21:40:45 +01:00
+13 -7
View File
@@ -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 << "<span class='notice'>[src] already has a cell.</span>"
else
if(C.maxcharge < hitcost)
user << "<span class='notice'>[src] requires a higher capacity cell.</span>"
return
user.drop_item()
W.loc = src
bcell = W
user << "<span class='notice'>You install a cell in [src].</span>"
update_icon()
else
user << "<span class='notice'>[src] already has a cell.</span>"
else if(istype(W, /obj/item/weapon/screwdriver))
if(bcell)
@@ -86,13 +92,13 @@
status = !status
user << "<span class='notice'>[src] is now [status ? "on" : "off"].</span>"
playsound(loc, "sparks", 75, 1, -1)
update_icon()
else
status = 0
if(!bcell)
user << "<span class='warning'>[src] does not have a power source!</span>"
else
user << "<span class='warning'>[src] is out of charge.</span>"
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
slot_flags = null