diff --git a/BodyConfig/bodyBuildingScript.gd b/BodyConfig/bodyBuildingScript.gd index 74c1315..553f457 100644 --- a/BodyConfig/bodyBuildingScript.gd +++ b/BodyConfig/bodyBuildingScript.gd @@ -51,7 +51,6 @@ func _ready(): func change_count_ui(): if done_player_count == null: - print("test") done_player_count = 0 _playerNum.text = str(done_player_count + 1) + "/" + str(InGameState.player_count) @@ -169,6 +168,9 @@ func delete_body_part(): var body_part = _attachment_point.get_node("Limb").get_child(0) if body_part != null: _costProgress.value -= body_part.cost + #delete collider with id + var old_col_path = "LimbCollider" + str(_attachment_point.id) + _torso.get_node(old_col_path).queue_free() body_part.queue_free() diff --git a/BodyParts/BodyBase/AttachmentPoint.gd b/BodyParts/BodyBase/AttachmentPoint.gd index 7ca3fe8..84c5802 100644 --- a/BodyParts/BodyBase/AttachmentPoint.gd +++ b/BodyParts/BodyBase/AttachmentPoint.gd @@ -2,6 +2,7 @@ extends Spatial export(int) var key +export(int) var id onready var limb = get_node("Limb") diff --git a/BodyParts/BodyBase/BodyBase.tscn b/BodyParts/BodyBase/BodyBase.tscn index e68f92a..9b7cb80 100644 --- a/BodyParts/BodyBase/BodyBase.tscn +++ b/BodyParts/BodyBase/BodyBase.tscn @@ -25,6 +25,7 @@ shape = SubResource( 1 ) [node name="DownFrontLeft" parent="." instance=ExtResource( 2 )] transform = Transform( 0.965926, -1.45851e-07, -0.258819, -1.50996e-07, -1, -1.77636e-15, -0.258819, 3.90806e-08, -0.965926, 1.3, 1, 4.2 ) key = 68 +id = 1 [node name="Mesh" parent="DownFrontLeft" index="0"] transform = Transform( 0.2, 0, 3.72529e-09, 0, 0.2, 0, -3.72529e-09, 0, 0.2, 0, 0, 0 ) @@ -32,6 +33,7 @@ transform = Transform( 0.2, 0, 3.72529e-09, 0, 0.2, 0, -3.72529e-09, 0, 0.2, 0, [node name="DownFrontRight" parent="." instance=ExtResource( 2 )] transform = Transform( 0.965926, -1.45851e-07, 0.258819, -1.50996e-07, -1, 1.77636e-15, 0.258819, -3.90806e-08, -0.965926, -1.3, 1, 4.2 ) key = 70 +id = 2 [node name="OmniLight" parent="DownFrontRight" index="1"] transform = Transform( 1, 3.13083e-13, 0, -3.09641e-13, 1, -5.59552e-14, 0, 5.59552e-14, 1, -0.680858, -1.19209e-07, -1.38872 ) @@ -42,26 +44,32 @@ transform = Transform( 0.5, 1.4988e-15, 0, 1.4988e-15, 0.5, 0, 0, 0, 0.5, 0, 0, [node name="DownBackRight" parent="." instance=ExtResource( 2 )] transform = Transform( 0.982402, -3.24601e-07, 0.0859489, -3.2133e-07, -1, 0, 0.0859489, -2.83989e-08, -0.982402, -1.9, -1, 3.6 ) key = 83 +id = 3 [node name="DownBackLeft" parent="." instance=ExtResource( 2 )] transform = Transform( 0.982402, 3.24601e-07, -0.0859489, 3.2133e-07, -1, 0, -0.0859489, -2.83989e-08, -0.982402, 1.9, -1, 3.6 ) key = 65 +id = 4 [node name="UpFrontLeft" parent="." instance=ExtResource( 2 )] transform = Transform( 0.103081, -3.40598e-08, -0.980752, -3.2133e-07, -1, 0, -0.980752, 3.24056e-07, -0.103081, 2.9, 0, -2 ) key = 69 +id = 5 [node name="UpFrontRight" parent="." instance=ExtResource( 2 )] transform = Transform( 0.103081, 3.40598e-08, 0.980752, 3.2133e-07, -1, 0, 0.980752, 3.24056e-07, -0.103081, -2.9, 0, -2 ) key = 82 +id = 6 [node name="UpBackRight" parent="." instance=ExtResource( 2 )] transform = Transform( -0.870723, 0.384569, 0.26555, -1.84307e-07, -0.573576, 0.807811, 0.462972, 0.723268, 0.499426, -1, -1.9, -2.5 ) key = 81 +id = 7 [node name="UpBackLeft" parent="." instance=ExtResource( 2 )] transform = Transform( -0.870723, -0.384569, -0.26555, 1.84307e-07, -0.573576, 0.807811, -0.462972, 0.723268, 0.499426, 1, -1.9, -2.5 ) key = 87 +id = 8 [node name="Head" parent="." instance=ExtResource( 2 )] transform = Transform( -0.986155, 3.25841e-07, 0, -3.2133e-07, -1, 0, 0, 0, 0.986155, 0, 0, -3.63054 ) diff --git a/BodyParts/BodyPart.gd b/BodyParts/BodyPart.gd index 3cc7c66..abd0197 100644 --- a/BodyParts/BodyPart.gd +++ b/BodyParts/BodyPart.gd @@ -23,7 +23,10 @@ func _process(delta: float) -> void: var translation = physics_shape.global_transform print(translation) + var attach_id = get_parent().get_parent().id + remove_child(physics_shape) + physics_shape.name = "LimbCollider" + str(attach_id) base.add_child(physics_shape) physics_shape.global_transform = translation