mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-21 20:20:33 +01:00
Adds an option to generate typecaches as zebras. (#63710)
About The Pull Request Adds an argument to typecache generation that allows specifying the whether to include/exclude types in the input list. Also adds another argument to specify whether to remove falsey values after the typecache is generated. Why It's Good For The Game Might make zaps slightly faster??? Honestly I just thought it would be a good way to condense some whitelist/blacklist typecache sets.
This commit is contained in:
@@ -212,22 +212,30 @@
|
||||
*/
|
||||
var/atom/closest_atom
|
||||
var/closest_type = 0
|
||||
var/static/list/things_to_shock = typecacheof(list(/obj/machinery, /mob/living, /obj/structure, /obj/vehicle/ridden))
|
||||
var/static/list/blacklisted_tesla_types = typecacheof(list(/obj/machinery/atmospherics,
|
||||
/obj/machinery/portable_atmospherics,
|
||||
/obj/machinery/power/emitter,
|
||||
/obj/machinery/field/generator,
|
||||
/mob/living/simple_animal,
|
||||
/obj/machinery/field/containment,
|
||||
/obj/structure/disposalpipe,
|
||||
/obj/structure/disposaloutlet,
|
||||
/obj/machinery/disposal/delivery_chute,
|
||||
/obj/machinery/camera,
|
||||
/obj/structure/sign,
|
||||
/obj/machinery/gateway,
|
||||
/obj/structure/lattice,
|
||||
/obj/structure/grille,
|
||||
/obj/structure/frame/machine))
|
||||
var/static/list/things_to_shock = zebra_typecacheof(list(
|
||||
// Things that we want to shock.
|
||||
/obj/machinery = TRUE,
|
||||
/mob/living = TRUE,
|
||||
/obj/structure = TRUE,
|
||||
/obj/vehicle/ridden = TRUE,
|
||||
|
||||
// Things that we don't want to shock.
|
||||
/obj/machinery/atmospherics = FALSE,
|
||||
/obj/machinery/portable_atmospherics = FALSE,
|
||||
/obj/machinery/power/emitter = FALSE,
|
||||
/obj/machinery/field/generator = FALSE,
|
||||
/obj/machinery/field/containment = FALSE,
|
||||
/obj/machinery/camera = FALSE,
|
||||
/obj/machinery/gateway = FALSE,
|
||||
/mob/living/simple_animal = FALSE,
|
||||
/obj/structure/disposalpipe = FALSE,
|
||||
/obj/structure/disposaloutlet = FALSE,
|
||||
/obj/machinery/disposal/delivery_chute = FALSE,
|
||||
/obj/structure/sign = FALSE,
|
||||
/obj/structure/lattice = FALSE,
|
||||
/obj/structure/grille = FALSE,
|
||||
/obj/structure/frame/machine = FALSE,
|
||||
))
|
||||
|
||||
//Ok so we are making an assumption here. We assume that view() still calculates from the center out.
|
||||
//This means that if we find an object we can assume it is the closest one of its type. This is somewhat of a speed increase.
|
||||
@@ -235,7 +243,7 @@
|
||||
|
||||
//Darkness fucks oview up hard. I've tried dview() but it doesn't seem to work
|
||||
//I hate existance
|
||||
for(var/a in typecache_filter_multi_list_exclusion(oview(zap_range+2, source), things_to_shock, blacklisted_tesla_types))
|
||||
for(var/a in typecache_filter_list(oview(zap_range+2, source), things_to_shock))
|
||||
var/atom/A = a
|
||||
if(!(zap_flags & ZAP_ALLOW_DUPLICATES) && LAZYACCESS(shocked_targets, A))
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user