Files
CHOMPStation2/code/modules/virus2/analyser.dm
Ccomp5950 bb9a66cc3a Effeciency Project: APC / Machinery power usage.
We no longer run auto_use_power() on every machine every tick.
We now have a global list of areas, and areas that have an APC in them (all_areas and active_areas) no more looping through world bullshit.
A bunch of snowflakey as fuck machines won't use_power() in their process, you get two options, active and idle, use them!
This means a lot of machines won't double dip on power as well so power usage for the station has dropped about 20%

Because everything is snowflakey as fuck we're going to have some machines that don't force an update on their power usage.  Fuck them.
We should catch them with the root obj/machine/proc's forcing updates.
2014-03-08 03:42:44 -06:00

64 lines
1.5 KiB
Plaintext

/obj/machinery/disease2/diseaseanalyser
name = "Disease Analyser"
icon = 'icons/obj/virology.dmi'
icon_state = "analyser"
anchored = 1
density = 1
var/scanning = 0
var/pause = 0
var/obj/item/weapon/virusdish/dish = null
/obj/machinery/disease2/diseaseanalyser/attackby(var/obj/I as obj, var/mob/user as mob)
if(istype(I,/obj/item/weapon/virusdish))
var/mob/living/carbon/c = user
if(!dish)
dish = I
c.drop_item()
I.loc = src
for(var/mob/M in viewers(src))
if(M == user) continue
M.show_message("\blue [user.name] inserts the [dish.name] in the [src.name]", 3)
else
user << "There is already a dish inserted"
return
/obj/machinery/disease2/diseaseanalyser/process()
if(stat & (NOPOWER|BROKEN))
return
//use_power(500)
if(scanning)
scanning -= 1
if(scanning == 0)
var/r = dish.virus2.get_info()
var/obj/item/weapon/paper/P = new /obj/item/weapon/paper(src.loc)
P.info = r
dish.info = r
dish.analysed = 1
if (dish.virus2.addToDB())
src.state("\The [src.name] states, \"Added new pathogen to database.\"")
dish.loc = src.loc
dish = null
icon_state = "analyser"
src.state("\The [src.name] prints a sheet of paper")
else if(dish && !scanning && !pause)
if(dish.virus2 && dish.growth > 50)
dish.growth -= 10
scanning = 5
icon_state = "analyser_processing"
else
pause = 1
spawn(25)
dish.loc = src.loc
dish = null
src.state("\The [src.name] buzzes")
pause = 0
return