Merge pull request #10861 from mwerezak/flashlight

Clean up of the flashlight icon fix
This commit is contained in:
GinjaNinja32
2015-08-24 22:17:57 +01:00
+8 -16
View File
@@ -16,14 +16,9 @@
/obj/item/device/flashlight/initialize()
..()
if(on)
icon_state = "[initial(icon_state)]-on"
set_light(brightness_on)
else
icon_state = "[initial(icon_state)]"
set_light(0)
update_icon()
/obj/item/device/flashlight/proc/update_brightness(var/mob/user = null)
/obj/item/device/flashlight/update_icon()
if(on)
icon_state = "[initial(icon_state)]-on"
set_light(brightness_on)
@@ -36,7 +31,7 @@
user << "You cannot turn the light on while in this [user.loc]." //To prevent some lighting anomalities.
return 0
on = !on
update_brightness(user)
update_icon()
return 1
@@ -165,11 +160,7 @@
on = 0
src.force = initial(src.force)
src.damtype = initial(src.damtype)
if(ismob(loc))
var/mob/U = loc
update_brightness(U)
else
update_brightness(null)
update_icon()
/obj/item/device/flashlight/flare/attack_self(mob/user)
@@ -200,10 +191,11 @@
on = 1 //Bio-luminesence has one setting, on.
/obj/item/device/flashlight/slime/New()
..()
set_light(brightness_on)
spawn(1) //Might be sloppy, but seems to be necessary to prevent further runtimes and make these work as intended... don't judge me!
update_brightness()
icon_state = initial(icon_state)
/obj/item/device/flashlight/slime/update_icon()
return
/obj/item/device/flashlight/slime/attack_self(mob/user)
return //Bio-luminescence does not toggle.