mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Fixing some infinite loops in gun update_icon() calls.
This commit is contained in:
@@ -32,7 +32,7 @@
|
|||||||
if(istype(M) && !issmall(M) && ((M.r_hand == src && !M.l_hand) || (M.l_hand == src && !M.r_hand)))
|
if(istype(M) && !issmall(M) && ((M.r_hand == src && !M.l_hand) || (M.l_hand == src && !M.r_hand)))
|
||||||
wielded = 1
|
wielded = 1
|
||||||
force = force_wielded
|
force = force_wielded
|
||||||
name = "[base_name] (Wielded)"
|
name = "[base_name] (wielded)"
|
||||||
update_icon()
|
update_icon()
|
||||||
else
|
else
|
||||||
wielded = 0
|
wielded = 0
|
||||||
|
|||||||
@@ -94,10 +94,12 @@
|
|||||||
var/mob/living/M = loc
|
var/mob/living/M = loc
|
||||||
if(istype(M))
|
if(istype(M))
|
||||||
if((M.l_hand == src && !M.r_hand) || (M.r_hand == src && !M.l_hand))
|
if((M.l_hand == src && !M.r_hand) || (M.r_hand == src && !M.l_hand))
|
||||||
|
name = "[initial(name)] (wielded)"
|
||||||
item_state = wielded_icon
|
item_state = wielded_icon
|
||||||
else
|
else
|
||||||
|
name = initial(name)
|
||||||
item_state = initial(item_state)
|
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
|
//Checks whether a given mob can use the gun
|
||||||
@@ -177,7 +179,6 @@
|
|||||||
var/held_acc_mod = 0
|
var/held_acc_mod = 0
|
||||||
var/held_disp_mod = 0
|
var/held_disp_mod = 0
|
||||||
if(requires_two_hands)
|
if(requires_two_hands)
|
||||||
update_held_icon()
|
|
||||||
if((user.l_hand == src && user.r_hand) || (user.r_hand == src && user.l_hand))
|
if((user.l_hand == src && user.r_hand) || (user.r_hand == src && user.l_hand))
|
||||||
held_acc_mod = -3
|
held_acc_mod = -3
|
||||||
held_disp_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"].")
|
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
|
//update timing
|
||||||
user.setClickCooldown(4)
|
user.setClickCooldown(4)
|
||||||
user.setMoveCooldown(move_delay)
|
user.setMoveCooldown(move_delay)
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
user << "Has [shots_remaining] shot\s remaining."
|
user << "Has [shots_remaining] shot\s remaining."
|
||||||
return
|
return
|
||||||
|
|
||||||
/obj/item/weapon/gun/energy/update_icon()
|
/obj/item/weapon/gun/energy/update_icon(var/ignore_inhands)
|
||||||
if(charge_meter)
|
if(charge_meter)
|
||||||
var/ratio = power_supply.charge / power_supply.maxcharge
|
var/ratio = power_supply.charge / power_supply.maxcharge
|
||||||
|
|
||||||
@@ -100,4 +100,4 @@
|
|||||||
icon_state = "[modifystate][ratio]"
|
icon_state = "[modifystate][ratio]"
|
||||||
else
|
else
|
||||||
icon_state = "[initial(icon_state)][ratio]"
|
icon_state = "[initial(icon_state)][ratio]"
|
||||||
update_held_icon()
|
if(!ignore_inhands) update_held_icon()
|
||||||
|
|||||||
@@ -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)),
|
// 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"
|
icon_state = (ammo_magazine)? "arifle" : "arifle-empty"
|
||||||
update_held_icon()
|
if(!ignore_inhands) update_held_icon()
|
||||||
|
|
||||||
/obj/item/weapon/gun/projectile/automatic/wt550
|
/obj/item/weapon/gun/projectile/automatic/wt550
|
||||||
name = "machine pistol"
|
name = "machine pistol"
|
||||||
|
|||||||
Reference in New Issue
Block a user