[READY] Adds ability to add bayonets to weapons - Only enabled on kinetic accelerators - refactors gunlight/bayonet sprites to ballistics too (#1191)

This commit is contained in:
CitadelStationBot
2017-05-27 15:36:44 -05:00
committed by kevinz000
parent 833c0c549c
commit e9d00c2aff
6 changed files with 98 additions and 65 deletions
+4 -9
View File
@@ -10,6 +10,7 @@
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 = 1 //Can it be charged in a recharger?
var/automatic_charge_overlays = TRUE //Do we handle overlays with base update_icon()?
var/charge_sections = 4
ammo_x_offset = 2
var/shaded_charge = 0 //if this gun uses a stateful charge bar for more detail
@@ -116,7 +117,9 @@
return
/obj/item/weapon/gun/energy/update_icon()
cut_overlays()
..()
if(!automatic_charge_overlays)
return
var/ratio = Ceiling((power_supply.charge / power_supply.maxcharge) * charge_sections)
var/obj/item/ammo_casing/energy/shot = ammo_type[select]
var/iconState = "[icon_state]_charge"
@@ -138,14 +141,6 @@
add_overlay(charge_overlay)
else
add_overlay("[icon_state]_charge[ratio]")
if(gun_light && can_flashlight)
var/iconF = "flight"
if(gun_light.on)
iconF = "flight_on"
var/mutable_appearance/flashlight_overlay = mutable_appearance(icon, iconF)
flashlight_overlay.pixel_x = flight_x_offset
flashlight_overlay.pixel_y = flight_y_offset
add_overlay(flashlight_overlay)
if(itemState)
itemState += "[ratio]"
item_state = itemState
@@ -16,6 +16,9 @@
var/holds_charge = FALSE
var/unique_frequency = FALSE // modified by KA modkits
var/overheat = FALSE
can_bayonet = TRUE
knife_x_offset = 15
knife_y_offset = 13
var/max_mod_capacity = 100
var/list/modkits = list()
@@ -129,19 +132,11 @@
overheat = FALSE
/obj/item/weapon/gun/energy/kinetic_accelerator/update_icon()
cut_overlays()
..()
if(empty_state && !can_shoot())
add_overlay(empty_state)
if(gun_light && can_flashlight)
var/iconF = "flight"
if(gun_light.on)
iconF = "flight_on"
var/mutable_appearance/flashlight_overlay = mutable_appearance(icon, iconF)
flashlight_overlay.pixel_x = flight_x_offset
flashlight_overlay.pixel_y = flight_y_offset
add_overlay(flashlight_overlay)
//Casing
/obj/item/ammo_casing/energy/kinetic
projectile_type = /obj/item/projectile/kinetic