From 4f9bbc389b91e6e2d5f9b78fa5f68e136c0d5dc6 Mon Sep 17 00:00:00 2001 From: SlightlyObscure <33038788+SlightlyObscure@users.noreply.github.com> Date: Sat, 23 Nov 2019 20:44:25 +0100 Subject: [PATCH] longer pipe ray casts --- .../FactoryMachines/FactoryGameplay.tscn | 36 ++++++++++--------- Level/Interactables/Pipes/EckiPipe.tscn | 15 ++++---- Level/Interactables/Pipes/InputBox.tscn | 2 +- Level/Interactables/Pipes/PipeScript.gd | 20 +++++++---- .../Interactables/Pipes/StraightForkPipe.tscn | 10 +++--- Level/Interactables/Pipes/StraightPipe.tscn | 3 +- Level/PathTestWorld.tscn | 1 + Materials/Pipe_Dream.tres | 1 + 8 files changed, 52 insertions(+), 36 deletions(-) diff --git a/Level/Interactables/FactoryMachines/FactoryGameplay.tscn b/Level/Interactables/FactoryMachines/FactoryGameplay.tscn index 73d5fd4..d202d57 100644 --- a/Level/Interactables/FactoryMachines/FactoryGameplay.tscn +++ b/Level/Interactables/FactoryMachines/FactoryGameplay.tscn @@ -122,6 +122,7 @@ can_turn = true z_rot = -90 [node name="Mesh" parent="Pipes/Forks/Fork1" index="0"] +editor/display_folded = true transform = Transform( 0.2, 6.88533e-022, 0, 6.88533e-022, 0.2, 0, 0, 0, 0.2, 0.00154328, 0, 2.57492e-005 ) material/0 = ExtResource( 4 ) @@ -247,10 +248,16 @@ transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -2.35 transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -2.35, 1.25, 0.8 ) [node name="Pipe22" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] +editor/display_folded = true transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -1.95, 1.25, -0.8 ) -[node name="Pipe5" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] -transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, 0.45, 1.25, 0 ) +[node name="Pipe24" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] +editor/display_folded = true +transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -1.55, 1.25, -0.8 ) + +[node name="Pipe50" parent="Pipes/Non-Forks" instance=ExtResource( 6 )] +transform = Transform( 1.91069e-015, 4.37114e-008, 1, 1, -4.37114e-008, 0, 4.37114e-008, 1, -4.37114e-008, -1.15, 1.25, -0.8 ) +outline_path = NodePath("../../../PipeGame/Pipes/Pipe50/Mesh/Outline") [node name="Pipe14" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -0.35, 1.65, 0.8 ) @@ -266,10 +273,6 @@ outline_path = NodePath("../../../PipeGame/Pipes/Pipe2/Mesh/Outline") transform = Transform( -4.37114e-008, -1, 0, 1, -4.37114e-008, 0, 0, 0, 1, -1.55, 1.65, -0.4 ) outline_path = NodePath("../../../PipeGame/Pipes/Pipe55/Mesh/Outline") -[node name="Pipe50" parent="Pipes/Non-Forks" instance=ExtResource( 6 )] -transform = Transform( 1.91069e-015, 4.37114e-008, 1, 1, -4.37114e-008, 0, 4.37114e-008, 1, -4.37114e-008, -1.15, 1.25, -0.8 ) -outline_path = NodePath("../../../PipeGame/Pipes/Pipe50/Mesh/Outline") - [node name="Pipe49" parent="Pipes/Non-Forks" instance=ExtResource( 6 )] transform = Transform( 1.91069e-015, 4.37114e-008, 1, 1, -4.37114e-008, 0, 4.37114e-008, 1, -4.37114e-008, 0.05, 1.25, 0 ) outline_path = NodePath("../../../PipeGame/Pipes/Pipe49/Mesh/Outline") @@ -282,9 +285,16 @@ outline_path = NodePath("../../../PipeGame/Pipes/Pipe10/Mesh/Outline") transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, 0.45, 1.25, -0.8 ) outline_path = NodePath("../../../PipeGame/Pipes/Pipe10/Mesh/Outline") +[node name="Pipe" parent="Pipes/Non-Forks" instance=ExtResource( 6 )] +transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -1.95, 1.25, -0.4 ) +outline_path = NodePath("../../../PipeGame/Pipes/Pipe/Mesh/Outline") + [node name="Pipe48" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.05, 1.65, 0 ) +[node name="Pipe18" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] +transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -1.55, 1.25, -0.4 ) + [node name="Pipe53" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.35, 1.65, -0.4 ) @@ -294,9 +304,6 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.75, 1.65, -0.4 ) [node name="Pipe64" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.75, 1.65, 0 ) -[node name="Pipe24" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] -transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -1.55, 1.25, -0.8 ) - [node name="Pipe35" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -0.75, 1.25, -0.8 ) @@ -312,9 +319,6 @@ transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -1.15 [node name="Pipe59" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -0.75, 1.25, 0 ) -[node name="Pipe18" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] -transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -1.55, 1.25, -0.4 ) - [node name="Pipe7" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -1.95, 1.25, 0 ) @@ -440,10 +444,6 @@ editor/display_folded = true transform = Transform( -4.37114e-008, 0, -1, 0, 1, 0, 1, 0, -4.37114e-008, 0.45, 1.25, 0.8 ) outline_path = NodePath("../../../PipeGame/Pipes/Pipe45/Mesh/Outline") -[node name="Pipe" parent="Pipes/Non-Forks" instance=ExtResource( 6 )] -transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, -1.95, 1.25, -0.4 ) -outline_path = NodePath("../../../PipeGame/Pipes/Pipe/Mesh/Outline") - [node name="Pipe17" parent="Pipes/Non-Forks" instance=ExtResource( 6 )] transform = Transform( 1.91069e-015, -4.37114e-008, 1, -1, -4.37114e-008, 0, 4.37114e-008, -1, -4.37114e-008, -1.95, 1.25, 0.8 ) outline_path = NodePath("../../../PipeGame/Pipes/Pipe17/Mesh/Outline") @@ -460,6 +460,10 @@ outline_path = NodePath("../../../PipeGame/Pipes/Pipe33/Mesh/Outline") transform = Transform( -1, 8.74228e-008, 0, -8.74228e-008, -1, 0, 0, 0, 1, -1.95, 1.65, 0.4 ) outline_path = NodePath("../../../PipeGame/Pipes/Pipe62/Mesh/Outline") +[node name="Pipe5" parent="Pipes/Non-Forks" instance=ExtResource( 5 )] +editor/display_folded = true +transform = Transform( -4.37114e-008, 0, 1, 0, 1, 0, -1, 0, -4.37114e-008, 0.45, 1.25, 0 ) + [node name="Lever" parent="." instance=ExtResource( 7 )] transform = Transform( 1, 0, 0, 0, -4.37114e-008, 1, 0, -1, -4.37114e-008, 2.4, 1.1, 0 ) diff --git a/Level/Interactables/Pipes/EckiPipe.tscn b/Level/Interactables/Pipes/EckiPipe.tscn index e0bdd1e..b9121b1 100644 --- a/Level/Interactables/Pipes/EckiPipe.tscn +++ b/Level/Interactables/Pipes/EckiPipe.tscn @@ -4,7 +4,7 @@ [ext_resource path="res://Resources/Models/eckiPipe/Material.material" type="Material" id=2] [ext_resource path="res://Materials/Glow.tres" type="Material" id=3] -[sub_resource type="ArrayMesh" id=1] +[sub_resource type="ArrayMesh" id=10] resource_name = "Cube" surfaces/0 = { "aabb": AABB( -0.5, -0.5, -1, 1.00001, 1.5, 1.5 ), @@ -20,7 +20,7 @@ surfaces/0 = { "vertex_count": 36 } -[sub_resource type="ArrayMesh" id=2] +[sub_resource type="ArrayMesh" id=11] surfaces/0 = { "aabb": AABB( -0.557735, -0.557735, -1.05773, 1.11548, 1.61547, 1.61547 ), "array_data": PoolByteArray( 185, 199, 14, 63, 185, 199, 14, 63, 185, 199, 14, 191, 0, 127, 0, 0, 129, 0, 0, 127, 0, 54, 0, 54, 185, 199, 14, 191, 185, 199, 14, 63, 220, 99, 135, 191, 0, 127, 0, 0, 129, 0, 0, 127, 0, 59, 0, 56, 185, 199, 14, 191, 185, 199, 14, 63, 185, 199, 14, 191, 0, 127, 0, 0, 149, 0, 189, 129, 0, 0, 0, 60, 185, 199, 14, 63, 220, 99, 135, 63, 185, 199, 14, 191, 0, 127, 0, 0, 0, 0, 129, 127, 0, 57, 0, 58, 185, 199, 14, 191, 220, 99, 135, 63, 185, 199, 14, 63, 0, 127, 0, 0, 0, 0, 129, 127, 0, 54, 0, 56, 185, 199, 14, 63, 220, 99, 135, 63, 185, 199, 14, 63, 0, 127, 0, 0, 0, 0, 129, 127, 0, 54, 0, 58, 185, 199, 14, 63, 220, 99, 135, 63, 185, 199, 14, 191, 0, 0, 129, 0, 47, 139, 0, 129, 0, 54, 0, 52, 185, 199, 14, 191, 185, 199, 14, 63, 185, 199, 14, 191, 0, 0, 129, 0, 47, 139, 0, 129, 0, 0, 0, 60, 185, 199, 14, 191, 220, 99, 135, 63, 185, 199, 14, 191, 0, 0, 129, 0, 133, 30, 0, 127, 0, 57, 0, 56, 185, 199, 14, 63, 185, 199, 14, 191, 185, 199, 14, 63, 0, 0, 127, 0, 127, 0, 0, 127, 0, 57, 0, 48, 185, 199, 14, 191, 220, 99, 135, 63, 185, 199, 14, 63, 0, 0, 127, 0, 127, 0, 0, 127, 0, 54, 0, 0, 185, 199, 14, 191, 185, 199, 14, 191, 185, 199, 14, 63, 0, 0, 127, 0, 127, 0, 0, 127, 0, 54, 0, 48, 185, 199, 14, 63, 185, 199, 14, 63, 185, 199, 14, 191, 127, 0, 0, 0, 0, 89, 167, 127, 0, 54, 0, 54, 185, 199, 14, 63, 220, 99, 135, 63, 185, 199, 14, 63, 127, 0, 0, 0, 0, 67, 149, 127, 0, 48, 0, 52, 185, 199, 14, 63, 185, 199, 14, 191, 185, 199, 14, 63, 127, 0, 0, 0, 0, 89, 167, 127, 0, 48, 0, 54, 185, 199, 14, 191, 185, 199, 14, 63, 220, 99, 135, 191, 0, 0, 129, 0, 0, 127, 0, 127, 0, 59, 0, 56, 185, 199, 14, 63, 185, 199, 14, 191, 220, 99, 135, 191, 0, 0, 129, 0, 0, 127, 0, 127, 0, 57, 0, 52, 185, 199, 14, 191, 185, 199, 14, 191, 220, 99, 135, 191, 0, 0, 129, 0, 0, 127, 0, 127, 0, 57, 0, 56, 185, 199, 14, 191, 185, 199, 14, 63, 185, 199, 14, 191, 129, 0, 0, 0, 0, 111, 195, 129, 0, 0, 0, 60, 185, 199, 14, 191, 185, 199, 14, 63, 220, 99, 135, 191, 129, 0, 0, 0, 0, 123, 226, 127, 0, 59, 0, 56, 185, 199, 14, 191, 185, 199, 14, 191, 220, 99, 135, 191, 129, 0, 0, 0, 0, 33, 134, 127, 0, 54, 0, 52, 185, 199, 14, 63, 185, 199, 14, 63, 220, 99, 135, 191, 0, 127, 0, 0, 129, 0, 0, 127, 0, 54, 0, 56, 185, 199, 14, 191, 220, 99, 135, 63, 185, 199, 14, 191, 0, 127, 0, 0, 0, 0, 129, 127, 0, 57, 0, 56, 185, 199, 14, 63, 185, 199, 14, 63, 185, 199, 14, 191, 0, 0, 129, 0, 47, 139, 0, 129, 0, 54, 0, 54, 185, 199, 14, 191, 185, 199, 14, 191, 185, 199, 14, 63, 0, 129, 0, 0, 127, 0, 0, 127, 0, 54, 0, 48, 185, 199, 14, 191, 185, 199, 14, 191, 220, 99, 135, 191, 0, 129, 0, 0, 127, 0, 0, 127, 0, 54, 0, 52, 185, 199, 14, 63, 185, 199, 14, 191, 220, 99, 135, 191, 0, 129, 0, 0, 127, 0, 0, 127, 0, 57, 0, 52, 185, 199, 14, 63, 220, 99, 135, 63, 185, 199, 14, 63, 0, 0, 127, 0, 127, 0, 0, 127, 0, 57, 0, 0, 185, 199, 14, 63, 185, 199, 14, 191, 185, 199, 14, 63, 0, 129, 0, 0, 127, 0, 0, 127, 0, 57, 0, 48, 185, 199, 14, 63, 185, 199, 14, 191, 220, 99, 135, 191, 127, 0, 0, 0, 0, 107, 189, 127, 0, 48, 0, 56, 185, 199, 14, 63, 185, 199, 14, 63, 220, 99, 135, 191, 127, 0, 0, 0, 0, 127, 0, 127, 0, 54, 0, 56, 185, 199, 14, 63, 220, 99, 135, 63, 185, 199, 14, 191, 127, 0, 0, 0, 0, 0, 129, 127, 0, 54, 0, 52, 185, 199, 14, 63, 185, 199, 14, 63, 220, 99, 135, 191, 0, 0, 129, 0, 0, 127, 0, 127, 0, 59, 0, 52, 185, 199, 14, 191, 185, 199, 14, 191, 185, 199, 14, 63, 129, 0, 0, 0, 0, 117, 47, 129, 0, 54, 0, 48, 185, 199, 14, 191, 220, 99, 135, 63, 185, 199, 14, 63, 129, 0, 0, 0, 0, 126, 250, 129, 0, 54, 0, 56, 185, 199, 14, 191, 220, 99, 135, 63, 185, 199, 14, 191, 129, 0, 0, 0, 0, 0, 129, 129, 0, 57, 0, 56 ), @@ -33,12 +33,13 @@ surfaces/0 = { "vertex_count": 36 } -[sub_resource type="BoxShape" id=3] +[sub_resource type="BoxShape" id=12] [node name="Spatial" type="StaticBody" groups=[ "Pipes", ]] collision_layer = 7 +collision_mask = 7 script = ExtResource( 1 ) outline_path = NodePath("Mesh/Outline") mesh_path = NodePath("Mesh") @@ -47,20 +48,20 @@ color_cast_left = NodePath("ColorCast") [node name="Mesh" type="MeshInstance" parent="."] transform = Transform( 0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, 0 ) layers = 3 -mesh = SubResource( 1 ) +mesh = SubResource( 10 ) material/0 = null [node name="Outline" type="MeshInstance" parent="Mesh"] visible = false -mesh = SubResource( 2 ) +mesh = SubResource( 11 ) material/0 = ExtResource( 3 ) [node name="CollisionShape" type="CollisionShape" parent="."] transform = Transform( 0.1, 0, 0, 0, 0.14, 0, 0, 0, 0.14, 0, 0.05, -0.05 ) -shape = SubResource( 3 ) +shape = SubResource( 12 ) [node name="ColorCast" type="RayCast" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.2 ) enabled = true -cast_to = Vector3( 0, 0, -0.02 ) +cast_to = Vector3( 0, 0, -0.05 ) collision_mask = 7 diff --git a/Level/Interactables/Pipes/InputBox.tscn b/Level/Interactables/Pipes/InputBox.tscn index fcdea90..f27bd2a 100644 --- a/Level/Interactables/Pipes/InputBox.tscn +++ b/Level/Interactables/Pipes/InputBox.tscn @@ -7,8 +7,8 @@ [sub_resource type="BoxShape" id=2] [node name="InputBox" type="StaticBody" groups=[ -"InputBoxes", "Pipes", +"InputBoxes", ]] collision_layer = 7 script = ExtResource( 1 ) diff --git a/Level/Interactables/Pipes/PipeScript.gd b/Level/Interactables/Pipes/PipeScript.gd index f3160c7..4ca05b4 100644 --- a/Level/Interactables/Pipes/PipeScript.gd +++ b/Level/Interactables/Pipes/PipeScript.gd @@ -46,13 +46,15 @@ func do_interact(var player): func _get_color_from_cast(ray_cast : RayCast): if ray_cast.is_colliding(): + if get_name() == "Pipe": + print("TTTTEEEEEEEEEESSSSSSSSSTTTTTTTTTTT") var collider = ray_cast.get_collider() if collider.is_in_group("Pipes"): var new_color = collider.content_color if new_color != null: return new_color -func update_content_color(): +func update_content_color(): if _left_cast != null: var new_color = _get_color_from_cast(_left_cast) if new_color != null: @@ -68,15 +70,21 @@ func update_content_color(): content_color = _left_color elif _up_color != NULL_COLOR: content_color = _up_color - - if content_color != NULL_COLOR: - if _mesh != null: - var material = _mesh.get_surface_material(0) + + if _mesh != null: + var material = _mesh.get_surface_material(0) + + if content_color != NULL_COLOR: if material == null: material = SpatialMaterial.new() _mesh.material_override = material material.albedo_color = content_color - + else: + if can_turn: + #_mesh.material_override = load("res://Materials/Pipe_Dream.tres") + pass + else: + _mesh.material_override = null # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): # pass diff --git a/Level/Interactables/Pipes/StraightForkPipe.tscn b/Level/Interactables/Pipes/StraightForkPipe.tscn index 5afa7f0..483855b 100644 --- a/Level/Interactables/Pipes/StraightForkPipe.tscn +++ b/Level/Interactables/Pipes/StraightForkPipe.tscn @@ -38,11 +38,11 @@ surfaces/0 = { "Pipes", ]] collision_layer = 7 +collision_mask = 7 script = ExtResource( 1 ) outline_path = NodePath("Mesh/Outline") mesh_path = NodePath("Mesh") -color_cast_left = NodePath("ColorCastUp") -color_cast_up = NodePath("ColorCastUp") +color_cast_left = NodePath("ColorCastLeft") [node name="Mesh" type="MeshInstance" parent="."] transform = Transform( 0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, 0 ) @@ -60,13 +60,13 @@ transform = Transform( 0.1, 0, 0, 0, 0.14, 0, 0, 0, 0.18, 0, 0.05, 0 ) shape = SubResource( 3 ) [node name="ColorCastLeft" type="RayCast" parent="."] -transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.2 ) +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.72529e-009, -0.2 ) enabled = true -cast_to = Vector3( 0, 0, -0.02 ) +cast_to = Vector3( 0, 0, -0.05 ) collision_mask = 7 [node name="ColorCastUp" type="RayCast" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.2, 0 ) enabled = true -cast_to = Vector3( 0, 0.02, 0 ) +cast_to = Vector3( 0, 0.05, 0 ) collision_mask = 7 diff --git a/Level/Interactables/Pipes/StraightPipe.tscn b/Level/Interactables/Pipes/StraightPipe.tscn index 48ea8e3..de4af1b 100644 --- a/Level/Interactables/Pipes/StraightPipe.tscn +++ b/Level/Interactables/Pipes/StraightPipe.tscn @@ -39,6 +39,7 @@ surfaces/0 = { "Pipes", ]] collision_layer = 7 +collision_mask = 7 script = ExtResource( 1 ) outline_path = NodePath("Mesh/Outline") mesh_path = NodePath("Mesh") @@ -62,5 +63,5 @@ shape = SubResource( 3 ) [node name="ColorCast" type="RayCast" parent="."] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.2 ) enabled = true -cast_to = Vector3( 0, 0, -0.02 ) +cast_to = Vector3( 0, 0, -0.05 ) collision_mask = 7 diff --git a/Level/PathTestWorld.tscn b/Level/PathTestWorld.tscn index c06f1ce..be3d146 100644 --- a/Level/PathTestWorld.tscn +++ b/Level/PathTestWorld.tscn @@ -111,4 +111,5 @@ card_door = true door_lvl = 1 [node name="Gameplay?" parent="." instance=ExtResource( 8 )] +editor/display_folded = true transform = Transform( -4.37114e-008, -1, 4.37114e-008, 0, -4.37114e-008, -1, 1, -4.37114e-008, 1.91069e-015, 7, 2, 2 ) diff --git a/Materials/Pipe_Dream.tres b/Materials/Pipe_Dream.tres index fa1d18e..bd30c9d 100644 --- a/Materials/Pipe_Dream.tres +++ b/Materials/Pipe_Dream.tres @@ -1,6 +1,7 @@ [gd_resource type="SpatialMaterial" format=2] [resource] +resource_local_to_scene = true flags_transparent = true albedo_color = Color( 0.905882, 0.905882, 0.905882, 0.772549 ) metallic = 1.0