From 0c8b8e208a7c5945a483e4285e6ce69756fefe61 Mon Sep 17 00:00:00 2001 From: SlightlyObscure <33038788+SlightlyObscure@users.noreply.github.com> Date: Fri, 22 Nov 2019 11:11:10 +0100 Subject: [PATCH] lever model --- Level/Machinations/FactoryGameplay.tscn | 12 +++--- Things/Lever/Lever.gd | 25 +++++++++++++ Things/Lever/Lever.tscn | 50 +++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 5 deletions(-) create mode 100644 Things/Lever/Lever.gd create mode 100644 Things/Lever/Lever.tscn diff --git a/Level/Machinations/FactoryGameplay.tscn b/Level/Machinations/FactoryGameplay.tscn index 2b68101..76cb0c2 100644 --- a/Level/Machinations/FactoryGameplay.tscn +++ b/Level/Machinations/FactoryGameplay.tscn @@ -1,10 +1,11 @@ -[gd_scene load_steps=15 format=2] +[gd_scene load_steps=16 format=2] [ext_resource path="res://Level/Machinations/PipeGame.gd" type="Script" id=1] [ext_resource path="res://Things/Pipes/EckiPipe.tscn" type="PackedScene" id=2] [ext_resource path="res://Things/ReusableMaterials/Pipe_Dream.tres" type="Material" id=3] [ext_resource path="res://Things/Pipes/StraightPipe.tscn" type="PackedScene" id=4] [ext_resource path="res://Things/Pipes/StraightForkPipe.tscn" type="PackedScene" id=5] +[ext_resource path="res://Things/Lever/Lever.tscn" type="PackedScene" id=6] [sub_resource type="BoxShape" id=1] @@ -44,11 +45,11 @@ fork7 = NodePath("Pipes/Forks/Fork8") fork8 = NodePath("Pipes/Forks/Fork9") [node name="CollisionShape" type="CollisionShape" parent="."] -transform = Transform( 2, 0, 0, 0, 0.2, 0, 0, 0, 1, 0, 0.85, 0 ) +transform = Transform( 2.3, 0, 0, 0, 0.2, 0, 0, 0, 1, 0.3, 0.85, 0 ) shape = SubResource( 1 ) [node name="Table" type="MeshInstance" parent="."] -transform = Transform( 2, 0, 0, 0, 0.2, 0, 0, 0, 1, 0, 0.85, 0 ) +transform = Transform( 2.3, 0, 0, 0, 0.2, 0, 0, 0, 1, 0.3, 0.85, 0 ) layers = 3 mesh = SubResource( 2 ) material/0 = null @@ -105,6 +106,7 @@ mesh = SubResource( 3 ) material/0 = SubResource( 9 ) [node name="Pipes" type="Spatial" parent="."] +editor/display_folded = true transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0 ) [node name="Forks" type="Spatial" parent="Pipes"] @@ -446,8 +448,8 @@ 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="Camera" type="Camera" parent="."] -transform = Transform( 1, 0, 0, 0, 0.764615, 0.644487, 0, -0.644487, 0.764615, 0, 4.83485, 5.44687 ) +[node name="Lever" parent="." instance=ExtResource( 6 )] +transform = Transform( 1, 0, 0, 0, -4.37114e-008, 1, 0, -1, -4.37114e-008, 2.4, 1.1, 0 ) [editable path="Pipes/Forks/Fork1"] diff --git a/Things/Lever/Lever.gd b/Things/Lever/Lever.gd new file mode 100644 index 0000000..1e2b553 --- /dev/null +++ b/Things/Lever/Lever.gd @@ -0,0 +1,25 @@ +extends StaticBody + +# export variables +export(NodePath) var outline_path +export(NodePath) var levermesh_path + +# private members +var _isOn = false +# var b = "text" + +func do_interact(var player): + if(_isOn): + get_node(levermesh_path).rotate_x(-PI/2) + _isOn = false + else: + get_node(levermesh_path).rotate_x(PI/2) + _isOn = true + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + +# Called every frame. 'delta' is the elapsed time since the previous frame. +#func _process(delta): +# pass diff --git a/Things/Lever/Lever.tscn b/Things/Lever/Lever.tscn new file mode 100644 index 0000000..3b8679c --- /dev/null +++ b/Things/Lever/Lever.tscn @@ -0,0 +1,50 @@ +[gd_scene load_steps=7 format=2] + +[ext_resource path="res://Things/Lever/Lever.gd" type="Script" id=1] +[ext_resource path="res://Things/ReusableMaterials/Glow.tres" type="Material" id=2] + +[sub_resource type="CubeMesh" id=1] + +[sub_resource type="CubeMesh" id=2] + +[sub_resource type="ArrayMesh" id=3] +surfaces/0 = { +"aabb": AABB( -1.11547, -1.11547, -1.11547, 2.23094, 2.23095, 2.23095 ), +"array_data": PoolByteArray( 185, 199, 142, 191, 185, 199, 142, 63, 185, 199, 142, 63, 0, 0, 127, 0, 127, 0, 0, 127, 0, 0, 0, 0, 185, 199, 142, 63, 185, 199, 142, 63, 185, 199, 142, 191, 0, 0, 129, 0, 129, 0, 0, 127, 85, 57, 0, 0, 185, 199, 142, 63, 185, 199, 142, 63, 185, 199, 142, 63, 0, 0, 127, 0, 127, 0, 0, 127, 85, 53, 0, 0, 185, 199, 142, 191, 185, 199, 142, 63, 185, 199, 142, 191, 0, 0, 129, 0, 129, 0, 0, 127, 0, 60, 0, 0, 185, 199, 142, 191, 185, 199, 142, 191, 185, 199, 142, 63, 0, 0, 127, 0, 127, 0, 0, 127, 0, 0, 0, 56, 185, 199, 142, 63, 185, 199, 142, 191, 185, 199, 142, 191, 0, 0, 129, 0, 129, 0, 0, 127, 85, 57, 0, 56, 185, 199, 142, 63, 185, 199, 142, 191, 185, 199, 142, 63, 0, 0, 127, 0, 127, 0, 0, 127, 85, 53, 0, 56, 185, 199, 142, 191, 185, 199, 142, 191, 185, 199, 142, 191, 0, 0, 129, 0, 129, 0, 0, 127, 0, 60, 0, 56, 185, 199, 142, 63, 185, 199, 142, 63, 185, 199, 142, 63, 127, 0, 0, 0, 0, 0, 129, 127, 85, 53, 0, 0, 185, 199, 142, 191, 185, 199, 142, 63, 185, 199, 142, 191, 129, 0, 0, 0, 0, 0, 127, 127, 0, 0, 0, 56, 185, 199, 142, 63, 185, 199, 142, 63, 185, 199, 142, 191, 127, 0, 0, 0, 0, 0, 129, 127, 85, 57, 0, 0, 185, 199, 142, 191, 185, 199, 142, 63, 185, 199, 142, 63, 129, 0, 0, 0, 0, 0, 127, 127, 85, 53, 0, 56, 185, 199, 142, 63, 185, 199, 142, 191, 185, 199, 142, 63, 127, 0, 0, 0, 0, 0, 129, 127, 85, 53, 0, 56, 185, 199, 142, 191, 185, 199, 142, 191, 185, 199, 142, 191, 129, 0, 0, 0, 0, 0, 127, 127, 0, 0, 0, 60, 185, 199, 142, 63, 185, 199, 142, 191, 185, 199, 142, 191, 127, 0, 0, 0, 0, 0, 129, 127, 85, 57, 0, 56, 185, 199, 142, 191, 185, 199, 142, 191, 185, 199, 142, 63, 129, 0, 0, 0, 0, 0, 127, 127, 85, 53, 0, 60, 185, 199, 142, 63, 185, 199, 142, 63, 185, 199, 142, 63, 0, 127, 0, 0, 129, 0, 0, 127, 85, 53, 0, 56, 185, 199, 142, 191, 185, 199, 142, 191, 185, 199, 142, 63, 0, 129, 0, 0, 127, 0, 0, 127, 85, 57, 0, 56, 185, 199, 142, 191, 185, 199, 142, 63, 185, 199, 142, 63, 0, 127, 0, 0, 129, 0, 0, 127, 85, 57, 0, 56, 185, 199, 142, 63, 185, 199, 142, 191, 185, 199, 142, 63, 0, 129, 0, 0, 127, 0, 0, 127, 0, 60, 0, 56, 185, 199, 142, 63, 185, 199, 142, 63, 185, 199, 142, 191, 0, 127, 0, 0, 129, 0, 0, 127, 85, 53, 0, 60, 185, 199, 142, 191, 185, 199, 142, 191, 185, 199, 142, 191, 0, 129, 0, 0, 127, 0, 0, 127, 85, 57, 0, 60, 185, 199, 142, 191, 185, 199, 142, 63, 185, 199, 142, 191, 0, 127, 0, 0, 129, 0, 0, 127, 85, 57, 0, 60, 185, 199, 142, 63, 185, 199, 142, 191, 185, 199, 142, 191, 0, 129, 0, 0, 127, 0, 0, 127, 0, 60, 0, 60 ), +"array_index_data": PoolByteArray( 0, 0, 4, 0, 2, 0, 2, 0, 4, 0, 6, 0, 1, 0, 5, 0, 3, 0, 3, 0, 5, 0, 7, 0, 8, 0, 12, 0, 10, 0, 10, 0, 12, 0, 14, 0, 9, 0, 13, 0, 11, 0, 11, 0, 13, 0, 15, 0, 16, 0, 20, 0, 18, 0, 18, 0, 20, 0, 22, 0, 17, 0, 21, 0, 19, 0, 19, 0, 21, 0, 23, 0 ), +"blend_shape_data": [ ], +"format": 97559, +"index_count": 36, +"primitive": 4, +"skeleton_aabb": [ ], +"vertex_count": 24 +} + +[sub_resource type="BoxShape" id=4] + +[node name="Lever" type="StaticBody" groups=[ +"Touchables", +]] +script = ExtResource( 1 ) +outline_path = NodePath("LeverMesh/Outline") +levermesh_path = NodePath("LeverMesh") + +[node name="BoxMesh" type="MeshInstance" parent="."] +transform = Transform( 0.1, 0, 0, 0, 0.2, 0, 0, 0, 0.05, 0, 0, 0 ) +mesh = SubResource( 1 ) +material/0 = null + +[node name="LeverMesh" type="MeshInstance" parent="."] +transform = Transform( 0.025, 0, 0, 0, 0.141421, -0.0176777, 0, 0.141421, 0.0176777, 0, 0.15, 0.17 ) +mesh = SubResource( 2 ) +material/0 = null + +[node name="Outline" type="MeshInstance" parent="LeverMesh"] +transform = Transform( 1.05, 0, 0, 0, 0.95, 0, 0, 0, 1.05, 0, 0, 0 ) +visible = false +mesh = SubResource( 3 ) +material/0 = ExtResource( 2 ) + +[node name="CollisionShape" type="CollisionShape" parent="."] +transform = Transform( 0.1, 0, 0, 0, 0.25, 0, 0, 0, 0.2, 0, 0.05, 0.15 ) +shape = SubResource( 4 )