Mechanic test level

This commit is contained in:
Rob Kelly 2025-03-13 12:25:04 -06:00
parent 34b4ad7da2
commit 710d0bf191
9 changed files with 323 additions and 45 deletions

View File

@ -0,0 +1,27 @@
extends Node3D
## Game mechanic testing level
@onready var gunk_hall: GunkBody = %GunkHall
@onready var bulkhead: Node3D = $Bulkhead
@onready var open_switch: Node3D = $Bulkhead/Podium/OpenSwitch
@onready var close_switch: Node3D = $Bulkhead/Podium2/CloseSwitch
@onready var nodule_spawn_point: Marker3D = $NoduleSpawner/NoduleSpawnPoint
static var nodule_scene: PackedScene = load("res://src/world/gunk_node/grunk_nodule.tscn")
func reset() -> void:
print("Resetting level!")
gunk_hall.mask_control.clear(Color.BLACK)
Callable(bulkhead, "close").call()
Callable(open_switch, "enable").call()
Callable(close_switch, "disable").call()
func spawn_nodule() -> void:
for c: Node in nodule_spawn_point.get_children():
c.queue_free()
var instance := nodule_scene.instantiate()
nodule_spawn_point.add_child(instance)

View File

@ -0,0 +1 @@
uid://bvua1l2hb3an6

View File

@ -0,0 +1,234 @@
[gd_scene load_steps=28 format=4 uid="uid://b8rv6dg4tgaeb"]
[ext_resource type="Script" uid="uid://bvua1l2hb3an6" path="res://levels/mechanic_test/mechanic_test.gd" id="1_bg05n"]
[ext_resource type="PackedScene" uid="uid://bwe2jdmvinhqd" path="res://src/player/player.tscn" id="1_goufh"]
[ext_resource type="PackedScene" uid="uid://b6eg8t04rkh0c" path="res://src/props/wall_switch/wall_switch.tscn" id="2_pka60"]
[ext_resource type="PackedScene" uid="uid://c2omlx4ptrc01" path="res://src/world/gunk_body/gunk_body.tscn" id="4_2uiim"]
[ext_resource type="Shader" uid="uid://ckxc0ngd37rtk" path="res://src/shaders/gunk.gdshader" id="5_0j1ke"]
[ext_resource type="Texture2D" uid="uid://8cm835h4gxwe" path="res://assets/debug_mask.png" id="5_x2vho"]
[ext_resource type="FastNoiseLite" uid="uid://cnlvdtx68giv6" path="res://assets/materials/gunk_noise.tres" id="6_x2vho"]
[ext_resource type="PackedScene" uid="uid://dvma1hufsl6mc" path="res://src/props/bulkhead/bulkhead.tscn" id="8_0j1ke"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_goufh"]
[sub_resource type="Sky" id="Sky_pka60"]
sky_material = SubResource("ProceduralSkyMaterial_goufh")
[sub_resource type="Environment" id="Environment_bg05n"]
background_mode = 2
sky = SubResource("Sky_pka60")
[sub_resource type="PlaneMesh" id="PlaneMesh_mn2wa"]
size = Vector2(50, 50)
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_mn2wa"]
[sub_resource type="BoxMesh" id="BoxMesh_goufh"]
size = Vector3(0.5, 2, 0.5)
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_bg05n"]
data = PackedVector3Array(-0.25, 1, 0.25, 0.25, 1, 0.25, -0.25, -1, 0.25, 0.25, 1, 0.25, 0.25, -1, 0.25, -0.25, -1, 0.25, 0.25, 1, -0.25, -0.25, 1, -0.25, 0.25, -1, -0.25, -0.25, 1, -0.25, -0.25, -1, -0.25, 0.25, -1, -0.25, 0.25, 1, 0.25, 0.25, 1, -0.25, 0.25, -1, 0.25, 0.25, 1, -0.25, 0.25, -1, -0.25, 0.25, -1, 0.25, -0.25, 1, -0.25, -0.25, 1, 0.25, -0.25, -1, -0.25, -0.25, 1, 0.25, -0.25, -1, 0.25, -0.25, -1, -0.25, 0.25, 1, 0.25, -0.25, 1, 0.25, 0.25, 1, -0.25, -0.25, 1, 0.25, -0.25, 1, -0.25, 0.25, 1, -0.25, -0.25, -1, 0.25, 0.25, -1, 0.25, -0.25, -1, -0.25, 0.25, -1, 0.25, 0.25, -1, -0.25, -0.25, -1, -0.25)
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_rp2qp"]
load_path = "res://.godot/imported/debug_mask.png-fd2bc783338ed9439fe81a4eef9d86da.s3tc.ctex"
[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_if0c2"]
width = 256
height = 256
depth = 32
seamless = true
seamless_blend_skirt = 0.5
noise = ExtResource("6_x2vho")
[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_2pd8h"]
width = 256
height = 256
depth = 32
seamless = true
seamless_blend_skirt = 0.5
noise = ExtResource("6_x2vho")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_iyuyb"]
resource_local_to_scene = true
render_priority = 0
shader = ExtResource("5_0j1ke")
shader_parameter/color_1 = Color(0, 0.03, 0.1, 1)
shader_parameter/color_2 = Color(0, 0.1, 0.3, 1)
shader_parameter/emission_color = Color(0.25, 0.88, 1, 1)
shader_parameter/pixellation = 128.0
shader_parameter/time_pixellation = 30.0
shader_parameter/roughness = 0.15
shader_parameter/specular_contribution = 0.8
shader_parameter/emission_strength = 0.02
shader_parameter/uv_scale = Vector2(4, 4)
shader_parameter/time_scale = 0.2
shader_parameter/edge_bleed = 0.25
shader_parameter/gunk_mask = SubResource("CompressedTexture2D_rp2qp")
shader_parameter/gunk_noise = SubResource("NoiseTexture3D_if0c2")
shader_parameter/gunk_normal_map = SubResource("NoiseTexture3D_2pd8h")
shader_parameter/jitter_magnitude = 0.0
shader_parameter/jitter_time_scale = 0.1
shader_parameter/vertex_inflation = 0.0
shader_parameter/inflation_pixellation = 10.0
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_2h3rs"]
load_path = "res://.godot/imported/hallway_2_C.png-368e035781dbfc292f80210e8377e1f9.ctex"
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_powch"]
load_path = "res://.godot/imported/hallway_2_M.png-f213557d859a0fe7aab8242b25a4a2c0.ctex"
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_sh2xs"]
load_path = "res://.godot/imported/hallway_2_N.png-6d22130ff0aeb6510ae322aebc31a58e.ctex"
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_tpfln"]
load_path = "res://.godot/imported/hallway_2_R.png-e22266e6db52a2c329569fdae3b64571.ctex"
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2uiim"]
albedo_texture = SubResource("CompressedTexture2D_2h3rs")
metallic = 1.0
metallic_texture = SubResource("CompressedTexture2D_powch")
roughness_texture = SubResource("CompressedTexture2D_tpfln")
normal_enabled = true
normal_texture = SubResource("CompressedTexture2D_sh2xs")
texture_filter = 4
[sub_resource type="ArrayMesh" id="ArrayMesh_0j1ke"]
_surfaces = [{
"aabb": AABB(-1.5, 0, -6, 3, 3, 12),
"format": 34896613377,
"index_count": 24,
"index_data": PackedByteArray("AAABAAIAAgABAAMAAQAAAAQAAwAFAAIABAAAAAYABwAFAAMABAAGAAcABwAGAAUA"),
"name": "Cube",
"primitive": 3,
"uv_scale": Vector4(0, 0, 0, 0),
"vertex_count": 8,
"vertex_data": PackedByteArray("AAAAAAAAAAAAAAAA//8AAAAA//8AAAAAAAD/////AAD//wAA//8AAP////8AAAAA//8AAAAAAAD///////8AAA==")
}]
blend_shape_mode = 0
[sub_resource type="ArrayMesh" id="ArrayMesh_x2vho"]
_surfaces = [{
"aabb": AABB(-1.5, 0, -6, 3, 3, 12),
"attribute_data": PackedByteArray("AAD/f////38AAP+/////v////z8AAP8///8AAAAAAAD///9/AAD/f////z8AAP8//////wAA//////+/AAD/vw=="),
"format": 34896613399,
"index_count": 24,
"index_data": PackedByteArray("AAABAAIAAgABAAMABAAFAAYABgAFAAcACAAJAAoACgAJAAsADAANAA4ADgANAA8A"),
"material": SubResource("StandardMaterial3D_2uiim"),
"name": "Cube",
"primitive": 3,
"uv_scale": Vector4(0, 0, 0, 0),
"vertex_count": 16,
"vertex_data": PackedByteArray("AAAAAAAA//8AAAAA/////wAA//8AAP//AAD//////////wAA////v///AAAAAP+//////////7//////AAD/vwAAAAD//1TVAAAAAAAAVNX//wAA//9U1f//AAAAAFTV////////VNX/////AABU1QAA/////1TVAAD//wAAVNX/v/9//7//f/+//3//v/9//3////9/////f////3///6qqqqqqqqqqqqqqqqqqqqqqKlTVqipU1aoqVNWqKlTV")
}]
blend_shape_mode = 0
shadow_mesh = SubResource("ArrayMesh_0j1ke")
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_qjnj2"]
data = PackedVector3Array(-1.5, 0, -6, -1.5, 0, 6, -1.5, 3, -6, -1.5, 3, -6, -1.5, 0, 6, -1.5, 3, 6, 1.5, 0, 6, 1.5, 0, -6, 1.5, 3, 6, 1.5, 3, 6, 1.5, 0, -6, 1.5, 3, -6, -1.5, 0, 6, -1.5, 0, -6, 1.5, 0, 6, 1.5, 0, 6, -1.5, 0, -6, 1.5, 0, -6, 1.5, 3, 6, 1.5, 3, -6, -1.5, 3, 6, -1.5, 3, 6, 1.5, 3, -6, -1.5, 3, -6)
[node name="MechanicTest" type="Node3D"]
script = ExtResource("1_bg05n")
[node name="Player" parent="." instance=ExtResource("1_goufh")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.866025, -0.156955, -0.474726, 0.5, 0.271854, 0.82225, 0, -0.949453, 0.31391, 0, 0, 0)
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_bg05n")
[node name="WorldFloor" type="StaticBody3D" parent="."]
[node name="MeshInstance3D" type="MeshInstance3D" parent="WorldFloor"]
mesh = SubResource("PlaneMesh_mn2wa")
skeleton = NodePath("../..")
[node name="CollisionShape3D" type="CollisionShape3D" parent="WorldFloor"]
shape = SubResource("WorldBoundaryShape3D_mn2wa")
[node name="ResetPodium" type="StaticBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -2)
[node name="MeshInstance3D" type="MeshInstance3D" parent="ResetPodium"]
mesh = SubResource("BoxMesh_goufh")
[node name="CollisionShape3D" type="CollisionShape3D" parent="ResetPodium"]
shape = SubResource("ConcavePolygonShape3D_bg05n")
[node name="ResetSwitch" parent="ResetPodium" instance=ExtResource("2_pka60")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35)
enabled = true
[node name="Label3D" type="Label3D" parent="ResetPodium"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9, 0.3)
text = "RESET"
[node name="NoduleSpawner" type="StaticBody3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.5, 1, -6)
[node name="MeshInstance3D" type="MeshInstance3D" parent="NoduleSpawner"]
mesh = SubResource("BoxMesh_goufh")
[node name="CollisionShape3D" type="CollisionShape3D" parent="NoduleSpawner"]
shape = SubResource("ConcavePolygonShape3D_bg05n")
[node name="SpawnSwitch" parent="NoduleSpawner" instance=ExtResource("2_pka60")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35)
enabled = true
[node name="Label3D" type="Label3D" parent="NoduleSpawner"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9, 0.3)
text = "Spawn"
[node name="NoduleSpawnPoint" type="Marker3D" parent="NoduleSpawner"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -3)
[node name="GunkHall" parent="." instance=ExtResource("4_2uiim")]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.5, 0, -31)
initial_mask = ExtResource("5_x2vho")
source_gunk_material = SubResource("ShaderMaterial_iyuyb")
[node name="MeshInstance3D" type="MeshInstance3D" parent="GunkHall"]
mesh = SubResource("ArrayMesh_x2vho")
[node name="CollisionShape3D" type="CollisionShape3D" parent="GunkHall"]
shape = SubResource("ConcavePolygonShape3D_qjnj2")
[node name="Bulkhead" parent="." instance=ExtResource("8_0j1ke")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.5, 0, -2)
[node name="Podium" type="StaticBody3D" parent="Bulkhead"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1, 0)
[node name="MeshInstance3D" type="MeshInstance3D" parent="Bulkhead/Podium"]
mesh = SubResource("BoxMesh_goufh")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Bulkhead/Podium"]
shape = SubResource("ConcavePolygonShape3D_bg05n")
[node name="OpenSwitch" parent="Bulkhead/Podium" instance=ExtResource("2_pka60")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35)
enabled = true
[node name="Podium2" type="StaticBody3D" parent="Bulkhead"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 1, 0)
[node name="MeshInstance3D" type="MeshInstance3D" parent="Bulkhead/Podium2"]
mesh = SubResource("BoxMesh_goufh")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Bulkhead/Podium2"]
shape = SubResource("ConcavePolygonShape3D_bg05n")
[node name="CloseSwitch" parent="Bulkhead/Podium2" instance=ExtResource("2_pka60")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35)
[connection signal="activated" from="ResetPodium/ResetSwitch" to="." method="reset"]
[connection signal="activated" from="NoduleSpawner/SpawnSwitch" to="." method="spawn_nodule"]
[connection signal="activated" from="Bulkhead/Podium/OpenSwitch" to="Bulkhead" method="open"]
[connection signal="activated" from="Bulkhead/Podium/OpenSwitch" to="Bulkhead/Podium/OpenSwitch" method="disable"]
[connection signal="activated" from="Bulkhead/Podium/OpenSwitch" to="Bulkhead/Podium2/CloseSwitch" method="enable"]
[connection signal="activated" from="Bulkhead/Podium2/CloseSwitch" to="Bulkhead" method="close"]
[connection signal="activated" from="Bulkhead/Podium2/CloseSwitch" to="Bulkhead/Podium/OpenSwitch" method="enable"]
[connection signal="activated" from="Bulkhead/Podium2/CloseSwitch" to="Bulkhead/Podium2/CloseSwitch" method="disable"]

View File

@ -11,6 +11,7 @@ config_version=5
[animation] [animation]
warnings/check_invalid_track_paths=false warnings/check_invalid_track_paths=false
warnings/threads/thread_model=2
[application] [application]

View File

@ -5,6 +5,31 @@
[ext_resource type="Texture2D" uid="uid://6vc3ye0jnqy4" path="res://assets/ui/hud/tools/toothbrush_idle.png" id="3_sxute"] [ext_resource type="Texture2D" uid="uid://6vc3ye0jnqy4" path="res://assets/ui/hud/tools/toothbrush_idle.png" id="3_sxute"]
[ext_resource type="Texture2D" uid="uid://djisqgfxhsrs2" path="res://assets/ui/hud/tools/toothbrush_used.png" id="4_atd0h"] [ext_resource type="Texture2D" uid="uid://djisqgfxhsrs2" path="res://assets/ui/hud/tools/toothbrush_used.png" id="4_atd0h"]
[sub_resource type="Animation" id="Animation_8x7qe"]
length = 0.001
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("HUDTool/NozzleMarker/HUDElement/Pivot/TextureUsed:position:x")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0, -0.2, 0, 0.2, 0),
"times": PackedFloat32Array(0)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("HUDTool/NozzleMarker/HUDElement/Pivot/TextureUsed:position:y")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0, -0.2, 0, 0.2, 0),
"times": PackedFloat32Array(0)
}
[sub_resource type="Animation" id="Animation_atd0h"] [sub_resource type="Animation" id="Animation_atd0h"]
resource_name = "brush" resource_name = "brush"
length = 0.6 length = 0.6
@ -32,31 +57,6 @@ tracks/1/keys = {
"times": PackedFloat32Array(0, 0.6) "times": PackedFloat32Array(0, 0.6)
} }
[sub_resource type="Animation" id="Animation_8x7qe"]
length = 0.001
tracks/0/type = "bezier"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("HUDTool/NozzleMarker/HUDElement/Pivot/TextureUsed:position:x")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0, -0.2, 0, 0.2, 0),
"times": PackedFloat32Array(0)
}
tracks/1/type = "bezier"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("HUDTool/NozzleMarker/HUDElement/Pivot/TextureUsed:position:y")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"handle_modes": PackedInt32Array(0),
"points": PackedFloat32Array(0, -0.2, 0, 0.2, 0),
"times": PackedFloat32Array(0)
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_8x7qe"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_8x7qe"]
_data = { _data = {
&"RESET": SubResource("Animation_8x7qe"), &"RESET": SubResource("Animation_8x7qe"),

View File

@ -7,3 +7,8 @@ extends Node3D
func open() -> void: func open() -> void:
animation.play("open") animation.play("open")
dust_animation.play("spray") dust_animation.play("spray")
func close() -> void:
# TODO bespoke close anim?
animation.play_backwards("open")

View File

@ -31,7 +31,7 @@ func enable() -> void:
## Called once the switch is no longer usable. Disables interaction & plays animations ## Called once the switch is no longer usable. Disables interaction & plays animations
func disable() -> void: func disable() -> void:
if enabled: if enabled:
light_animation.queue("disable") light_animation.play("disable")
enabled = false enabled = false
interactive.enabled = false interactive.enabled = false

File diff suppressed because one or more lines are too long

View File

@ -9,6 +9,8 @@ func _ready() -> void:
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
var camera := get_viewport().get_camera_3d() var camera := get_viewport().get_camera_3d()
if not camera:
return
var px_coord := camera.unproject_position(global_position) var px_coord := camera.unproject_position(global_position)
for c: Node in get_children(): for c: Node in get_children():
if c is Control: if c is Control: