From 9004486a035dbe6ed910d240bb056221572abb2c Mon Sep 17 00:00:00 2001 From: NancokPS2 Date: Tue, 9 Jan 2024 10:21:59 -0300 Subject: [PATCH 1/4] Initial commit; TODO: sync collision change to client --- project.godot | 1 + .../enemy/enemyrespawncomponent/EnemyRespawnComponent.gd | 4 ++++ .../NetworkViewSynchronizerComponent.gd | 1 + scripts/singletons/jdungeon.gd | 1 + 4 files changed, 7 insertions(+) diff --git a/project.godot b/project.godot index 93930ec8..915fbef1 100644 --- a/project.godot +++ b/project.godot @@ -182,6 +182,7 @@ locale/translations=PackedStringArray("res://assets/translation/en_US.en.transla 2d_physics/layer_5="Items" 2d_physics/layer_6="Networking" 2d_physics/layer_7="Projectiles" +2d_physics/layer_8="Passable Entity" [rendering] diff --git a/scripts/components/enemy/enemyrespawncomponent/EnemyRespawnComponent.gd b/scripts/components/enemy/enemyrespawncomponent/EnemyRespawnComponent.gd index 1ea3b1b8..4f3e7da1 100644 --- a/scripts/components/enemy/enemyrespawncomponent/EnemyRespawnComponent.gd +++ b/scripts/components/enemy/enemyrespawncomponent/EnemyRespawnComponent.gd @@ -39,6 +39,10 @@ func _ready(): func _on_died(): despawn_timer.start() + + if target_node is CollisionObject2D: + target_node.collision_layer = J.PHYSICS_LAYER_PASSABLE_ENTITIES + target_node.collision_mask = 0 func _on_despawn_timer_timeout(): diff --git a/scripts/components/networking/networkviewsynchronizercomponent/NetworkViewSynchronizerComponent.gd b/scripts/components/networking/networkviewsynchronizercomponent/NetworkViewSynchronizerComponent.gd index 24811e8e..17638d21 100644 --- a/scripts/components/networking/networkviewsynchronizercomponent/NetworkViewSynchronizerComponent.gd +++ b/scripts/components/networking/networkviewsynchronizercomponent/NetworkViewSynchronizerComponent.gd @@ -52,6 +52,7 @@ func _ready(): + J.PHYSICS_LAYER_ENEMIES + J.PHYSICS_LAYER_NPCS + J.PHYSICS_LAYER_ITEMS + + J.PHYSICS_LAYER_PASSABLE_ENTITIES ) body_network_view_area.add_child(cs_body_network_view_area) diff --git a/scripts/singletons/jdungeon.gd b/scripts/singletons/jdungeon.gd index fef4c1be..594a9c0c 100644 --- a/scripts/singletons/jdungeon.gd +++ b/scripts/singletons/jdungeon.gd @@ -10,6 +10,7 @@ const PHYSICS_LAYER_NPCS = 8 const PHYSICS_LAYER_ITEMS = 16 const PHYSICS_LAYER_NETWORKING = 32 const PHYSICS_LAYER_PROJECTILE = 64 +const PHYSICS_LAYER_PASSABLE_ENTITIES = 128 const ARRIVAL_DISTANCE = 8 const DROP_RANGE = 64 From bab7982c8d139854348e77a7b354a59555f9dabd Mon Sep 17 00:00:00 2001 From: NancokPS2 Date: Tue, 9 Jan 2024 10:25:24 -0300 Subject: [PATCH 2/4] Formatting --- project.godot | 1 - .../enemy/enemyrespawncomponent/EnemyRespawnComponent.gd | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/project.godot b/project.godot index 915fbef1..ff4a0d85 100644 --- a/project.godot +++ b/project.godot @@ -181,7 +181,6 @@ locale/translations=PackedStringArray("res://assets/translation/en_US.en.transla 2d_physics/layer_4="NPCs" 2d_physics/layer_5="Items" 2d_physics/layer_6="Networking" -2d_physics/layer_7="Projectiles" 2d_physics/layer_8="Passable Entity" [rendering] diff --git a/scripts/components/enemy/enemyrespawncomponent/EnemyRespawnComponent.gd b/scripts/components/enemy/enemyrespawncomponent/EnemyRespawnComponent.gd index 4f3e7da1..fedaa8ea 100644 --- a/scripts/components/enemy/enemyrespawncomponent/EnemyRespawnComponent.gd +++ b/scripts/components/enemy/enemyrespawncomponent/EnemyRespawnComponent.gd @@ -39,7 +39,7 @@ func _ready(): func _on_died(): despawn_timer.start() - + if target_node is CollisionObject2D: target_node.collision_layer = J.PHYSICS_LAYER_PASSABLE_ENTITIES target_node.collision_mask = 0 From 99f9ae9fceb3bffa329c9777d16a5823d6a6d68e Mon Sep 17 00:00:00 2001 From: NancokPS2 Date: Wed, 10 Jan 2024 10:19:26 -0300 Subject: [PATCH 3/4] Sync collision changes with the player --- .../common/animationcomponent/AnimationComponent.gd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/components/common/animationcomponent/AnimationComponent.gd b/scripts/components/common/animationcomponent/AnimationComponent.gd index ac07b69e..45a753f4 100644 --- a/scripts/components/common/animationcomponent/AnimationComponent.gd +++ b/scripts/components/common/animationcomponent/AnimationComponent.gd @@ -99,6 +99,10 @@ func _on_died(): animation_player.stop() animation_player.play(die_animation) + if target_node is CollisionObject2D: + target_node.collision_layer = J.PHYSICS_LAYER_PASSABLE_ENTITIES + target_node.collision_mask = 0 + func _on_respawned(): dead = false From 1e81ca6f36e12e660424722602436612bf16b0a3 Mon Sep 17 00:00:00 2001 From: NancokPS2 Date: Thu, 11 Jan 2024 11:32:39 -0300 Subject: [PATCH 4/4] Conflict resolution --- project.godot | 1 + 1 file changed, 1 insertion(+) diff --git a/project.godot b/project.godot index ff4a0d85..915fbef1 100644 --- a/project.godot +++ b/project.godot @@ -181,6 +181,7 @@ locale/translations=PackedStringArray("res://assets/translation/en_US.en.transla 2d_physics/layer_4="NPCs" 2d_physics/layer_5="Items" 2d_physics/layer_6="Networking" +2d_physics/layer_7="Projectiles" 2d_physics/layer_8="Passable Entity" [rendering]