4343from entities import Edict
4444from entities import TakeDamageInfo
4545from entities .classes import server_classes
46+ from entities .constants import WORLD_ENTITY_INDEX
4647from entities .constants import DamageTypes
4748from entities .constants import RenderMode
4849from entities .helpers import index_from_inthandle
@@ -1064,7 +1065,7 @@ def emit_sound(
10641065 sound .play (* recipients )
10651066
10661067 def is_in_solid (
1067- self , mask = ContentMasks .ALL , generator = BaseEntityGenerator ):
1068+ self , mask = ContentMasks .ALL , generator = None ):
10681069 """Return whether or not the entity is in solid.
10691070
10701071 :param ContentMasks mask:
@@ -1081,8 +1082,16 @@ def is_in_solid(
10811082 trace = GameTrace ()
10821083
10831084 # Do the trace
1084- engine_trace .trace_ray (ray , mask , TraceFilterSimple (
1085- generator ()), trace )
1085+ if generator is None :
1086+
1087+ # No need to trace against anything but the world if we are going
1088+ # to filter out everything regardless.
1089+ engine_trace .clip_ray_to_entity (
1090+ ray , mask , BaseEntity (WORLD_ENTITY_INDEX ), trace
1091+ )
1092+ else :
1093+ engine_trace .trace_ray (ray , mask , TraceFilterSimple (
1094+ generator ()), trace )
10861095
10871096 # Return whether or not the trace did hit
10881097 return trace .did_hit ()
0 commit comments