Fixing some infinite loops in gun update_icon() calls.

This commit is contained in:
Zuhayr
2016-01-22 04:22:49 +10:30
parent 8f3b545b10
commit ab9574ee06
4 changed files with 8 additions and 9 deletions

View File

@@ -94,10 +94,12 @@
var/mob/living/M = loc
if(istype(M))
if((M.l_hand == src && !M.r_hand) || (M.r_hand == src && !M.l_hand))
name = "[initial(name)] (wielded)"
item_state = wielded_icon
else
name = initial(name)
item_state = initial(item_state)
update_icon() // In case item_state is set somewhere else.
update_icon(ignore_inhands=1) // In case item_state is set somewhere else.
..()
//Checks whether a given mob can use the gun
@@ -177,7 +179,6 @@
var/held_acc_mod = 0
var/held_disp_mod = 0
if(requires_two_hands)
update_held_icon()
if((user.l_hand == src && user.r_hand) || (user.r_hand == src && user.l_hand))
held_acc_mod = -3
held_disp_mod = 3
@@ -210,8 +211,6 @@
admin_attack_log(usr, attacker_message="Fired [src]", admin_message="fired a gun ([src]) (MODE: [src.mode_name]) [reflex ? "by reflex" : "manually"].")
update_held_icon()
//update timing
user.setClickCooldown(4)
user.setMoveCooldown(move_delay)

View File

@@ -86,7 +86,7 @@
user << "Has [shots_remaining] shot\s remaining."
return
/obj/item/weapon/gun/energy/update_icon()
/obj/item/weapon/gun/energy/update_icon(var/ignore_inhands)
if(charge_meter)
var/ratio = power_supply.charge / power_supply.maxcharge
@@ -100,4 +100,4 @@
icon_state = "[modifystate][ratio]"
else
icon_state = "[initial(icon_state)][ratio]"
update_held_icon()
if(!ignore_inhands) update_held_icon()

View File

@@ -71,10 +71,10 @@
// list(mode_name="short bursts", burst=5, fire_delay=null, move_delay=6, burst_accuracy=list(0,-1,-2,-2,-3), dispersion=list(0.6, 1.0, 1.0, 1.0, 1.2)),
)
/obj/item/weapon/gun/projectile/automatic/sts35/update_icon()
/obj/item/weapon/gun/projectile/automatic/sts35/update_icon(var/ignore_inhands)
..()
icon_state = (ammo_magazine)? "arifle" : "arifle-empty"
update_held_icon()
if(!ignore_inhands) update_held_icon()
/obj/item/weapon/gun/projectile/automatic/wt550
name = "machine pistol"