for (var/T = thing.type; !isnull(T); T = T.parent_type)
if (T == Type)
return 1
return 0
The speed up idea would basically be to just have it cache a list of parent types in an associated list on world start for each type, then it can just do if (type == thing.type || thing.parent_types[type])
(or the c++ version of this)
making it much faster.