Fix meter

This commit is contained in:
Markolie
2015-02-13 14:25:54 +01:00
parent 8144cf030c
commit 91def7da63
+20 -25
View File
@@ -24,23 +24,15 @@
/obj/machinery/meter/process()
if(!target)
icon_state = "meterX"
// Pop the meter off when the pipe we're attached to croaks.
new /obj/item/pipe_meter(src.loc)
spawn(0) del(src)
return 0
if(stat & (BROKEN|NOPOWER))
icon_state = "meter0"
return 0
//use_power(5)
var/datum/gas_mixture/environment = target.return_air()
if(!environment)
icon_state = "meterX"
// Pop the meter off when the environment we're attached to croaks.
new /obj/item/pipe_meter(src.loc)
spawn(0) del(src)
return 0
var/env_pressure = environment.return_pressure()
@@ -87,28 +79,31 @@
return t
/obj/machinery/meter/examine()
set src in view(3)
var/t = "A gas flow meter. "
t += status()
if(get_dist(usr, src) > 3 && !(istype(usr, /mob/living/silicon/ai) || istype(usr, /mob/dead)))
t += "\blue <B>You are too far away to read it.</B>"
else if(stat & (NOPOWER|BROKEN))
t += "\red <B>The display is off.</B>"
else if(src.target)
var/datum/gas_mixture/environment = target.return_air()
if(environment)
t += "The pressure gauge reads [round(environment.return_pressure(), 0.01)] kPa; [round(environment.temperature,0.01)]K ([round(environment.temperature-T0C,0.01)]&deg;C)"
else
t += "The sensor error light is blinking."
else
t += "The connect error light is blinking."
usr << t
/obj/machinery/meter/Click()
if(stat & (NOPOWER|BROKEN))
if(istype(usr, /mob/living/silicon/ai)) // ghosts can call ..() for examine
usr.examine(src)
return 1
var/t = null
if (get_dist(usr, src) <= 3 || istype(usr, /mob/living/silicon/ai) || istype(usr, /mob/dead))
t += status()
else
usr << "\blue <B>You are too far away.</B>"
return 1
usr << t
return 1
return ..()
/obj/machinery/meter/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
if (!istype(W, /obj/item/weapon/wrench))