Merge pull request #9989 from Ghommie/Ghommie-cit410
Ports the energy gun empty state overlay fix.
This commit is contained in:
@@ -144,22 +144,24 @@
|
|||||||
..()
|
..()
|
||||||
if(!automatic_charge_overlays)
|
if(!automatic_charge_overlays)
|
||||||
return
|
return
|
||||||
var/ratio = CEILING(CLAMP(cell.charge / cell.maxcharge, 0, 1) * charge_sections, 1)
|
var/ratio = can_shoot() ? CEILING(CLAMP(cell.charge / cell.maxcharge, 0, 1) * charge_sections, 1) : 0
|
||||||
|
// Sets the ratio to 0 if the gun doesn't have enough charge to fire, or if it's power cell is removed.
|
||||||
|
// TG issues #5361 & #47908
|
||||||
if(ratio == old_ratio && !force_update)
|
if(ratio == old_ratio && !force_update)
|
||||||
return
|
return
|
||||||
old_ratio = ratio
|
old_ratio = ratio
|
||||||
cut_overlays()
|
cut_overlays()
|
||||||
var/obj/item/ammo_casing/energy/shot = ammo_type[select]
|
|
||||||
var/iconState = "[icon_state]_charge"
|
var/iconState = "[icon_state]_charge"
|
||||||
var/itemState = null
|
var/itemState = null
|
||||||
if(!initial(item_state))
|
if(!initial(item_state))
|
||||||
itemState = icon_state
|
itemState = icon_state
|
||||||
if (modifystate)
|
if (modifystate)
|
||||||
|
var/obj/item/ammo_casing/energy/shot = ammo_type[select]
|
||||||
add_overlay("[icon_state]_[shot.select_name]")
|
add_overlay("[icon_state]_[shot.select_name]")
|
||||||
iconState += "_[shot.select_name]"
|
iconState += "_[shot.select_name]"
|
||||||
if(itemState)
|
if(itemState)
|
||||||
itemState += "[shot.select_name]"
|
itemState += "[shot.select_name]"
|
||||||
if(cell.charge < shot.e_cost)
|
if(ratio == 0)
|
||||||
add_overlay("[icon_state]_empty")
|
add_overlay("[icon_state]_empty")
|
||||||
else
|
else
|
||||||
if(!shaded_charge)
|
if(!shaded_charge)
|
||||||
|
|||||||
Reference in New Issue
Block a user