From 7ddaf29f8dedad7e4ff43927ebf0f1c87b1cafac Mon Sep 17 00:00:00 2001 From: MotH Date: Tue, 24 Jan 2023 22:01:36 +0100 Subject: [PATCH] Fix bomb collisions through walls --- networking/multiplayer_bomber/bomb.gd | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/networking/multiplayer_bomber/bomb.gd b/networking/multiplayer_bomber/bomb.gd index 65046f3d..f7353167 100644 --- a/networking/multiplayer_bomber/bomb.gd +++ b/networking/multiplayer_bomber/bomb.gd @@ -11,8 +11,12 @@ func explode(): return for p in in_area: 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():