-Fixed an issue with the light replacer not recharging properly.

-Reorganized the light replacer a bit.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4124 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
giacomand@gmail.com
2012-07-20 03:23:29 +00:00
parent 285f31f0c4
commit b1e63422be
3 changed files with 65 additions and 53 deletions
+4 -41
View File
@@ -354,49 +354,12 @@
//Light replacer code
if(istype(W, /obj/item/device/lightreplacer))
if(status != LIGHT_OK)
if(isliving(user))
var/obj/item/device/lightreplacer/LR = W
var/mob/living/U = user
if(LR.CanUse(U))
if(!LR.Use(U)) return
U << "<span class='notice'>You replace the [src.fitting] with the [W].</span>"
if(status != LIGHT_EMPTY)
var/obj/item/weapon/light/L1 = new light_type(src.loc)
L1.status = status
L1.rigged = rigged
L1.brightness = src.brightness
L1.switchcount = switchcount
switchcount = 0
L1.update()
status = LIGHT_EMPTY
update()
var/obj/item/weapon/light/L2 = new light_type()
status = L2.status
switchcount = L2.switchcount
rigged = LR.emagged
brightness = L2.brightness
on = has_power()
update()
del(L2)
// Leaving this here in case I get the go ahead to make emagged light replacers to insert rigged lights
if(on && rigged)
explode()
return
else
user << LR.failmsg
return
else
user << "There is a working [fitting] already inserted."
var/obj/item/device/lightreplacer/LR = W
if(isliving(user))
var/mob/living/U = user
LR.ReplaceLight(src, U)
return
// attempt to insert light
if(istype(W, /obj/item/weapon/light))
if(status != LIGHT_EMPTY)