From e105e72065f7a47b60f7bd746fd25b7db61ca53b Mon Sep 17 00:00:00 2001 From: Kyle Spier-Swenson Date: Mon, 2 Jan 2017 06:51:59 -0800 Subject: [PATCH] Updates sqdl2 to work on datums much quicker by ignoring atoms Also makes it use a typecache for more speed. --- code/modules/admin/verbs/SDQL2/SDQL_2.dm | 30 ++++++++++++++---------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/code/modules/admin/verbs/SDQL2/SDQL_2.dm b/code/modules/admin/verbs/SDQL2/SDQL_2.dm index 4dc8490ecebe..7eea8159f09c 100644 --- a/code/modules/admin/verbs/SDQL2/SDQL_2.dm +++ b/code/modules/admin/verbs/SDQL2/SDQL_2.dm @@ -246,42 +246,48 @@ return out type = text2path(type) - + var/typecache = typecacheof(type) + if(ispath(type, /mob)) for(var/mob/d in location) - if(istype(d, type)) + if(typecache[d.type]) out += d CHECK_TICK else if(ispath(type, /turf)) for(var/turf/d in location) - if(istype(d, type)) + if(typecache[d.type]) out += d CHECK_TICK else if(ispath(type, /obj)) for(var/obj/d in location) - if(istype(d, type)) + if(typecache[d.type]) out += d CHECK_TICK else if(ispath(type, /area)) for(var/area/d in location) - if(istype(d, type)) + if(typecache[d.type]) out += d CHECK_TICK else if(ispath(type, /atom)) for(var/atom/d in location) - if(istype(d, type)) - out += d - CHECK_TICK - - else - for(var/datum/d in location) - if(istype(d, type)) + if(typecache[d.type]) out += d CHECK_TICK + else if(ispath(type, /datum)) + if(location == world) //snowflake for byond shortcut + for(var/datum/d) //stupid byond trick to have it not return atoms to make this less laggy + if(typecache[d.type]) + out += d + CHECK_TICK + else + for(var/datum/d in location) + if(typecache[d.type]) + out += d + CHECK_TICK return out