Now you can have proper fancy energy guns (#19272)

This commit is contained in:
Vi3trice
2022-10-10 15:07:09 -04:00
committed by GitHub
parent 25e609178b
commit 2d58bc6066
2 changed files with 7 additions and 3 deletions

View File

@@ -21,6 +21,8 @@
/// Do you want the gun to fit into a turret, defaults to true, used for if a energy gun is too strong to be in a turret, or does not make sense to be in one.
var/can_fit_in_turrets = TRUE
var/new_icon_state
/// If the item uses a shared set of overlays instead of being based on icon_state
var/overlay_set
/// Used when updating icon and overlays to determine the energy pips
var/ratio
@@ -174,17 +176,18 @@
/obj/item/gun/energy/update_overlays()
. = ..()
var/overlay_name = overlay_set ? overlay_set : icon_state
var/obj/item/ammo_casing/energy/shot = ammo_type[select]
if(modifystate)
. += "[icon_state]_[shot.select_name]"
. += "[overlay_name]_[shot.select_name]"
if(cell.charge < shot.e_cost)
. += "[icon_state]_empty"
. += "[overlay_name]_empty"
else
if(!shaded_charge)
for(var/i = ratio, i >= 1, i--)
. += image(icon = icon, icon_state = new_icon_state, pixel_x = ammo_x_offset * (i -1))
else
. += image(icon = icon, icon_state = "[icon_state]_[modifystate ? "[shot.select_name]_" : ""]charge[ratio]")
. += image(icon = icon, icon_state = "[overlay_name]_[modifystate ? "[shot.select_name]_" : ""]charge[ratio]")
if(gun_light && can_flashlight)
var/iconF = "flight"
if(gun_light.on)

View File

@@ -772,6 +772,7 @@
unique_reskin = TRUE
charge_sections = 5
inhand_charge_sections = 3
overlay_set = "handgun" // Reskins are a different icon_state
/obj/item/gun/energy/detective/Initialize(mapload, ...)
. = ..()