Browse Source

Merge pull request #831 from moth-boi/master

Fix bomb collisions through walls on 3.5
Aaron Franke 2 years ago
parent
commit
f85f8b2b4d
1 changed files with 6 additions and 2 deletions
  1. 6 2
      networking/multiplayer_bomber/bomb.gd

+ 6 - 2
networking/multiplayer_bomber/bomb.gd

@@ -11,8 +11,12 @@ func explode():
 		return
 		return
 	for p in in_area:
 	for p in in_area:
 		if p.has_method("exploded"):
 		if p.has_method("exploded"):
-			# Exploded has a master keyword, so it will only be received by the master.
-			p.rpc("exploded", from_player)
+			# Checks if there is wall in between bomb and the object
+			var world_state = get_world_2d().direct_space_state
+			var result  = world_state.intersect_ray(position, p.position)
+			if not result.collider is TileMap:
+				# Exploded has a master keyword, so it will only be received by the master.
+				p.rpc("exploded", from_player)
 
 
 
 
 func done():
 func done():