Merge pull request #7406 from VOREStation/vplk-optimize-for-static-power

Optimize some machines for static power
This commit is contained in:
Aronai Sieyes
2020-04-25 15:06:50 -04:00
committed by GitHub
6 changed files with 39 additions and 17 deletions
+13 -4
View File
@@ -390,7 +390,8 @@
else if(electrified_until > 0 && world.time >= electrified_until)
electrify(0)
..()
if (..() == PROCESS_KILL && !(main_power_lost_until > 0 || backup_power_lost_until > 0 || electrified_until > 0))
. = PROCESS_KILL
/obj/machinery/door/airlock/uranium/process()
if(world.time > last_event+20)
@@ -580,6 +581,9 @@ About the new airlock wires panel:
if(backup_power_lost_until == -1 && !backupPowerCablesCut())
backup_power_lost_until = world.time + SecondsToTicks(10)
if(main_power_lost_until > 0 || backup_power_lost_until > 0)
START_MACHINE_PROCESSING(src)
// Disable electricity if required
if(electrified_until && isAllPowerLoss())
electrify(0)
@@ -589,6 +593,9 @@ About the new airlock wires panel:
/obj/machinery/door/airlock/proc/loseBackupPower()
backup_power_lost_until = backupPowerCablesCut() ? -1 : world.time + SecondsToTicks(60)
if(backup_power_lost_until > 0)
START_MACHINE_PROCESSING(src)
// Disable electricity if required
if(electrified_until && isAllPowerLoss())
electrify(0)
@@ -631,6 +638,9 @@ About the new airlock wires panel:
message = "The door is now electrified [duration == -1 ? "permanently" : "for [duration] second\s"]."
src.electrified_until = duration == -1 ? -1 : world.time + SecondsToTicks(duration)
if(electrified_until > 0)
START_MACHINE_PROCESSING(src)
if(feedback && message)
to_chat(usr,message)
@@ -1142,7 +1152,7 @@ About the new airlock wires panel:
if(!has_beeped)
playsound(src.loc, 'sound/machines/buzz-two.ogg', 50, 0)
has_beeped = 1
close_door_at = world.time + 6
autoclose_in(6)
return
for(var/turf/turf in locs)
@@ -1160,8 +1170,7 @@ About the new airlock wires panel:
var/obj/structure/window/killthis = (locate(/obj/structure/window) in turf)
if(killthis)
killthis.ex_act(2)//Smashin windows
..()
return
return ..()
/obj/machinery/door/airlock/proc/lock(var/forced=0)
if(locked)
+5 -1
View File
@@ -9,7 +9,8 @@ obj/machinery/door/airlock
var/cur_command = null //the command the door is currently attempting to complete
obj/machinery/door/airlock/process()
..()
if (..() == PROCESS_KILL && !cur_command)
. = PROCESS_KILL
if (arePowerSystemsOn())
execute_current_command()
@@ -22,6 +23,9 @@ obj/machinery/door/airlock/receive_signal(datum/signal/signal)
cur_command = signal.data["command"]
execute_current_command()
if(cur_command)
START_MACHINE_PROCESSING(src)
obj/machinery/door/airlock/proc/execute_current_command()
if(operating)
+10 -4
View File
@@ -82,11 +82,17 @@
/obj/machinery/door/process()
if(close_door_at && world.time >= close_door_at)
if(autoclose)
close_door_at = next_close_time()
close_door_at = world.time + next_close_wait()
spawn(0)
close()
else
close_door_at = 0
if (..() == PROCESS_KILL && !close_door_at)
return PROCESS_KILL
/obj/machinery/door/proc/autoclose_in(wait)
close_door_at = world.time + wait
START_MACHINE_PROCESSING(src)
/obj/machinery/door/proc/can_open()
if(!density || operating || !ticker)
@@ -427,12 +433,12 @@
operating = 0
if(autoclose)
close_door_at = next_close_time()
autoclose_in(next_close_wait())
return 1
/obj/machinery/door/proc/next_close_time()
return world.time + (normalspeed ? 150 : 5)
/obj/machinery/door/proc/next_close_wait()
return (normalspeed ? 150 : 5)
/obj/machinery/door/proc/close(var/forced = 0)
if(!can_close(forced))
+7 -2
View File
@@ -350,7 +350,9 @@
/obj/machinery/door/firedoor/process()
..()
if(density && next_process_time <= world.time)
if(!density)
return PROCESS_KILL
if(next_process_time <= world.time)
next_process_time = world.time + 100 // 10 second delays between process updates
var/changed = 0
lockdown=0
@@ -406,7 +408,10 @@
/obj/machinery/door/firedoor/close()
latetoggle()
return ..()
. = ..()
// Queue us for processing when we are closed!
if(density)
START_MACHINE_PROCESSING(src)
/obj/machinery/door/firedoor/open(var/forced = 0)
if(hatch_open)
+4 -1
View File
@@ -127,6 +127,8 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
set_light(2) //pad lighting
icon_state = "holopad1"
A.holo = src
if(LAZYLEN(masters))
START_MACHINE_PROCESSING(src)
return 1
/obj/machinery/hologram/holopad/proc/clear_holo(mob/living/silicon/ai/user)
@@ -147,7 +149,8 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
continue
use_power(power_per_hologram)
return 1
if(..() == PROCESS_KILL && !LAZYLEN(masters))
return PROCESS_KILL
/obj/machinery/hologram/holopad/proc/move_hologram(mob/living/silicon/ai/user)
if(masters[user])
-5
View File
@@ -33,11 +33,6 @@
/obj/machinery/power/terminal/hides_under_flooring()
return 1
// Needed so terminals are not removed from machines list.
// Powernet rebuilds need this to work properly.
/obj/machinery/power/terminal/process()
return 1
/obj/machinery/power/terminal/overload(var/obj/machinery/power/source)
if(master)
master.overload(source)