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:
TemporalOroboros
2022-02-06 17:23:38 -08:00
committed by GitHub
parent 45607b1a21
commit 6be8e0feee
43 changed files with 536 additions and 356 deletions
+1 -1
View File
@@ -26,7 +26,7 @@
/obj/effect/dummy/phased_mob,
/obj/effect/mapping_helpers,
/obj/effect/wisp,
))
))
/datum/component/chasm/Initialize(turf/target)
RegisterSignal(parent, COMSIG_ATOM_ENTERED, .proc/Entered)
+21 -23
View File
@@ -59,19 +59,18 @@
var/static/list/possible_mobtypes
if(!possible_mobtypes)
// The base list of allowed mob/species types
possible_mobtypes = typecacheof(list(
/mob/living/simple_animal,
/mob/living/carbon,
/datum/species,
))
possible_mobtypes = zebra_typecacheof(list(
/mob/living/simple_animal = TRUE,
/mob/living/carbon = TRUE,
/datum/species = TRUE,
// Some types to remove them and their subtypes
/mob/living/carbon/human/species = FALSE,
))
// Some particular types to disallow if they're too broad/abstract
// Not in the above typecache generator because it includes subtypes and this doesn't.
possible_mobtypes -= list(
/mob/living/simple_animal/hostile,
)
// Some types to remove them and their subtypes
possible_mobtypes -= typecacheof(list(
/mob/living/carbon/human/species,
))
)
var/mob/picked_mobtype = pick(possible_mobtypes)
// This works even with the species picks since we're only accessing the name
@@ -99,22 +98,21 @@
var/static/list/possible_mobtypes
if(!possible_mobtypes)
// The base list of allowed mob/species types
possible_mobtypes = typecacheof(list(
/mob/living/simple_animal,
/mob/living/carbon,
/datum/species,
))
possible_mobtypes = zebra_typecacheof(list(
/mob/living/simple_animal = TRUE,
/mob/living/carbon = TRUE,
/datum/species = TRUE,
// Some types to remove them and their subtypes
/mob/living/carbon/human/species = FALSE,
/mob/living/simple_animal/hostile/syndicate/mecha_pilot = FALSE,
/mob/living/simple_animal/hostile/asteroid/elite = FALSE,
/mob/living/simple_animal/hostile/megafauna = FALSE,
))
// Some particular types to disallow if they're too broad/abstract
// Not in the above typecache generator because it includes subtypes and this doesn't.
possible_mobtypes -= list(
/mob/living/simple_animal/hostile,
)
// Some types to remove them and their subtypes
possible_mobtypes -= typecacheof(list(
/mob/living/carbon/human/species,
/mob/living/simple_animal/hostile/syndicate/mecha_pilot,
/mob/living/simple_animal/hostile/asteroid/elite,
/mob/living/simple_animal/hostile/megafauna,
))
)
var/mob/picked_mobtype = pick(possible_mobtypes)
// This works even with the species picks since we're only accessing the name
@@ -25,9 +25,12 @@
/datum/component/storage/concrete/pockets/small/fedora/Initialize()
. = ..()
var/static/list/exception_cache = typecacheof(list(
/obj/item/katana, /obj/item/toy/katana, /obj/item/nullrod/claymore/katana,
/obj/item/energy_katana, /obj/item/gun/ballistic/automatic/tommygun
))
/obj/item/katana,
/obj/item/toy/katana,
/obj/item/nullrod/claymore/katana,
/obj/item/energy_katana,
/obj/item/gun/ballistic/automatic/tommygun,
))
exception_hold = exception_cache
/datum/component/storage/concrete/pockets/small/fedora/detective
+7 -7
View File
@@ -16,18 +16,18 @@
/turf/open/lava,
/turf/open/space,
/turf/open/water,
/turf/open/chasm)
)
/turf/open/chasm,
))
///List of turfs that are immune to thermite
var/static/list/immunelist = typecacheof(list(
/turf/closed/wall/mineral/diamond,
/turf/closed/indestructible,
/turf/open/indestructible)
)
/turf/open/indestructible,
))
///List of turfs that take extra thermite to burn through
var/static/list/resistlist = typecacheof(
/turf/closed/wall/r_wall
)
var/static/list/resistlist = typecacheof(list(
/turf/closed/wall/r_wall,
))
/datum/component/thermite/Initialize(_amount)
if(!istype(parent, /turf) || blacklist[parent.type])