From 59bc79057cf39a2fac2e797f09c0e44cd4f9e34b Mon Sep 17 00:00:00 2001 From: ShizCalev Date: Sun, 5 Jul 2020 18:22:18 -0400 Subject: [PATCH] Unfucks worn gun icons again --- code/modules/projectiles/guns/energy.dm | 26 +++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index dfb0a93f8d0..cdfdf26a41c 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -6,7 +6,7 @@ var/obj/item/stock_parts/cell/cell //What type of power cell this uses var/cell_type = /obj/item/stock_parts/cell - var/modifystate = 0 + var/modifystate = FALSE ///if the weapon has custom icons for individual ammo types it can switch between. ie disabler beams, taser, laser/lethals, ect. var/list/ammo_type = list(/obj/item/ammo_casing/energy) var/select = 1 //The state of the select fire switch. Determines from the ammo_type list what kind of shot is fired next. var/can_charge = TRUE //Can it be charged in a recharger? @@ -140,21 +140,23 @@ return /obj/item/gun/energy/update_icon_state() - if(initial(inhand_icon_state)) + var/skip_inhand = initial(inhand_icon_state) //only build if we aren't using a preset inhand icon + var/skip_worn_icon = initial(worn_icon_state) //only build if we aren't using a preset worn icon + + if(skip_inhand && skip_worn_icon) //if we don't have either, don't do the math. return + var/ratio = get_charge_ratio() - var/new_inhand_icon_state = "" - var/new_worn_icon_state = "" - new_inhand_icon_state = initial(icon_state) - new_worn_icon_state = initial(icon_state) + var/temp_icon_to_use = initial(icon_state) if(modifystate) var/obj/item/ammo_casing/energy/shot = ammo_type[select] - new_inhand_icon_state += "[shot.select_name]" - new_worn_icon_state += "[shot.select_name]" - new_inhand_icon_state += "[ratio]" - new_worn_icon_state += "[ratio*25]" - inhand_icon_state = new_inhand_icon_state - worn_icon_state = new_worn_icon_state + temp_icon_to_use += "[shot.select_name]" + + if(!skip_inhand) + inhand_icon_state = "[temp_icon_to_use][ratio]" + if(!skip_worn_icon) + worn_icon_state = "[temp_icon_to_use][ratio*25]" + /obj/item/gun/energy/update_overlays() . = ..()