mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-15 01:46:30 +01:00
Processing Audit Part 1 (#22803)
Oh look at that, every modular computer in existence was always processing at all times, regardless of if it was actually needed. There's a couple more small examples I caught in my first pass, but all of the rest are very low incidence. There are of course a very large number of modular computers at any one point in time.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
if(!enabled) // The computer is turned off
|
||||
last_power_usage = 0
|
||||
return FALSE
|
||||
return PROCESS_KILL // Unpowered computers don't need to process.
|
||||
|
||||
if(health <= broken_damage)
|
||||
shutdown_computer()
|
||||
@@ -85,7 +85,6 @@
|
||||
|
||||
/obj/item/modular_computer/Initialize()
|
||||
. = ..()
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
install_default_hardware()
|
||||
if(hard_drive)
|
||||
install_default_programs()
|
||||
@@ -319,6 +318,7 @@
|
||||
return GLOB.ntnet_global.add_log(text, network_card)
|
||||
|
||||
/obj/item/modular_computer/proc/shutdown_computer(var/loud = TRUE)
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
SStgui.close_uis(active_program)
|
||||
kill_program_shutdown(TRUE)
|
||||
for(var/datum/computer_file/program/P in idle_threads)
|
||||
@@ -340,6 +340,7 @@
|
||||
update_icon()
|
||||
|
||||
/obj/item/modular_computer/proc/enable_computer(var/mob/user, var/ar_forced=FALSE)
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
enabled = TRUE
|
||||
if(looping_sound)
|
||||
soundloop.start(src)
|
||||
|
||||
@@ -21,14 +21,13 @@
|
||||
|
||||
charge = maxcharge
|
||||
|
||||
if(self_charge_percentage)
|
||||
if(self_charge_percentage && charge < maxcharge)
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
|
||||
update_icon()
|
||||
|
||||
/obj/item/cell/Destroy()
|
||||
if(self_charge_percentage)
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
return ..()
|
||||
|
||||
/obj/item/cell/process(seconds_per_tick)
|
||||
@@ -41,6 +40,8 @@
|
||||
var/recharge_for_this_process = round(recharge_amount_per_second * (seconds_per_tick / 10)) // divides seconds_per_tick by 10 to turn deciseconds into seconds
|
||||
// finally, charge the cell
|
||||
give(recharge_for_this_process)
|
||||
if (charge >= maxcharge)
|
||||
return PROCESS_KILL // No need to constantly process self-charging cells that are full.
|
||||
|
||||
/obj/item/cell/Created()
|
||||
//Newly built cells spawn with no charge to prevent power exploits
|
||||
@@ -51,13 +52,12 @@
|
||||
return src
|
||||
|
||||
/obj/item/cell/drain_power(var/drain_check, var/surge, var/power = 0)
|
||||
|
||||
if(drain_check)
|
||||
return 1
|
||||
|
||||
if(charge <= 0)
|
||||
return 0
|
||||
|
||||
START_PROCESSING(SSprocessing, src) // Always attempt at least one process if the battery level is ever reduced.
|
||||
var/cell_amt = power * CELLRATE
|
||||
|
||||
return use(cell_amt) / CELLRATE
|
||||
|
||||
@@ -29,8 +29,6 @@
|
||||
firemodes = list()
|
||||
modifystate = null
|
||||
|
||||
var/does_process = TRUE
|
||||
|
||||
matter = null
|
||||
origin_tech = list(TECH_COMBAT = 3, TECH_MATERIAL = 2, TECH_MAGNET = 3, TECH_ARCANE = 2, TECH_ILLEGAL = 3)
|
||||
|
||||
@@ -40,15 +38,6 @@
|
||||
. += ..()
|
||||
. += "This weapon can be recharged by clicking on blood or remains with it. Remains recharge more than simple blood."
|
||||
|
||||
/obj/item/gun/energy/rifle/cult/Initialize()
|
||||
. = ..()
|
||||
if(does_process)
|
||||
START_PROCESSING(SSprocessing, src)
|
||||
|
||||
/obj/item/gun/energy/rifle/cult/Destroy()
|
||||
STOP_PROCESSING(SSprocessing, src)
|
||||
return ..()
|
||||
|
||||
/obj/item/gun/energy/rifle/cult/afterattack(atom/A, mob/living/user, adjacent, params)
|
||||
if(adjacent && iscultist(user))
|
||||
if(istype(A, /obj/effect/decal/remains) || istype(A, /obj/effect/decal/cleanable/blood))
|
||||
@@ -76,5 +65,4 @@
|
||||
use_external_power = TRUE
|
||||
self_recharge = TRUE
|
||||
has_safety = FALSE
|
||||
does_process = FALSE
|
||||
projectile_type = /obj/projectile/bullet/shard/heavy
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
/obj/item/spell/track/process()
|
||||
if(!tracking)
|
||||
icon_state = "track"
|
||||
return
|
||||
return PROCESS_KILL
|
||||
|
||||
if(!tracked)
|
||||
icon_state = "track_unknown"
|
||||
|
||||
Reference in New Issue
Block a user