Skip to content

Commit

Permalink
replaces more use_power
Browse files Browse the repository at this point in the history
  • Loading branch information
Thera-Pissed committed Jan 12, 2024
1 parent c1dc5b3 commit 2f4bf05
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 21 deletions.
4 changes: 2 additions & 2 deletions code/controllers/subsystem/machines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ SUBSYSTEM_DEF(machines)
var/obj/machinery/thing = currentrun[currentrun.len]
currentrun.len--
if(!QDELETED(thing) && thing.process(seconds) != PROCESS_KILL)
if(thing.use_power)
thing.auto_use_power() //add back the power state //need help deciding what to do here other than commenting this out. if still it it doubles a lot of idle machine draws.
//if(thing.use_power)
//thing.auto_use_power() //add back the power state //need help deciding what to do here other than commenting this out. if still it it doubles a lot of idle machine draws.
else
processing -= thing
if (!QDELETED(thing))
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/_machinery.dm
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ Class Procs:
target.forceMove(src)
updateUsrDialog()
update_appearance()

/*
/obj/machinery/proc/auto_use_power() //obsolete, tick controller doesn't call this anymore because machines use addStaticPower now.
if(!powered(power_channel))
return 0
Expand All @@ -286,7 +286,7 @@ Class Procs:
else if(use_power >= 2)
use_power(active_power_usage,power_channel)
return 1

*/

///Called when we want to change the value of the `is_operational` variable. Boolean.
/obj/machinery/proc/set_is_operational(new_value)
Expand Down
7 changes: 5 additions & 2 deletions code/game/machinery/hologram.dm
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,11 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/

/obj/machinery/holopad/proc/SetLightsAndPower()
var/total_users = LAZYLEN(masters) + LAZYLEN(holo_calls)
use_power = total_users > 0 ? ACTIVE_POWER_USE : IDLE_POWER_USE
active_power_usage = HOLOPAD_PASSIVE_POWER_USAGE + (HOLOGRAM_POWER_USAGE * total_users)
if(total_users > 0)
set_active_power()
else
set_idle_power()
active_power_usage = initial(active_power_usage) * total_users
if(total_users || replay_mode)
set_light(2)
else
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/porta_turret/portable_turret.dm
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ DEFINE_BITFIELD(turret_flags, list(
installation = null
max_integrity = 300
always_up = 1
set_active_power()
use_power = ACTIVE_POWER_USE
active_power_usage = 300
has_cover = 0
scan_range = 9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
/obj/machinery/atmospherics/components/binary/pump/CtrlClick(mob/user)
if(can_interact(user))
on = !on
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
if(on)
set_active_power()
else
set_idle_power()
investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS)
update_appearance()
return ..()
Expand Down Expand Up @@ -115,7 +118,10 @@
switch(action)
if("power")
on = !on
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
if(on)
set_active_power()
else
set_idle_power()
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
. = TRUE
if("pressure")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
/obj/machinery/atmospherics/components/binary/volume_pump/CtrlClick(mob/user)
if(can_interact(user))
on = !on
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
if(on)
set_active_power()
else
set_idle_power()
investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS)
update_appearance()
return ..()
Expand Down Expand Up @@ -135,7 +138,10 @@
switch(action)
if("power")
on = !on
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
if(on)
set_active_power()
else
set_idle_power()
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
. = TRUE
if("rate")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
/obj/machinery/atmospherics/components/trinary/filter/CtrlClick(mob/user)
if(can_interact(user))
on = !on
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
if(on)
set_active_power()
else
set_idle_power()
investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS)
update_appearance()
return ..()
Expand Down Expand Up @@ -119,7 +122,10 @@
switch(action)
if("power")
on = !on
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
if(on)
set_active_power()
else
set_idle_power()
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
. = TRUE
if("rate")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
/obj/machinery/atmospherics/components/trinary/mixer/CtrlClick(mob/user)
if(can_interact(user))
on = !on
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
if(on)
set_active_power()
else
set_idle_power()
investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS)
update_appearance()
return ..()
Expand Down Expand Up @@ -142,7 +145,10 @@
switch(action)
if("power")
on = !on
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
if(on)
set_active_power()
else
set_idle_power()
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
. = TRUE
if("pressure")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@
switch(action)
if("power")
on = !on
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
if(on)
set_active_power()
else
set_idle_power()
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
. = TRUE
if("target")
Expand Down Expand Up @@ -183,6 +186,10 @@
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE))
return
on = !on
if(on)
set_active_power()
else
set_idle_power()
investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS)
update_appearance()
investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
Expand Down
6 changes: 4 additions & 2 deletions code/modules/atmospherics/machinery/portable/scrubber.dm
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@
if((!anchored && !movable) || !is_operational)
on = FALSE
update_appearance()
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
if(!on)
if(on)
set_active_power()
else
set_idle_power()
return

..()
Expand Down
5 changes: 4 additions & 1 deletion code/modules/holodeck/computer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,10 @@ and clear when youre done! if you dont i will use :newspaper2: on you

spawning_simulation = TRUE
active = (map_id != offline_program)
use_power = active + IDLE_POWER_USE
if(active)
set_active_power()
else
set_idle_power()
program = map_id

//clear the items from the previous program
Expand Down
5 changes: 4 additions & 1 deletion code/modules/power/gravitygenerator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,10 @@
/obj/machinery/gravity_generator/main/proc/set_state(new_state)
charging_state = POWER_IDLE
on = new_state
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
if(on)
set_active_power()
else
set_idle_power()
// Sound the alert if gravity was just enabled or disabled.
var/alert = FALSE
if(SSticker.IsRoundInProgress())
Expand Down
4 changes: 4 additions & 0 deletions code/modules/power/power.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,15 @@

/obj/machinery/proc/set_idle_power()
set_no_power()
if(use_power = NO_POWER_USE)

Check failure on line 111 in code/modules/power/power.dm

View workflow job for this annotation

GitHub Actions / Run Linters

if condition is always false
return
use_static_power = IDLE_POWER_USE
addStaticPower(idle_power_usage, power_channel + 3)

/obj/machinery/proc/set_active_power()
set_no_power()
if(use_power = NO_POWER_USE)

Check failure on line 118 in code/modules/power/power.dm

View workflow job for this annotation

GitHub Actions / Run Linters

if condition is always false
return
use_static_power = ACTIVE_POWER_USE
addStaticPower(active_power_usage, power_channel + 3)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/reagents/chemistry/machinery/pandemic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
icon = 'icons/obj/chemical.dmi'
icon_state = "pandemic0"
base_icon_state = "pandemic"
use_power = TRUE
use_power = IDLE_POWER_USE
idle_power_usage = IDLE_DRAW_MINIMAL
resistance_flags = ACID_PROOF
circuit = /obj/item/circuitboard/computer/pandemic
Expand Down

0 comments on commit 2f4bf05

Please sign in to comment.