Fixing ionrifle back sprites (#5713)

Fixes #5711
This commit is contained in:
Mykhailo Bykhovtsev
2018-12-08 14:51:26 -08:00
committed by Werner
parent 68104f9f02
commit 1939a3f69c
3 changed files with 56 additions and 1 deletions

View File

@@ -2,7 +2,7 @@
name = "ion rifle"
desc = "The NT Mk70 EW Halicon is a man portable anti-armor weapon designed to disable mechanical threats, produced by NT. Has two settings: stun and kill"
icon_state = "ionriflestun100"
item_state = null // so the human update icon uses the icon_state instead.
item_state = "ionriflestun100" // so the human update icon uses the icon_state instead.
modifystate = "ionriflestun"
projectile_type = /obj/item/projectile/ion/stun
fire_sound = 'sound/weapons/Laser.ogg'
@@ -28,6 +28,24 @@
/obj/item/weapon/gun/energy/rifle/ionrifle/emp_act(severity)
..(max(severity, 2)) //so it doesn't EMP itself, I guess
/obj/item/weapon/gun/energy/rifle/ionrifle/update_icon()
if(charge_meter && power_supply && power_supply.maxcharge)
var/ratio = power_supply.charge / power_supply.maxcharge
//make sure that rounding down will not give us the empty state even if we have charge for a shot left.
if(power_supply.charge < charge_cost)
ratio = 0
else
ratio = max(round(ratio, 0.25) * 100, 25)
if(modifystate)
icon_state = "[modifystate][ratio]"
item_state = "[modifystate][ratio]"
else
icon_state = "[initial(icon_state)][ratio]"
item_state = "[initial(icon_state)][ratio]"
update_held_icon()
/obj/item/weapon/gun/energy/rifle/ionrifle/mounted
name = "mounted ion rifle"
self_recharge = 1