Fixes icons and other things not updating when the master controller updates power status.

This was due to the master controller using update_powered_status()
instead of power_change(), but many machines override power_change() to
do various things when the machine gains or loses power.
This commit is contained in:
mwerezak
2014-08-10 03:08:34 -04:00
parent 4b070a2de6
commit e1dc7d436b
25 changed files with 95 additions and 132 deletions

View File

@@ -300,7 +300,7 @@ datum/controller/game_controller/proc/process_machines_power()
if(M) if(M)
//check if the area has power for M's channel //check if the area has power for M's channel
//this will keep stat updated in case the machine is moved from one area to another. //this will keep stat updated in case the machine is moved from one area to another.
M.update_powered_status(A) //we've already made sure A is a master area, above. M.power_change(A) //we've already made sure A is a master area, above.
if(!(M.stat & NOPOWER) && M.use_power) if(!(M.stat & NOPOWER) && M.use_power)
M.auto_use_power() M.auto_use_power()

View File

@@ -276,15 +276,15 @@
del(src) del(src)
/obj/machinery/computer/scan_consolenew/power_change() /obj/machinery/computer/scan_consolenew/power_change()
..()
if(stat & BROKEN) if(stat & BROKEN)
icon_state = "broken" icon_state = "broken"
else if(powered())
icon_state = initial(icon_state)
stat &= ~NOPOWER
else else
spawn(rand(0, 15)) if (stat & NOPOWER)
src.icon_state = "c_unpowered" spawn(rand(0, 15))
stat |= NOPOWER src.icon_state = "c_unpowered"
else
icon_state = initial(icon_state)
/obj/machinery/computer/scan_consolenew/New() /obj/machinery/computer/scan_consolenew/New()
..() ..()

View File

@@ -142,9 +142,6 @@
return return
/obj/machinery/sleep_console/power_change()
return
// no change - sleeper works without power (you just can't inject more)

View File

@@ -159,15 +159,15 @@
del(src) del(src)
/obj/machinery/body_scanconsole/power_change() /obj/machinery/body_scanconsole/power_change()
..()
if(stat & BROKEN) if(stat & BROKEN)
icon_state = "body_scannerconsole-p" icon_state = "body_scannerconsole-p"
else if(powered())
icon_state = initial(icon_state)
stat &= ~NOPOWER
else else
spawn(rand(0, 15)) if (stat & NOPOWER)
src.icon_state = "body_scannerconsole-p" spawn(rand(0, 15))
stat |= NOPOWER src.icon_state = "body_scannerconsole-p"
else
icon_state = initial(icon_state)
/obj/machinery/body_scanconsole /obj/machinery/body_scanconsole
var/obj/machinery/bodyscanner/connected var/obj/machinery/bodyscanner/connected

View File

@@ -14,14 +14,14 @@
req_access = list(access_ai_upload) req_access = list(access_ai_upload)
/obj/machinery/ai_slipper/power_change() /obj/machinery/ai_slipper/power_change()
..()
if(stat & BROKEN) if(stat & BROKEN)
return return
else else
if( powered() ) if (stat & NOPOWER)
stat &= ~NOPOWER
else
icon_state = "motion0" icon_state = "motion0"
stat |= NOPOWER else
icon_state = initial(icon_state)
/obj/machinery/ai_slipper/proc/setState(var/enabled, var/uses) /obj/machinery/ai_slipper/proc/setState(var/enabled, var/uses)
src.disabled = disabled src.disabled = disabled

View File

@@ -1156,10 +1156,7 @@ table tr:first-child th:first-child { border: none;}
return ..() return ..()
/obj/machinery/alarm/power_change() /obj/machinery/alarm/power_change()
if(powered(power_channel)) ..()
stat &= ~NOPOWER
else
stat |= NOPOWER
spawn(rand(0,15)) spawn(rand(0,15))
update_icon() update_icon()
@@ -1367,13 +1364,9 @@ FIRE ALARM
return return
/obj/machinery/firealarm/power_change() /obj/machinery/firealarm/power_change()
if(powered(ENVIRON)) ..()
stat &= ~NOPOWER spawn(rand(0,15))
update_icon() update_icon()
else
spawn(rand(0,15))
stat |= NOPOWER
update_icon()
/obj/machinery/firealarm/attack_hand(mob/user as mob) /obj/machinery/firealarm/attack_hand(mob/user as mob)
if(user.stat || stat & (NOPOWER|BROKEN)) if(user.stat || stat & (NOPOWER|BROKEN))

View File

@@ -127,15 +127,14 @@
/obj/machinery/power/monitor/power_change() /obj/machinery/power/monitor/power_change()
..()
if(stat & BROKEN) if(stat & BROKEN)
icon_state = "broken" icon_state = "broken"
else else
if( powered() ) if (stat & NOPOWER)
icon_state = initial(icon_state)
stat &= ~NOPOWER
else
spawn(rand(0, 15)) spawn(rand(0, 15))
src.icon_state = "c_unpowered" src.icon_state = "c_unpowered"
stat |= NOPOWER else
icon_state = initial(icon_state)

View File

@@ -14,6 +14,10 @@
var/net_id var/net_id
var/list/areas_added var/list/areas_added
var/list/users_to_open var/list/users_to_open
power_channel = ENVIRON
use_power = 1
idle_power_usage = 5
/obj/machinery/door/firedoor/New() /obj/machinery/door/firedoor/New()
. = ..() . = ..()
@@ -66,15 +70,6 @@
attack_hand(M) attack_hand(M)
return 0 return 0
/obj/machinery/door/firedoor/power_change()
if(powered(ENVIRON))
stat &= ~NOPOWER
else
stat |= NOPOWER
return
/obj/machinery/door/firedoor/attack_hand(mob/user as mob) /obj/machinery/door/firedoor/attack_hand(mob/user as mob)
add_fingerprint(user) add_fingerprint(user)
if(operating) if(operating)
@@ -101,6 +96,9 @@
if(user.stat || user.stunned || user.weakened || user.paralysis || (!user.canmove && !isAI(user)) || (get_dist(src, user) > 1 && !isAI(user))) if(user.stat || user.stunned || user.weakened || user.paralysis || (!user.canmove && !isAI(user)) || (get_dist(src, user) > 1 && !isAI(user)))
user << "Sorry, you must remain able bodied and close to \the [src] in order to use it." user << "Sorry, you must remain able bodied and close to \the [src] in order to use it."
return return
if(density && (stat & (BROKEN|NOPOWER))) //can still close without power
user << "\The [src] is not functioning, you'll have to force it open manually."
return
var/needs_to_close = 0 var/needs_to_close = 0
if(density) if(density)
@@ -163,10 +161,10 @@
else else
user.visible_message("\red \The [user] forces \the [ blocked ? "welded" : "" ] [src] [density ? "open" : "closed"] with \a [C]!",\ user.visible_message("\red \The [user] forces \the [ blocked ? "welded" : "" ] [src] [density ? "open" : "closed"] with \a [C]!",\
"You force \the [ blocked ? "welded" : "" ] [src] [density ? "open" : "closed"] with \the [C]!",\ "You force \the [ blocked ? "welded" : "" ] [src] [density ? "open" : "closed"] with \the [C]!",\
"You hear metal strain and groan, and a door [density ? "open" : "close"].") "You hear metal strain and groan, and a door [density ? "opening" : "closing"].")
if(density) if(density)
spawn(0) spawn(0)
open() open(1)
else else
spawn(0) spawn(0)
close() close()
@@ -175,7 +173,7 @@
/obj/machinery/door/firedoor/proc/latetoggle() /obj/machinery/door/firedoor/proc/latetoggle()
if(operating || stat & NOPOWER || !nextstate) if(operating || !nextstate)
return return
switch(nextstate) switch(nextstate)
if(OPEN) if(OPEN)
@@ -190,7 +188,12 @@
latetoggle() latetoggle()
return ..() return ..()
/obj/machinery/door/firedoor/open() /obj/machinery/door/firedoor/open(var/forced = 0)
if (!forced)
if (stat & BROKEN|NOPOWER)
return //needs power to open unless it was forced
else
use_power(360)
latetoggle() latetoggle()
return ..() return ..()

View File

@@ -44,12 +44,11 @@ var/list/doppler_arrays = list()
/obj/machinery/doppler_array/power_change() /obj/machinery/doppler_array/power_change()
..()
if(stat & BROKEN) if(stat & BROKEN)
icon_state = "[initial(icon_state)]-broken" icon_state = "[initial(icon_state)]-broken"
else else
if( powered() ) if( !(stat & NOPOWER) )
icon_state = initial(icon_state) icon_state = initial(icon_state)
stat &= ~NOPOWER
else else
icon_state = "[initial(icon_state)]-off" icon_state = "[initial(icon_state)]-off"
stat |= NOPOWER

View File

@@ -28,12 +28,11 @@
src.sd_SetLuminosity(2) src.sd_SetLuminosity(2)
*/ */
/obj/machinery/flasher/power_change() /obj/machinery/flasher/power_change()
if ( powered() ) ..()
stat &= ~NOPOWER if ( !(stat & NOPOWER) )
icon_state = "[base_state]1" icon_state = "[base_state]1"
// src.sd_SetLuminosity(2) // src.sd_SetLuminosity(2)
else else
stat |= ~NOPOWER
icon_state = "[base_state]1-p" icon_state = "[base_state]1-p"
// src.sd_SetLuminosity(0) // src.sd_SetLuminosity(0)

View File

@@ -153,12 +153,6 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
active_power_usage = 100 active_power_usage = 100
var/obj/effect/overlay/hologram//The projection itself. If there is one, the instrument is on, off otherwise. var/obj/effect/overlay/hologram//The projection itself. If there is one, the instrument is on, off otherwise.
/obj/machinery/hologram/power_change()
if (powered())
stat &= ~NOPOWER
else
stat |= ~NOPOWER
//Destruction procs. //Destruction procs.
/obj/machinery/hologram/ex_act(severity) /obj/machinery/hologram/ex_act(severity)
switch(severity) switch(severity)

View File

@@ -38,6 +38,7 @@
icon_state = "igniter[on]" icon_state = "igniter[on]"
/obj/machinery/igniter/power_change() /obj/machinery/igniter/power_change()
..()
if(!( stat & NOPOWER) ) if(!( stat & NOPOWER) )
icon_state = "igniter[src.on]" icon_state = "igniter[src.on]"
else else
@@ -60,12 +61,12 @@
..() ..()
/obj/machinery/sparker/power_change() /obj/machinery/sparker/power_change()
if ( powered() && disable == 0 ) ..()
stat &= ~NOPOWER if ( !(stat & NOPOWER) && disable == 0 )
icon_state = "[base_state]" icon_state = "[base_state]"
// src.sd_SetLuminosity(2) // src.sd_SetLuminosity(2)
else else
stat |= ~NOPOWER
icon_state = "[base_state]-p" icon_state = "[base_state]-p"
// src.sd_SetLuminosity(0) // src.sd_SetLuminosity(0)

View File

@@ -118,17 +118,16 @@
src.throw_item() src.throw_item()
/obj/machinery/smartfridge/power_change() /obj/machinery/smartfridge/power_change()
if( powered() ) ..()
if( !(stat & NOPOWER) )
src.ispowered = 1 src.ispowered = 1
stat &= ~NOPOWER
if(!isbroken) if(!isbroken)
icon_state = icon_on icon_state = icon_on
else else
spawn(rand(0, 15)) spawn(rand(0, 15))
src.ispowered = 0 src.ispowered = 0
stat |= NOPOWER if(!isbroken)
if(!isbroken) icon_state = icon_off
icon_state = icon_off
/******************* /*******************
* Item Adding * Item Adding

View File

@@ -138,14 +138,13 @@ var/list/obj/machinery/newscaster/allCasters = list() //Global list that will co
/obj/machinery/newscaster/power_change() /obj/machinery/newscaster/power_change()
if(isbroken) //Broken shit can't be powered. if(isbroken) //Broken shit can't be powered.
return return
if( src.powered() ) ..()
if( !(stat & NOPOWER) )
src.ispowered = 1 src.ispowered = 1
stat &= ~NOPOWER
src.update_icon() src.update_icon()
else else
spawn(rand(0, 15)) spawn(rand(0, 15))
src.ispowered = 0 src.ispowered = 0
stat |= NOPOWER
src.update_icon() src.update_icon()

View File

@@ -264,10 +264,12 @@ Status: []<BR>"},
if(!anchored) if(!anchored)
icon_state = "turretCover" icon_state = "turretCover"
return return
..()
if(stat & BROKEN) if(stat & BROKEN)
icon_state = "[lasercolor]destroyed_target_prism" icon_state = "[lasercolor]destroyed_target_prism"
else else
if( powered() ) if( !(stat & NOPOWER) )
if (on) if (on)
if (installation == /obj/item/weapon/gun/energy/laser || installation == /obj/item/weapon/gun/energy/pulse_rifle) if (installation == /obj/item/weapon/gun/energy/laser || installation == /obj/item/weapon/gun/energy/pulse_rifle)
// laser guns and pulse rifles have an orange icon // laser guns and pulse rifles have an orange icon
@@ -277,11 +279,9 @@ Status: []<BR>"},
icon_state = "[lasercolor]target_prism" icon_state = "[lasercolor]target_prism"
else else
icon_state = "[lasercolor]grey_target_prism" icon_state = "[lasercolor]grey_target_prism"
stat &= ~NOPOWER
else else
spawn(rand(0, 15)) spawn(rand(0, 15))
src.icon_state = "[lasercolor]grey_target_prism" src.icon_state = "[lasercolor]grey_target_prism"
stat |= NOPOWER

View File

@@ -28,13 +28,12 @@ obj/machinery/scanner/New()
use_power(50) use_power(50)
/obj/machinery/scanner/power_change() /obj/machinery/scanner/power_change()
if(!powered()) ..()
if(stat & NOPOWER)
spawn(rand(0, 15)) spawn(rand(0, 15))
icon_state = "scanner_off" icon_state = "scanner_off"
stat |= NOPOWER
else else
icon_state = "scanner_idle" icon_state = "scanner_idle"
stat &= ~NOPOWER
obj/machinery/scanner/attack_hand(mob/living/carbon/human/user) obj/machinery/scanner/attack_hand(mob/living/carbon/human/user)
if(stat & NOPOWER) if(stat & NOPOWER)

View File

@@ -34,12 +34,6 @@
else else
user << "The robot part maker is full. Please remove metal from the robot part maker in order to insert more." user << "The robot part maker is full. Please remove metal from the robot part maker in order to insert more."
/obj/machinery/robotic_fabricator/power_change()
if (powered())
stat &= ~NOPOWER
else
stat |= NOPOWER
/obj/machinery/robotic_fabricator/attack_paw(user as mob) /obj/machinery/robotic_fabricator/attack_paw(user as mob)
return src.attack_hand(user) return src.attack_hand(user)

View File

@@ -59,14 +59,13 @@
/obj/machinery/suit_storage_unit/power_change() /obj/machinery/suit_storage_unit/power_change()
if( powered() ) ..()
if( !(stat & NOPOWER) )
src.ispowered = 1 src.ispowered = 1
stat &= ~NOPOWER
src.update_icon() src.update_icon()
else else
spawn(rand(0, 15)) spawn(rand(0, 15))
src.ispowered = 0 src.ispowered = 0
stat |= NOPOWER
src.islocked = 0 src.islocked = 0
src.isopen = 1 src.isopen = 1
src.dump_everything() src.dump_everything()

View File

@@ -93,10 +93,11 @@
return (popping!=0) return (popping!=0)
/obj/machinery/turret/power_change() /obj/machinery/turret/power_change()
..()
if(stat & BROKEN) if(stat & BROKEN)
icon_state = "grey_target_prism" icon_state = "grey_target_prism"
else else
if( powered() ) if( !(stat & NOPOWER) )
if (src.enabled) if (src.enabled)
if (src.lasers) if (src.lasers)
icon_state = "orange_target_prism" icon_state = "orange_target_prism"

View File

@@ -23,6 +23,7 @@
use_power = 1 use_power = 1
idle_power_usage = 10 idle_power_usage = 10
var/vend_power_usage = 150 //actuators and stuff
var/active = 1 //No sales pitches if off! var/active = 1 //No sales pitches if off!
var/delay_product_spawn // If set, uses sleep() in product spawn proc (mostly for seeds to retrieve correct names). var/delay_product_spawn // If set, uses sleep() in product spawn proc (mostly for seeds to retrieve correct names).
@@ -511,7 +512,7 @@
src.speak(src.vend_reply) src.speak(src.vend_reply)
src.last_reply = world.time src.last_reply = world.time
use_power(150) //actuators and stuff use_power(vend_power_usage) //actuators and stuff
if (src.icon_vend) //Show the vending animation if needed if (src.icon_vend) //Show the vending animation if needed
flick(src.icon_vend,src) flick(src.icon_vend,src)
spawn(src.vend_delay) spawn(src.vend_delay)
@@ -561,16 +562,15 @@
return return
/obj/machinery/vending/power_change() /obj/machinery/vending/power_change()
..()
if(stat & BROKEN) if(stat & BROKEN)
icon_state = "[initial(icon_state)]-broken" icon_state = "[initial(icon_state)]-broken"
else else
if( powered() ) if( !(stat & NOPOWER) )
icon_state = initial(icon_state) icon_state = initial(icon_state)
stat &= ~NOPOWER
else else
spawn(rand(0, 15)) spawn(rand(0, 15))
src.icon_state = "[initial(icon_state)]-off" src.icon_state = "[initial(icon_state)]-off"
stat |= NOPOWER
//Oh no we're malfunctioning! Dump out some product and break. //Oh no we're malfunctioning! Dump out some product and break.
/obj/machinery/vending/proc/malfunction() /obj/machinery/vending/proc/malfunction()
@@ -708,6 +708,7 @@
/obj/item/weapon/reagent_containers/food/drinks/bottle/absinthe = 2,/obj/item/weapon/reagent_containers/food/drinks/bottle/grenadine = 5) /obj/item/weapon/reagent_containers/food/drinks/bottle/absinthe = 2,/obj/item/weapon/reagent_containers/food/drinks/bottle/grenadine = 5)
contraband = list(/obj/item/weapon/reagent_containers/food/drinks/tea = 10) contraband = list(/obj/item/weapon/reagent_containers/food/drinks/tea = 10)
vend_delay = 15 vend_delay = 15
idle_power_usage = 211 //refrigerator - believe it or not, this is actually the average power consumption of a refrigerated vending machine according to NRCan.
product_slogans = "I hope nobody asks me for a bloody cup o' tea...;Alcohol is humanity's friend. Would you abandon a friend?;Quite delighted to serve you!;Is nobody thirsty on this station?" product_slogans = "I hope nobody asks me for a bloody cup o' tea...;Alcohol is humanity's friend. Would you abandon a friend?;Quite delighted to serve you!;Is nobody thirsty on this station?"
product_ads = "Drink up!;Booze is good for you!;Alcohol is humanity's best friend.;Quite delighted to serve you!;Care for a nice, cold beer?;Nothing cures you like booze!;Have a sip!;Have a drink!;Have a beer!;Beer is good for you!;Only the finest alcohol!;Best quality booze since 2053!;Award-winning wine!;Maximum alcohol!;Man loves beer.;A toast for progress!" product_ads = "Drink up!;Booze is good for you!;Alcohol is humanity's best friend.;Quite delighted to serve you!;Care for a nice, cold beer?;Nothing cures you like booze!;Have a sip!;Have a drink!;Have a beer!;Beer is good for you!;Only the finest alcohol!;Best quality booze since 2053!;Award-winning wine!;Maximum alcohol!;Man loves beer.;A toast for progress!"
req_access_txt = "25" req_access_txt = "25"
@@ -725,6 +726,8 @@
icon_state = "coffee" icon_state = "coffee"
icon_vend = "coffee-vend" icon_vend = "coffee-vend"
vend_delay = 34 vend_delay = 34
idle_power_usage = 211 //refrigerator - believe it or not, this is actually the average power consumption of a refrigerated vending machine according to NRCan.
vend_power_usage = 85000 //85 kJ to heat a 250 mL cup of coffee
products = list(/obj/item/weapon/reagent_containers/food/drinks/coffee = 25,/obj/item/weapon/reagent_containers/food/drinks/tea = 25,/obj/item/weapon/reagent_containers/food/drinks/h_chocolate = 25) products = list(/obj/item/weapon/reagent_containers/food/drinks/coffee = 25,/obj/item/weapon/reagent_containers/food/drinks/tea = 25,/obj/item/weapon/reagent_containers/food/drinks/h_chocolate = 25)
contraband = list(/obj/item/weapon/reagent_containers/food/drinks/ice = 10) contraband = list(/obj/item/weapon/reagent_containers/food/drinks/ice = 10)
prices = list(/obj/item/weapon/reagent_containers/food/drinks/coffee = 25, /obj/item/weapon/reagent_containers/food/drinks/tea = 25, /obj/item/weapon/reagent_containers/food/drinks/h_chocolate = 25) prices = list(/obj/item/weapon/reagent_containers/food/drinks/coffee = 25, /obj/item/weapon/reagent_containers/food/drinks/tea = 25, /obj/item/weapon/reagent_containers/food/drinks/h_chocolate = 25)
@@ -763,6 +766,7 @@
/obj/item/weapon/reagent_containers/food/drinks/cans/dr_gibb = 1,/obj/item/weapon/reagent_containers/food/drinks/cans/starkist = 1, /obj/item/weapon/reagent_containers/food/drinks/cans/dr_gibb = 1,/obj/item/weapon/reagent_containers/food/drinks/cans/starkist = 1,
/obj/item/weapon/reagent_containers/food/drinks/cans/waterbottle = 2,/obj/item/weapon/reagent_containers/food/drinks/cans/space_up = 1, /obj/item/weapon/reagent_containers/food/drinks/cans/waterbottle = 2,/obj/item/weapon/reagent_containers/food/drinks/cans/space_up = 1,
/obj/item/weapon/reagent_containers/food/drinks/cans/iced_tea = 1,/obj/item/weapon/reagent_containers/food/drinks/cans/grape_juice = 1) /obj/item/weapon/reagent_containers/food/drinks/cans/iced_tea = 1,/obj/item/weapon/reagent_containers/food/drinks/cans/grape_juice = 1)
idle_power_usage = 211 //refrigerator - believe it or not, this is actually the average power consumption of a refrigerated vending machine according to NRCan.
//This one's from bay12 //This one's from bay12
/obj/machinery/vending/cart /obj/machinery/vending/cart
@@ -802,6 +806,7 @@
/obj/item/device/healthanalyzer = 5,/obj/item/weapon/reagent_containers/glass/beaker = 4, /obj/item/weapon/reagent_containers/dropper = 2, /obj/item/device/healthanalyzer = 5,/obj/item/weapon/reagent_containers/glass/beaker = 4, /obj/item/weapon/reagent_containers/dropper = 2,
/obj/item/stack/medical/advanced/bruise_pack = 3, /obj/item/stack/medical/advanced/ointment = 3, /obj/item/stack/medical/splint = 2) /obj/item/stack/medical/advanced/bruise_pack = 3, /obj/item/stack/medical/advanced/ointment = 3, /obj/item/stack/medical/splint = 2)
contraband = list(/obj/item/weapon/reagent_containers/pill/tox = 3,/obj/item/weapon/reagent_containers/pill/stox = 4,/obj/item/weapon/reagent_containers/pill/antitox = 6) contraband = list(/obj/item/weapon/reagent_containers/pill/tox = 3,/obj/item/weapon/reagent_containers/pill/stox = 4,/obj/item/weapon/reagent_containers/pill/antitox = 6)
idle_power_usage = 211 //refrigerator - believe it or not, this is actually the average power consumption of a refrigerated vending machine according to NRCan.
//This one's from bay12 //This one's from bay12
@@ -855,6 +860,7 @@
products = list(/obj/item/weapon/reagent_containers/glass/fertilizer/ez = 35,/obj/item/weapon/reagent_containers/glass/fertilizer/l4z = 25,/obj/item/weapon/reagent_containers/glass/fertilizer/rh = 15,/obj/item/weapon/plantspray/pests = 20, products = list(/obj/item/weapon/reagent_containers/glass/fertilizer/ez = 35,/obj/item/weapon/reagent_containers/glass/fertilizer/l4z = 25,/obj/item/weapon/reagent_containers/glass/fertilizer/rh = 15,/obj/item/weapon/plantspray/pests = 20,
/obj/item/weapon/reagent_containers/syringe = 5,/obj/item/weapon/storage/bag/plants = 5) /obj/item/weapon/reagent_containers/syringe = 5,/obj/item/weapon/storage/bag/plants = 5)
premium = list(/obj/item/weapon/reagent_containers/glass/bottle/ammonia = 10,/obj/item/weapon/reagent_containers/glass/bottle/diethylamine = 5) premium = list(/obj/item/weapon/reagent_containers/glass/bottle/ammonia = 10,/obj/item/weapon/reagent_containers/glass/bottle/diethylamine = 5)
idle_power_usage = 211 //refrigerator - believe it or not, this is actually the average power consumption of a refrigerated vending machine according to NRCan.
/obj/machinery/vending/hydroseeds /obj/machinery/vending/hydroseeds
name = "MegaSeed Servitor" name = "MegaSeed Servitor"
@@ -901,6 +907,7 @@
product_ads = "For Tsar and Country.;Have you fulfilled your nutrition quota today?;Very nice!;We are simple people, for this is all we eat.;If there is a person, there is a problem. If there is no person, then there is no problem." product_ads = "For Tsar and Country.;Have you fulfilled your nutrition quota today?;Very nice!;We are simple people, for this is all we eat.;If there is a person, there is a problem. If there is no person, then there is no problem."
products = list(/obj/item/weapon/reagent_containers/food/drinks/drinkingglass/soda = 30) products = list(/obj/item/weapon/reagent_containers/food/drinks/drinkingglass/soda = 30)
contraband = list(/obj/item/weapon/reagent_containers/food/drinks/drinkingglass/cola = 20) contraband = list(/obj/item/weapon/reagent_containers/food/drinks/drinkingglass/cola = 20)
idle_power_usage = 211 //refrigerator - believe it or not, this is actually the average power consumption of a refrigerated vending machine according to NRCan.
/obj/machinery/vending/tool /obj/machinery/vending/tool
name = "YouTool" name = "YouTool"

View File

@@ -19,11 +19,9 @@
..() ..()
/obj/machinery/drone_fabricator/power_change() /obj/machinery/drone_fabricator/power_change()
if (powered()) ..()
stat &= ~NOPOWER if (stat & NOPOWER)
else
icon_state = "drone_fab_nopower" icon_state = "drone_fab_nopower"
stat |= NOPOWER
/obj/machinery/drone_fabricator/process() /obj/machinery/drone_fabricator/process()

View File

@@ -68,25 +68,23 @@
log_power_update_request(A.master, src) log_power_update_request(A.master, src)
A.master.powerupdate = 2 // Decremented by 2 each GC tick, since it's not auto power change we're going to update power twice. A.master.powerupdate = 2 // Decremented by 2 each GC tick, since it's not auto power change we're going to update power twice.
/obj/machinery/proc/power_change() // called whenever the power settings of the containing area change //The master_area optional argument can be used to save on a lot of processing if the master area is already known. This is mainly intended for when this proc is called by the master controller.
/obj/machinery/proc/power_change(var/area/master_area = null) // called whenever the power settings of the containing area change
// by default, check equipment channel & set flag // by default, check equipment channel & set flag
// can override if needed // can override if needed
if(powered(power_channel)) var/has_power
if (master_area)
has_power = master_area.powered(power_channel)
else
has_power = powered(power_channel)
if(has_power)
stat &= ~NOPOWER stat &= ~NOPOWER
else else
stat |= NOPOWER stat |= NOPOWER
return return
//This is used by the master controller to update the NOPOWER flag
//This will allow machines to update NOPOWER if they are moved from one area to another.
//Does the same thing as power_change() but is optimized for the master controller.
/obj/machinery/proc/update_powered_status(var/area/master_area)
if(master_area.powered(power_channel))
stat &= ~NOPOWER
else
stat |= NOPOWER
// the powernet datum // the powernet datum
// each contiguous network of cables & nodes // each contiguous network of cables & nodes

View File

@@ -488,12 +488,11 @@ var/list/solars_list = list()
/obj/machinery/power/solar_control/power_change() /obj/machinery/power/solar_control/power_change()
if(powered()) ..()
stat &= ~NOPOWER if(!(stat & NOPOWER))
update_icon() update_icon()
else else
spawn(rand(0, 15)) spawn(rand(0, 15))
stat |= NOPOWER
update_icon() update_icon()

View File

@@ -34,11 +34,7 @@
nanomanager.update_uis(src) // update all UIs attached to src nanomanager.update_uis(src) // update all UIs attached to src
/obj/machinery/chem_dispenser/power_change() /obj/machinery/chem_dispenser/power_change()
if(powered()) ..()
stat &= ~NOPOWER
else
spawn(rand(0, 15))
stat |= NOPOWER
nanomanager.update_uis(src) // update all UIs attached to src nanomanager.update_uis(src) // update all UIs attached to src
/obj/machinery/chem_dispenser/process() /obj/machinery/chem_dispenser/process()
@@ -316,13 +312,6 @@
del(src) del(src)
return return
/obj/machinery/chem_master/power_change()
if(powered())
stat &= ~NOPOWER
else
spawn(rand(0, 15))
stat |= NOPOWER
/obj/machinery/chem_master/attackby(var/obj/item/weapon/B as obj, var/mob/user as mob) /obj/machinery/chem_master/attackby(var/obj/item/weapon/B as obj, var/mob/user as mob)
if(istype(B, /obj/item/weapon/reagent_containers/glass)) if(istype(B, /obj/item/weapon/reagent_containers/glass))
@@ -614,18 +603,16 @@
/obj/machinery/computer/pandemic/power_change() /obj/machinery/computer/pandemic/power_change()
..()
if(stat & BROKEN) if(stat & BROKEN)
icon_state = (src.beaker?"mixer1_b":"mixer0_b") icon_state = (src.beaker?"mixer1_b":"mixer0_b")
else if(powered()) else if(!(stat & NOPOWER))
icon_state = (src.beaker?"mixer1":"mixer0") icon_state = (src.beaker?"mixer1":"mixer0")
stat &= ~NOPOWER
else else
spawn(rand(0, 15)) spawn(rand(0, 15))
src.icon_state = (src.beaker?"mixer1_nopower":"mixer0_nopower") src.icon_state = (src.beaker?"mixer1_nopower":"mixer0_nopower")
stat |= NOPOWER
/obj/machinery/computer/pandemic/Topic(href, href_list) /obj/machinery/computer/pandemic/Topic(href, href_list)

View File

@@ -45,11 +45,9 @@
broadcast_request() //This is the device making the initial event request. It needs to broadcast to other devices broadcast_request() //This is the device making the initial event request. It needs to broadcast to other devices
/obj/machinery/keycard_auth/power_change() /obj/machinery/keycard_auth/power_change()
if(powered(ENVIRON)) ..()
stat &= ~NOPOWER if(stat &NOPOWER)
icon_state = "auth_off" icon_state = "auth_off"
else
stat |= NOPOWER
/obj/machinery/keycard_auth/attack_hand(mob/user as mob) /obj/machinery/keycard_auth/attack_hand(mob/user as mob)
if(user.stat || stat & (NOPOWER|BROKEN)) if(user.stat || stat & (NOPOWER|BROKEN))