Unfucks worn gun icons again

This commit is contained in:
ShizCalev
2020-07-05 18:22:18 -04:00
parent 2e19ebc6cf
commit 59bc79057c
+14 -12
View File
@@ -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()
. = ..()