Fixes modular gun sprites (#8179)

This commit is contained in:
Geeves
2020-02-03 19:35:27 +01:00
committed by GitHub
parent 12caad2805
commit 3fa90097f0
6 changed files with 32 additions and 15 deletions
+6 -2
View File
@@ -8,6 +8,7 @@
fire_sound_text = "laser blast"
update_icon_on_init = TRUE
var/has_icon_ratio = TRUE // Does this gun use the ratio system to modify its icon_state?
var/has_item_ratio = TRUE // Does this gun use the ratio system to paint its item_states?
var/obj/item/cell/power_supply //What type of power cell this uses
@@ -110,6 +111,7 @@
..()
if(charge_meter && power_supply && power_supply.maxcharge)
var/ratio = power_supply.charge / power_supply.maxcharge
var/icon_state_ratio = ""
var/item_state_ratio = ""
//make sure that rounding down will not give us the empty state even if we have charge for a shot left.
@@ -118,13 +120,15 @@
else
ratio = max(round(ratio, 0.25) * 100, 25)
if(has_icon_ratio)
icon_state_ratio = ratio
if(has_item_ratio)
item_state_ratio = ratio
if(modifystate)
icon_state = "[modifystate][ratio]"
icon_state = "[modifystate][icon_state_ratio]"
item_state = "[modifystate][item_state_ratio]"
else
icon_state = "[initial(icon_state)][ratio]"
icon_state = "[initial(icon_state)][icon_state_ratio]"
item_state = "[initial(item_state)][item_state_ratio]"
update_held_icon()
@@ -1,8 +1,10 @@
/obj/item/gun/energy/laser/prototype
name = "laser prototype"
desc = "A custom prototype laser weapon."
icon_state = "energykill"
item_state = "energykill"
icon = 'icons/obj/guns/modular_laser.dmi'
contained_sprite = TRUE
has_icon_ratio = FALSE
has_item_ratio = FALSE
fire_sound = 'sound/weapons/Laser.ogg'
slot_flags = SLOT_BELT|SLOT_BACK
w_class = 3
@@ -50,9 +52,9 @@
..()
if(origin_chassis == CHASSIS_LARGE)
if(wielded)
item_state = "heavyprotogun_wielded"
item_state = "large_3_wielded"
else
item_state = "heavyprotogun"
item_state = "large_3"
update_held_icon()
/obj/item/gun/energy/laser/prototype/proc/reset_vars()
@@ -118,18 +120,18 @@
/obj/item/gun/energy/laser/prototype/proc/update_chassis()
switch(origin_chassis)
if(CHASSIS_SMALL)
gun_type = CHASSIS_SMALL
gun_type = CHASSIS_SMALL
slot_flags = SLOT_BELT | SLOT_HOLSTER
item_state = "retro"
item_state = "small_3"
if(CHASSIS_MEDIUM)
gun_type = CHASSIS_MEDIUM
slot_flags = SLOT_BELT | SLOT_BACK
item_state = "energystun"
item_state = "medium_3"
is_wieldable = TRUE
if(CHASSIS_LARGE)
gun_type = CHASSIS_LARGE
slot_flags = SLOT_BACK
item_state = "heavyprotogun"
item_state = "large_3"
is_wieldable = TRUE
update_wield_verb()
@@ -321,4 +323,4 @@
desc = input
to_chat(M, "You describe the gun as [input]. Say hello to your new friend.")
described = 1
return 1
return 1
@@ -1,6 +1,7 @@
/obj/item/laser_components
icon = 'icons/obj/modular_laser.dmi'
icon = 'icons/obj/guns/modular_laser.dmi'
icon_state = "bfg"
contained_sprite = TRUE
var/reliability = 0
var/damage = 1
var/fire_delay = 0
@@ -139,8 +140,9 @@
name = "laser assembly (small)"
desc = "A case for shoving things into. Hopefully they work."
w_class = 2
icon = 'icons/obj/modular_laser.dmi'
icon = 'icons/obj/guns/modular_laser.dmi'
icon_state = "small"
contained_sprite = TRUE
var/stage = 1
var/size = CHASSIS_SMALL
var/modifier_cap = 3
@@ -194,6 +196,8 @@
/obj/item/device/laser_assembly/proc/finish()
var/obj/item/gun/energy/laser/prototype/A = new /obj/item/gun/energy/laser/prototype
A.icon_state = icon_state
A.modifystate = icon_state
A.origin_chassis = size
A.capacitor = capacitor
capacitor.forceMove(A)
@@ -205,11 +209,12 @@
for(var/obj/item/laser_components/modifier/mod in gun_mods)
A.gun_mods += mod
mod.forceMove(A)
if(mod.gun_overlay)
A.underlays += mod.gun_overlay
A.forceMove(get_turf(src))
A.icon = getFlatIcon(src)
A.updatetype()
A.pin = null
gun_mods = null
focusing_lens = null
capacitor = null
qdel(src)
qdel(src)