mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 21:40:55 +01:00
Port some tesla performance optimizations from /tg/ (#3612)
Seems to halve (!) the Tesla's CPU usage.
This commit is contained in:
@@ -1,25 +1,6 @@
|
||||
#define TESLA_DEFAULT_POWER 1738260
|
||||
#define TESLA_MINI_POWER 869130
|
||||
|
||||
var/list/blacklisted_tesla_types = typecacheof(list(/obj/machinery/atmospherics,
|
||||
/obj/machinery/power/emitter,
|
||||
/obj/machinery/field_generator,
|
||||
/mob/living/simple_animal,
|
||||
/obj/machinery/particle_accelerator/control_box,
|
||||
/obj/structure/particle_accelerator/fuel_chamber,
|
||||
/obj/structure/particle_accelerator/particle_emitter/center,
|
||||
/obj/structure/particle_accelerator/particle_emitter/left,
|
||||
/obj/structure/particle_accelerator/particle_emitter/right,
|
||||
/obj/structure/particle_accelerator/power_box,
|
||||
/obj/structure/particle_accelerator/end_cap,
|
||||
/obj/machinery/containment_field,
|
||||
/obj/structure/disposalpipe,
|
||||
/obj/structure/sign,
|
||||
/obj/machinery/gateway,
|
||||
/obj/structure/lattice,
|
||||
/obj/structure/grille,
|
||||
/obj/machinery/the_singularitygen/tesla,
|
||||
/obj/machinery/atmospherics/pipe))
|
||||
/obj/singularity/energy_ball
|
||||
name = "energy ball"
|
||||
desc = "An energy ball."
|
||||
@@ -174,8 +155,34 @@ var/list/blacklisted_tesla_types = typecacheof(list(/obj/machinery/atmospherics,
|
||||
var/mob/living/closest_mob
|
||||
var/obj/machinery/closest_machine
|
||||
var/obj/structure/closest_structure
|
||||
var/static/list/blacklisted_types = typecacheof(list(
|
||||
/obj/machinery/atmospherics,
|
||||
/obj/machinery/power/emitter,
|
||||
/obj/machinery/field_generator,
|
||||
/mob/living/simple_animal,
|
||||
/obj/machinery/particle_accelerator/control_box,
|
||||
/obj/structure/particle_accelerator/fuel_chamber,
|
||||
/obj/structure/particle_accelerator/particle_emitter/center,
|
||||
/obj/structure/particle_accelerator/particle_emitter/left,
|
||||
/obj/structure/particle_accelerator/particle_emitter/right,
|
||||
/obj/structure/particle_accelerator/power_box,
|
||||
/obj/structure/particle_accelerator/end_cap,
|
||||
/obj/machinery/containment_field,
|
||||
/obj/structure/disposalpipe,
|
||||
/obj/structure/sign,
|
||||
/obj/machinery/gateway,
|
||||
/obj/structure/lattice,
|
||||
/obj/structure/grille,
|
||||
/obj/machinery/the_singularitygen/tesla,
|
||||
/obj/machinery/atmospherics/pipe
|
||||
))
|
||||
var/static/list/things_to_shock = typecacheof(list(
|
||||
/obj/machinery,
|
||||
/mob/living,
|
||||
/obj/structure
|
||||
))
|
||||
|
||||
for(var/A in oview(source, zap_range+2))
|
||||
for(var/A in typecache_filter_multi_list_exclusion(oview(source, zap_range+2), things_to_shock, blacklisted_types))
|
||||
if(istype(A, /obj/machinery/power/tesla_coil))
|
||||
var/dist = get_dist(source, A)
|
||||
var/obj/machinery/power/tesla_coil/C = A
|
||||
@@ -197,7 +204,7 @@ var/list/blacklisted_tesla_types = typecacheof(list(/obj/machinery/atmospherics,
|
||||
closest_atom = A
|
||||
closest_dist = dist
|
||||
|
||||
else if(closest_grounding_rod || is_type_in_typecache(A, blacklisted_tesla_types))
|
||||
else if(closest_grounding_rod)
|
||||
continue
|
||||
|
||||
else if(isliving(A))
|
||||
|
||||
Reference in New Issue
Block a user