Penitence for the awful mistakes I have done in the refactor.

This commit is contained in:
Ghommie
2019-06-12 23:06:09 +02:00
parent 5a35e95735
commit a29095cbe1
+13 -13
View File
@@ -22,7 +22,11 @@
var/preload_cell_type //if not empty the baton starts with this type of cell
/obj/item/melee/baton/get_cell()
return cell
var/obj/item/stock_parts/cell/our_cell = cell
if(iscyborg(loc))
var/mob/living/silicon/robot/R = loc
our_cell = R.get_cell()
return our_cell
/obj/item/melee/baton/suicide_act(mob/user)
user.visible_message("<span class='suicide'>[user] is putting the live [name] in [user.p_their()] mouth! It looks like [user.p_theyre()] trying to commit suicide!</span>")
@@ -47,10 +51,7 @@
preload_cell_type = /obj/item/stock_parts/cell/high
/obj/item/melee/baton/proc/deductcharge(chrgdeductamt, chargecheck = TRUE, explode = TRUE)
var/obj/item/stock_parts/cell/copper_top = cell
if(iscyborg(loc))
var/mob/living/silicon/robot/R = loc
copper_top = R.cell
var/obj/item/stock_parts/cell/copper_top = get_cell()
if(!copper_top)
switch_status(FALSE, TRUE)
return FALSE
@@ -86,9 +87,10 @@
icon_state = "[initial(name)]"
/obj/item/melee/baton/examine(mob/user)
..()
if(cell)
to_chat(user, "<span class='notice'>\The [src] is [round(cell.percent())]% charged.</span>")
. = ..()
var/obj/item/stock_parts/cell/copper_top = get_cell()
if(copper_top)
to_chat(user, "<span class='notice'>\The [src] is [round(copper_top.percent())]% charged.</span>")
else
to_chat(user, "<span class='warning'>\The [src] does not have a power source installed.</span>")
@@ -118,10 +120,7 @@
return ..()
/obj/item/melee/baton/attack_self(mob/user)
var/obj/item/stock_parts/cell/copper_top = cell
if(iscyborg(loc))
var/mob/living/silicon/robot/R = loc
copper_top = R.cell
var/obj/item/stock_parts/cell/copper_top = get_cell()
if(!copper_top || copper_top.charge < (hitcost * STUNBATON_CHARGE_LENIENCY))
switch_status(FALSE, TRUE)
if(!copper_top)
@@ -222,7 +221,8 @@
. = ..()
if (!(. & EMP_PROTECT_SELF))
switch_status(FALSE)
deductcharge(1000 / severity, TRUE, FALSE)
if(!iscyborg(loc))
deductcharge(1000 / severity, TRUE, FALSE)
//Makeshift stun baton. Replacement for stun gloves.
/obj/item/melee/baton/cattleprod