Make typecache checks twice as fast, stop using single-type typecaches where appropriate (#38075)

This commit is contained in:
vuonojenmustaturska
2018-05-28 16:31:30 -07:00
committed by Tad Hardesty
parent 32fddb078a
commit d335a0fd05
14 changed files with 19 additions and 34 deletions
@@ -496,12 +496,12 @@
// If targeting anything else, see if the wear suit is thin enough.
if (!penetrate_thick)
if(above_neck(target_zone))
if(head && is_type_in_typecache(head, GLOB.typecache_clothing))
if(head && istype(head, /obj/item/clothing))
var/obj/item/clothing/CH = head
if (CH.clothing_flags & THICKMATERIAL)
. = 0
else
if(wear_suit && is_type_in_typecache(wear_suit, GLOB.typecache_clothing))
if(wear_suit && istype(wear_suit, /obj/item/clothing))
var/obj/item/clothing/CS = wear_suit
if (CS.clothing_flags & THICKMATERIAL)
. = 0
@@ -11,7 +11,7 @@
if (!(lube&GALOSHES_DONT_HELP))
if(has_trait(TRAIT_NOSLIPWATER))
return 0
if(shoes && is_type_in_typecache(shoes, GLOB.typecache_clothing))
if(shoes && istype(shoes, /obj/item/clothing))
var/obj/item/clothing/CS = shoes
if (CS.clothing_flags & NOSLIP)
return 0
@@ -19,7 +19,7 @@
/mob/living/carbon/human/experience_pressure_difference()
playsound(src, 'sound/effects/space_wind.ogg', 50, 1)
if(shoes && is_type_in_typecache(shoes, GLOB.typecache_clothing))
if(shoes && istype(shoes, /obj/item/clothing))
var/obj/item/clothing/S = shoes
if (S.clothing_flags & NOSLIP)
return 0
+2 -2
View File
@@ -44,7 +44,7 @@
/mob/living/carbon/human/calculate_affecting_pressure(pressure)
if (wear_suit && head && is_type_in_typecache(wear_suit, GLOB.typecache_clothing) && is_type_in_typecache(head, GLOB.typecache_clothing))
if (wear_suit && head && istype(wear_suit, /obj/item/clothing) && istype(head, /obj/item/clothing))
var/obj/item/clothing/CS = wear_suit
var/obj/item/clothing/CH = head
if (CS.clothing_flags & CH.clothing_flags & STOPSPRESSUREDAMAGE)
@@ -274,7 +274,7 @@
if(glasses)
if(glasses.clothing_flags & BLOCK_GAS_SMOKE_EFFECT)
return TRUE
if(head && is_type_in_typecache(head, GLOB.typecache_clothing))
if(head && istype(head, /obj/item/clothing))
var/obj/item/clothing/CH = head
if(CH.clothing_flags & BLOCK_GAS_SMOKE_EFFECT)
return TRUE
@@ -25,7 +25,7 @@
/datum/species/plasmaman/spec_life(mob/living/carbon/human/H)
var/datum/gas_mixture/environment = H.loc.return_air()
var/atmos_sealed = FALSE
if (H.wear_suit && H.head && is_type_in_typecache(H.wear_suit, GLOB.typecache_clothing) && is_type_in_typecache(H.head, GLOB.typecache_clothing))
if (H.wear_suit && H.head && istype(H.wear_suit, /obj/item/clothing) && istype(H.head, /obj/item/clothing))
var/obj/item/clothing/CS = H.wear_suit
var/obj/item/clothing/CH = H.head
if (CS.clothing_flags & CH.clothing_flags & STOPSPRESSUREDAMAGE)
@@ -357,7 +357,7 @@
if(ishuman(C))
var/mob/living/carbon/human/H = C
if (H.wear_suit && H.head && is_type_in_typecache(H.wear_suit, GLOB.typecache_clothing) && is_type_in_typecache(H.head, GLOB.typecache_clothing))
if (H.wear_suit && H.head && istype(H.wear_suit, /obj/item/clothing) && istype(H.head, /obj/item/clothing))
var/obj/item/clothing/CS = H.wear_suit
var/obj/item/clothing/CH = H.head
if (CS.clothing_flags & CH.clothing_flags & THICKMATERIAL)