diff --git a/levels/grunkbeast_test/grunkbeast_test.tscn b/levels/grunkbeast_test/grunkbeast_test.tscn index da6473e..4fea237 100644 --- a/levels/grunkbeast_test/grunkbeast_test.tscn +++ b/levels/grunkbeast_test/grunkbeast_test.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=11 format=3 uid="uid://cbxlfnlmgdvsq"] [ext_resource type="PackedScene" uid="uid://d2664rpg4losx" path="res://src/world/grunk_beast/grunk_beast.tscn" id="1_6yv42"] -[ext_resource type="Script" uid="uid://bukihqt1lybnx" path="res://levels/grunkbeast_test/frame_skipper.gd" id="1_eco5q"] +[ext_resource type="Script" uid="uid://bukihqt1lybnx" path="res://src/util/frame_skipper.gd" id="1_eco5q"] [ext_resource type="Script" uid="uid://cpt8dy0csa3eu" path="res://levels/grunkbeast_test/fixed_camera.gd" id="2_77sam"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_goufh"] diff --git a/levels/mechanic_test/mechanic_test.gd b/levels/mechanic_test/mechanic_test.gd index 0e74a53..d53bf4c 100644 --- a/levels/mechanic_test/mechanic_test.gd +++ b/levels/mechanic_test/mechanic_test.gd @@ -10,10 +10,12 @@ extends Node3D @onready var nodule_spawn_point: Marker3D = %NoduleSpawnPoint @onready var alarm_spawn_point: Marker3D = %AlarmSpawnPoint @onready var signal_test_spawn_point: Marker3D = %SignalTestSpawnPoint +@onready var prop_test_spawn_point: Marker3D = %PropTestSpawnPoint static var nodule_scene: PackedScene = load("res://src/world/gunk_node/grunk_nodule.tscn") static var alarm_scene: PackedScene = load("res://src/world/mechanics/alarm/gunk_alarm.tscn") static var signal_test_scene: PackedScene = load("res://levels/mechanic_test/signal_test.tscn") +static var prop_test_scene: PackedScene = load("res://levels/mechanic_test/prop_test.tscn") func reset() -> void: @@ -23,6 +25,7 @@ func reset() -> void: Callable(open_switch, "enable").call() Callable(close_switch, "disable").call() _do_spawn(signal_test_spawn_point, signal_test_scene) + _do_spawn(prop_test_spawn_point, prop_test_scene) func _do_spawn(spawn_point: Node3D, scene: PackedScene) -> void: @@ -41,6 +44,6 @@ func spawn_alarm() -> void: func trigger_spawned_alarm() -> void: - var alarm := alarm_spawn_point.get_child(0) + var alarm := alarm_spawn_point.get_child(0) as GunkAlarm if alarm: - Callable(alarm, "trigger").call() + alarm.trigger() diff --git a/levels/mechanic_test/mechanic_test.tscn b/levels/mechanic_test/mechanic_test.tscn index b965c96..a001279 100644 --- a/levels/mechanic_test/mechanic_test.tscn +++ b/levels/mechanic_test/mechanic_test.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=37 format=4 uid="uid://b8rv6dg4tgaeb"] +[gd_scene load_steps=30 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"] @@ -9,6 +9,7 @@ [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"] [ext_resource type="PackedScene" uid="uid://b5jubpjj3d277" path="res://levels/mechanic_test/signal_test.tscn" id="9_x2vho"] +[ext_resource type="PackedScene" uid="uid://cfqirm2o3uo4k" path="res://levels/mechanic_test/prop_test.tscn" id="10_f342o"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_goufh"] @@ -127,85 +128,6 @@ 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) -[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_x2vho"] -load_path = "res://.godot/imported/debug_mask.png-fd2bc783338ed9439fe81a4eef9d86da.s3tc.ctex" - -[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_f342o"] -width = 256 -height = 256 -depth = 32 -seamless = true -seamless_blend_skirt = 0.5 -noise = ExtResource("6_x2vho") - -[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_iyuyb"] -width = 256 -height = 256 -depth = 32 -seamless = true -seamless_blend_skirt = 0.5 -noise = ExtResource("6_x2vho") - -[sub_resource type="ShaderMaterial" id="ShaderMaterial_qjnj2"] -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_x2vho") -shader_parameter/gunk_noise = SubResource("NoiseTexture3D_f342o") -shader_parameter/gunk_normal_map = SubResource("NoiseTexture3D_iyuyb") -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="StandardMaterial3D" id="StandardMaterial3D_awnx0"] -albedo_color = Color(1, 0.403922, 1, 1) - -[sub_resource type="ArrayMesh" id="ArrayMesh_cgmn0"] -_surfaces = [{ -"aabb": AABB(-1, -1, -2.3, 2, 2, 2.4), -"format": 34896613377, -"index_count": 108, -"index_data": PackedByteArray("AAABAAIAAgADAAAAAAADAAQAAgAFAAMAAgABAAUAAwAGAAQAAwAFAAYABAAHAAAAAAAHAAEABAAGAAcABwAIAAEABgAIAAcACQAFAAEAAQAIAAkACgAIAAYABgAFAAoACwAJAAgACwAIAAwADAAIAAoADQAJAAsADQAFAAkADAANAAsADgAFAA0ADgANAAwACgAFAA8ADwAFAA4ACgAPABAADgAMABEADAAKABIAEgAKABAAEQAMABIAEAAPABMADwAOABMAEAATABIAEwAOABEAEgATABEA"), -"name": "Cube", -"primitive": 3, -"uv_scale": Vector4(0, 0, 0, 0), -"vertex_count": 20, -"vertex_data": PackedByteArray("AAD/////AAAAAJkZ//8AAAAA//+p6gAA/////6nqAAD///////8AAAAAmRmp6gAA//+ZGanqAAD//5kZ//8AAP//AAD//wAAAAAAAP//AAD//5kZVRUAAP//AAAAAAAA//+ZGQAAAAAAAAAAAAAAAAAAmRkAAAAAAACZGVUVAAD/////VRUAAAAA//8AAAAA/////wAAAAAAAP//VRUAAA==") -}] -blend_shape_mode = 0 - -[sub_resource type="ArrayMesh" id="ArrayMesh_aix42"] -_surfaces = [{ -"aabb": AABB(-1, -1, -2.3, 2, 2, 2.4), -"attribute_data": PackedByteArray("S0tKSw6PSktLS9JSDo/SUpWWSkuVlqWlDo+lpQ6PHZ5LSx2eS0ulpQAA//8AADu8S0v//0tLO7xLS3f4Do93+EtL//8Oj///lZb//w6PLK0Oj6WllZalpUtLpaVLSyyt4eGHB+HhS0uVlocHlZZLS+Hh0lKVltJSlZb//5WWpaXh4f//4eGlpZWWAADh4QAAlZaHB+HhhwdLSzu8AAA7vEtL8HAAAPBwlZZZWpWW0lLh4Vla4eHSUpWWHZ7h4R2e4eGlpZWWpaXh4R2elZYdnktL8HAAAPBwS0stLQAALS0="), -"format": 34896613399, -"index_count": 108, -"index_data": PackedByteArray("AAABAAIAAgABAAMABAADAAEABQADAAQABgADAAUABwADAAYABwAGAAgACAAGAAkACgALAAwADAALAA0ADgAPABAAEAAPABEADwASABEAEwASAA8AFAASABMAFQASABQAFAATABYAFgATABcAGAAZABoAGgAZABsAGQAcABsAGwAcAB0AHgAfACAAIAAfACEAIgAjACQAJAAjACUAJgAnACgAKAAnACkAKgArACwALAArAC0AKgAsAC4ALgAsAC8AMAAxADIAMgAxADMANAA1ADYANgA1ADcA"), -"material": SubResource("StandardMaterial3D_awnx0"), -"name": "Cube", -"primitive": 3, -"uv_scale": Vector4(0, 0, 0, 0), -"vertex_count": 56, -"vertex_data": PackedByteArray("AAD/////VNUAAJkZ//9U1QAA//+p6lTVAACZGanqVNUAAAAA//9U1QAAAAAAAFTVAACZGQAAVNUAAJkZVRVU1QAA//9VFVTVAAD//wAAVNUAAP//qer//wAAmRmp6v///////6nq/////5kZqer///////+p6lTV//+ZGanqVNX///////9U1f//mRn//1TV//8AAP//VNX//5kZVRVT1f//mRkAAFTV//8AAAAAVNX/////AABU1f////9VFVTV////////AID//5kZ//8AgAAA/////wCAAACZGf//AID//wAA//8AgAAAAAD//wCAAAAAAAAA/78AAAAA////v///AAAAAP+///8AAP///78AAP//qer/v/////+p6v+/AAD//////7//////////v///mRmp6v+/AACZGanq/7///5kZVRX/vwAAmRlVFf+/AACZGQAA//8AAAAAAAD/////mRkAAP////8AAAAA//8AAP//AAD///////8AAP///////1UV/78AAP//VRX/v/////8AAP+/AAD//wAA/7///5kZVRUAgAAAmRlVFQCA/////1UVAIAAAP//VRUAgFRVqqpUVaqqVFWqqlRVqapUVamqVFWpqlRVqqpUVaqqVFWqqlRVqqr///9/////f////3////9/qqpUVamqVFWqqlRVqqpUVamqVFWpqlNVqapUVaqqVFWqqlRVqqpUVf9/////f////3////9/////f////3///wAA/38AAP9/AAD/fwAA/3////9/////f////3////9/////f////3////9/////f////3////9/////f////3////9/////f////3////9/////f////3//f////3////9/////f///") -}] -blend_shape_mode = 0 -shadow_mesh = SubResource("ArrayMesh_cgmn0") - -[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_x2vho"] -data = PackedVector3Array(-1, 1, 0.1, -1, -0.8, 0.1, -1, 1, -0.1, -1, 1, -0.1, -1, -0.8, 0.1, -1, -0.8, -0.1, -1, -1, 0.1, -1, -0.8, -0.1, -1, -0.8, 0.1, -1, -1, -2.3, -1, -0.8, -0.1, -1, -1, 0.1, -1, -0.8, -2.3, -1, -0.8, -0.1, -1, -1, -2.3, -1, -0.8, -2.1, -1, -0.8, -0.1, -1, -0.8, -2.3, -1, -0.8, -2.1, -1, -0.8, -2.3, -1, 1, -2.1, -1, 1, -2.1, -1, -0.8, -2.3, -1, 1, -2.3, -1, 1, -0.1, -1, -0.8, -0.1, 1, 1, -0.1, 1, 1, -0.1, -1, -0.8, -0.1, 1, -0.8, -0.1, 1, 1, -0.1, 1, -0.8, -0.1, 1, 1, 0.1, 1, 1, 0.1, 1, -0.8, -0.1, 1, -0.8, 0.1, 1, -0.8, -0.1, 1, -1, 0.1, 1, -0.8, 0.1, 1, -0.8, -2.1, 1, -1, 0.1, 1, -0.8, -0.1, 1, -0.8, -2.3, 1, -1, 0.1, 1, -0.8, -2.1, 1, -1, -2.3, 1, -1, 0.1, 1, -0.8, -2.3, 1, -0.8, -2.3, 1, -0.8, -2.1, 1, 1, -2.3, 1, 1, -2.3, 1, -0.8, -2.1, 1, 1, -2.1, 1, 1, 0.1, 1, -0.8, 0.1, -1, 1, 0.1, -1, 1, 0.1, 1, -0.8, 0.1, -1, -0.8, 0.1, 1, -0.8, 0.1, 1, -1, 0.1, -1, -0.8, 0.1, -1, -0.8, 0.1, 1, -1, 0.1, -1, -1, 0.1, -1, -1, -2.3, -1, -1, 0.1, 1, -1, -2.3, 1, -1, -2.3, -1, -1, 0.1, 1, -1, 0.1, -1, 1, -0.1, 1, 1, -0.1, -1, 1, 0.1, -1, 1, 0.1, 1, 1, -0.1, 1, 1, 0.1, 1, -0.8, -0.1, -1, -0.8, -0.1, 1, -0.8, -2.1, 1, -0.8, -2.1, -1, -0.8, -0.1, -1, -0.8, -2.1, -1, -0.8, -2.3, -1, -1, -2.3, 1, -0.8, -2.3, 1, -0.8, -2.3, -1, -1, -2.3, 1, -1, -2.3, -1, -0.8, -2.3, 1, -0.8, -2.3, -1, 1, -2.3, -1, 1, -2.3, 1, -0.8, -2.3, 1, 1, -2.3, 1, 1, -2.1, -1, 1, -2.1, 1, 1, -2.3, 1, 1, -2.3, -1, 1, -2.1, -1, 1, -2.3, 1, -0.8, -2.1, -1, -0.8, -2.1, 1, 1, -2.1, 1, 1, -2.1, -1, -0.8, -2.1, -1, 1, -2.1) - [node name="MechanicTest" type="Node3D"] script = ExtResource("1_bg05n") @@ -363,20 +285,10 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.5, 0, -6) [node name="SignalTest" parent="SignalTestSpawnPoint" instance=ExtResource("9_x2vho")] [node name="PropTestSpawnPoint" type="Marker3D" parent="."] +unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.5, 0, 4.5) -[node name="PropTest" type="Node3D" parent="PropTestSpawnPoint"] - -[node name="Parallel" parent="PropTestSpawnPoint/PropTest" instance=ExtResource("4_2uiim")] -transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0, 1, 1.5) -mask_dim = 128 -source_gunk_material = SubResource("ShaderMaterial_qjnj2") - -[node name="MeshInstance3D" type="MeshInstance3D" parent="PropTestSpawnPoint/PropTest/Parallel"] -mesh = SubResource("ArrayMesh_aix42") - -[node name="CollisionShape3D" type="CollisionShape3D" parent="PropTestSpawnPoint/PropTest/Parallel"] -shape = SubResource("ConcavePolygonShape3D_x2vho") +[node name="PropTest" parent="PropTestSpawnPoint" instance=ExtResource("10_f342o")] [connection signal="activated" from="ResetPodium/ResetSwitch" to="." method="reset"] [connection signal="activated" from="NoduleSpawner/WallSwitch" to="." method="spawn_nodule"] diff --git a/levels/mechanic_test/prop_test.tscn b/levels/mechanic_test/prop_test.tscn new file mode 100644 index 0000000..d69c667 --- /dev/null +++ b/levels/mechanic_test/prop_test.tscn @@ -0,0 +1,97 @@ +[gd_scene load_steps=12 format=4 uid="uid://cfqirm2o3uo4k"] + +[ext_resource type="PackedScene" uid="uid://c2omlx4ptrc01" path="res://src/world/gunk_body/gunk_body.tscn" id="1_cr8wn"] +[ext_resource type="Shader" uid="uid://ckxc0ngd37rtk" path="res://src/shaders/gunk.gdshader" id="2_lrgpr"] +[ext_resource type="FastNoiseLite" uid="uid://cnlvdtx68giv6" path="res://assets/materials/gunk_noise.tres" id="3_7477u"] + +[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_x2vho"] +load_path = "res://.godot/imported/debug_mask.png-fd2bc783338ed9439fe81a4eef9d86da.s3tc.ctex" + +[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_f342o"] +width = 256 +height = 256 +depth = 32 +seamless = true +seamless_blend_skirt = 0.5 +noise = ExtResource("3_7477u") + +[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_iyuyb"] +width = 256 +height = 256 +depth = 32 +seamless = true +seamless_blend_skirt = 0.5 +noise = ExtResource("3_7477u") + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_qjnj2"] +resource_local_to_scene = true +render_priority = 0 +shader = ExtResource("2_lrgpr") +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_x2vho") +shader_parameter/gunk_noise = SubResource("NoiseTexture3D_f342o") +shader_parameter/gunk_normal_map = SubResource("NoiseTexture3D_iyuyb") +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="StandardMaterial3D" id="StandardMaterial3D_awnx0"] +albedo_color = Color(1, 0.403922, 1, 1) + +[sub_resource type="ArrayMesh" id="ArrayMesh_cgmn0"] +_surfaces = [{ +"aabb": AABB(-1, -1, -2.3, 2, 2, 2.4), +"format": 34896613377, +"index_count": 108, +"index_data": PackedByteArray("AAABAAIAAgADAAAAAAADAAQAAgAFAAMAAgABAAUAAwAGAAQAAwAFAAYABAAHAAAAAAAHAAEABAAGAAcABwAIAAEABgAIAAcACQAFAAEAAQAIAAkACgAIAAYABgAFAAoACwAJAAgACwAIAAwADAAIAAoADQAJAAsADQAFAAkADAANAAsADgAFAA0ADgANAAwACgAFAA8ADwAFAA4ACgAPABAADgAMABEADAAKABIAEgAKABAAEQAMABIAEAAPABMADwAOABMAEAATABIAEwAOABEAEgATABEA"), +"name": "Cube", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 20, +"vertex_data": PackedByteArray("AAD/////AAAAAJkZ//8AAAAA//+p6gAA/////6nqAAD///////8AAAAAmRmp6gAA//+ZGanqAAD//5kZ//8AAP//AAD//wAAAAAAAP//AAD//5kZVRUAAP//AAAAAAAA//+ZGQAAAAAAAAAAAAAAAAAAmRkAAAAAAACZGVUVAAD/////VRUAAAAA//8AAAAA/////wAAAAAAAP//VRUAAA==") +}] +blend_shape_mode = 0 + +[sub_resource type="ArrayMesh" id="ArrayMesh_aix42"] +_surfaces = [{ +"aabb": AABB(-1, -1, -2.3, 2, 2, 2.4), +"attribute_data": PackedByteArray("S0tKSw6PSktLS9JSDo/SUpWWSkuVlqWlDo+lpQ6PHZ5LSx2eS0ulpQAA//8AADu8S0v//0tLO7xLS3f4Do93+EtL//8Oj///lZb//w6PLK0Oj6WllZalpUtLpaVLSyyt4eGHB+HhS0uVlocHlZZLS+Hh0lKVltJSlZb//5WWpaXh4f//4eGlpZWWAADh4QAAlZaHB+HhhwdLSzu8AAA7vEtL8HAAAPBwlZZZWpWW0lLh4Vla4eHSUpWWHZ7h4R2e4eGlpZWWpaXh4R2elZYdnktL8HAAAPBwS0stLQAALS0="), +"format": 34896613399, +"index_count": 108, +"index_data": PackedByteArray("AAABAAIAAgABAAMABAADAAEABQADAAQABgADAAUABwADAAYABwAGAAgACAAGAAkACgALAAwADAALAA0ADgAPABAAEAAPABEADwASABEAEwASAA8AFAASABMAFQASABQAFAATABYAFgATABcAGAAZABoAGgAZABsAGQAcABsAGwAcAB0AHgAfACAAIAAfACEAIgAjACQAJAAjACUAJgAnACgAKAAnACkAKgArACwALAArAC0AKgAsAC4ALgAsAC8AMAAxADIAMgAxADMANAA1ADYANgA1ADcA"), +"material": SubResource("StandardMaterial3D_awnx0"), +"name": "Cube", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 56, +"vertex_data": PackedByteArray("AAD/////VNUAAJkZ//9U1QAA//+p6lTVAACZGanqVNUAAAAA//9U1QAAAAAAAFTVAACZGQAAVNUAAJkZVRVU1QAA//9VFVTVAAD//wAAVNUAAP//qer//wAAmRmp6v///////6nq/////5kZqer///////+p6lTV//+ZGanqVNX///////9U1f//mRn//1TV//8AAP//VNX//5kZVRVT1f//mRkAAFTV//8AAAAAVNX/////AABU1f////9VFVTV////////AID//5kZ//8AgAAA/////wCAAACZGf//AID//wAA//8AgAAAAAD//wCAAAAAAAAA/78AAAAA////v///AAAAAP+///8AAP///78AAP//qer/v/////+p6v+/AAD//////7//////////v///mRmp6v+/AACZGanq/7///5kZVRX/vwAAmRlVFf+/AACZGQAA//8AAAAAAAD/////mRkAAP////8AAAAA//8AAP//AAD///////8AAP///////1UV/78AAP//VRX/v/////8AAP+/AAD//wAA/7///5kZVRUAgAAAmRlVFQCA/////1UVAIAAAP//VRUAgFRVqqpUVaqqVFWqqlRVqapUVamqVFWpqlRVqqpUVaqqVFWqqlRVqqr///9/////f////3////9/qqpUVamqVFWqqlRVqqpUVamqVFWpqlNVqapUVaqqVFWqqlRVqqpUVf9/////f////3////9/////f////3///wAA/38AAP9/AAD/fwAA/3////9/////f////3////9/////f////3////9/////f////3////9/////f////3////9/////f////3////9/////f////3//f////3////9/////f///") +}] +blend_shape_mode = 0 +shadow_mesh = SubResource("ArrayMesh_cgmn0") + +[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_x2vho"] +data = PackedVector3Array(-1, 1, 0.1, -1, -0.8, 0.1, -1, 1, -0.1, -1, 1, -0.1, -1, -0.8, 0.1, -1, -0.8, -0.1, -1, -1, 0.1, -1, -0.8, -0.1, -1, -0.8, 0.1, -1, -1, -2.3, -1, -0.8, -0.1, -1, -1, 0.1, -1, -0.8, -2.3, -1, -0.8, -0.1, -1, -1, -2.3, -1, -0.8, -2.1, -1, -0.8, -0.1, -1, -0.8, -2.3, -1, -0.8, -2.1, -1, -0.8, -2.3, -1, 1, -2.1, -1, 1, -2.1, -1, -0.8, -2.3, -1, 1, -2.3, -1, 1, -0.1, -1, -0.8, -0.1, 1, 1, -0.1, 1, 1, -0.1, -1, -0.8, -0.1, 1, -0.8, -0.1, 1, 1, -0.1, 1, -0.8, -0.1, 1, 1, 0.1, 1, 1, 0.1, 1, -0.8, -0.1, 1, -0.8, 0.1, 1, -0.8, -0.1, 1, -1, 0.1, 1, -0.8, 0.1, 1, -0.8, -2.1, 1, -1, 0.1, 1, -0.8, -0.1, 1, -0.8, -2.3, 1, -1, 0.1, 1, -0.8, -2.1, 1, -1, -2.3, 1, -1, 0.1, 1, -0.8, -2.3, 1, -0.8, -2.3, 1, -0.8, -2.1, 1, 1, -2.3, 1, 1, -2.3, 1, -0.8, -2.1, 1, 1, -2.1, 1, 1, 0.1, 1, -0.8, 0.1, -1, 1, 0.1, -1, 1, 0.1, 1, -0.8, 0.1, -1, -0.8, 0.1, 1, -0.8, 0.1, 1, -1, 0.1, -1, -0.8, 0.1, -1, -0.8, 0.1, 1, -1, 0.1, -1, -1, 0.1, -1, -1, -2.3, -1, -1, 0.1, 1, -1, -2.3, 1, -1, -2.3, -1, -1, 0.1, 1, -1, 0.1, -1, 1, -0.1, 1, 1, -0.1, -1, 1, 0.1, -1, 1, 0.1, 1, 1, -0.1, 1, 1, 0.1, 1, -0.8, -0.1, -1, -0.8, -0.1, 1, -0.8, -2.1, 1, -0.8, -2.1, -1, -0.8, -0.1, -1, -0.8, -2.1, -1, -0.8, -2.3, -1, -1, -2.3, 1, -0.8, -2.3, 1, -0.8, -2.3, -1, -1, -2.3, 1, -1, -2.3, -1, -0.8, -2.3, 1, -0.8, -2.3, -1, 1, -2.3, -1, 1, -2.3, 1, -0.8, -2.3, 1, 1, -2.3, 1, 1, -2.1, -1, 1, -2.1, 1, 1, -2.3, 1, 1, -2.3, -1, 1, -2.1, -1, 1, -2.3, 1, -0.8, -2.1, -1, -0.8, -2.1, 1, 1, -2.1, 1, 1, -2.1, -1, -0.8, -2.1, -1, 1, -2.1) + +[node name="PropTest" type="Node3D"] + +[node name="Parallel" parent="." instance=ExtResource("1_cr8wn")] +transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0, 1, 1.5) +mask_dim = 128 +source_gunk_material = SubResource("ShaderMaterial_qjnj2") + +[node name="MeshInstance3D" type="MeshInstance3D" parent="Parallel"] +mesh = SubResource("ArrayMesh_aix42") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Parallel"] +shape = SubResource("ConcavePolygonShape3D_x2vho") diff --git a/levels/mechanic_test/signal_test.tscn b/levels/mechanic_test/signal_test.tscn index 33f5af0..f7aadce 100644 --- a/levels/mechanic_test/signal_test.tscn +++ b/levels/mechanic_test/signal_test.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=19 format=3 uid="uid://b5jubpjj3d277"] +[gd_scene load_steps=24 format=3 uid="uid://b5jubpjj3d277"] [ext_resource type="PackedScene" uid="uid://c2omlx4ptrc01" path="res://src/world/gunk_body/gunk_body.tscn" id="1_3u410"] [ext_resource type="Shader" uid="uid://ckxc0ngd37rtk" path="res://src/shaders/gunk.gdshader" id="2_tfbib"] @@ -10,6 +10,7 @@ [ext_resource type="PackedScene" uid="uid://dgqx1h4dtkwma" path="res://src/world/mechanics/trigger/gunk_trigger.tscn" id="8_gx82l"] [ext_resource type="PackedScene" uid="uid://bttust5ohud8e" path="res://src/world/mechanics/relay/gunk_relay.tscn" id="9_d4a3d"] [ext_resource type="PackedScene" uid="uid://dgeg3kkogm71m" path="res://src/world/mechanics/alarm/gunk_alarm.tscn" id="10_l8xa5"] +[ext_resource type="PackedScene" uid="uid://d0j20q65wnqsr" path="res://src/world/mechanics/heart/gunk_heart.tscn" id="11_tfbib"] [sub_resource type="CompressedTexture2D" id="CompressedTexture2D_f342o"] load_path = "res://.godot/imported/debug_mask.png-fd2bc783338ed9439fe81a4eef9d86da.s3tc.ctex" @@ -98,40 +99,149 @@ shadow_mesh = SubResource("ArrayMesh_ix0jw") [sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_x2vho"] data = PackedVector3Array(1.5, 0, 1.5, -1.5, 0, 1.5, 1.5, 0, -1.5, 1.5, 0, -1.5, -1.5, 0, 1.5, -1.5, 0, -1.5) +[sub_resource type="ShaderMaterial" id="ShaderMaterial_tfbib"] +resource_local_to_scene = true +render_priority = 0 +shader = ExtResource("2_tfbib") +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_f342o") +shader_parameter/gunk_noise = SubResource("NoiseTexture3D_iyuyb") +shader_parameter/gunk_normal_map = SubResource("NoiseTexture3D_qjnj2") +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="StandardMaterial3D" id="StandardMaterial3D_3u410"] +resource_local_to_scene = true +cull_mode = 2 +albedo_texture = ExtResource("4_r07l4") +metallic = 1.0 +metallic_texture = ExtResource("5_67o2j") +roughness_texture = ExtResource("7_c27im") +normal_enabled = true +normal_texture = ExtResource("6_4yjoq") +texture_filter = 4 + +[sub_resource type="ArrayMesh" id="ArrayMesh_tfbib"] +_surfaces = [{ +"aabb": AABB(-1.5, 0, -1.5, 3, 1e-05, 3), +"format": 34896613377, +"index_count": 6, +"index_data": PackedByteArray(0, 0, 1, 0, 2, 0, 2, 0, 1, 0, 3, 0), +"name": "Plane", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 4, +"vertex_data": PackedByteArray(255, 255, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) +}] +blend_shape_mode = 0 + +[sub_resource type="ArrayMesh" id="ArrayMesh_e8utx"] +_surfaces = [{ +"aabb": AABB(-1.5, 0, -1.5, 3, 1e-05, 3), +"attribute_data": PackedByteArray(255, 255, 255, 255, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 0, 0), +"format": 34896613399, +"index_count": 6, +"index_data": PackedByteArray(0, 0, 1, 0, 2, 0, 2, 0, 1, 0, 3, 0), +"material": SubResource("StandardMaterial3D_3u410"), +"name": "Plane", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 4, +"vertex_data": PackedByteArray(255, 255, 0, 0, 255, 255, 255, 191, 0, 0, 0, 0, 255, 255, 255, 191, 255, 255, 0, 0, 0, 0, 255, 191, 0, 0, 0, 0, 0, 0, 255, 191, 255, 255, 255, 127, 255, 255, 255, 127, 255, 255, 255, 127, 255, 255, 255, 127) +}] +blend_shape_mode = 0 +shadow_mesh = SubResource("ArrayMesh_tfbib") + [node name="SignalTest" type="Node3D"] -[node name="Wall" parent="." instance=ExtResource("1_3u410")] +[node name="TriggerNetWall" parent="." instance=ExtResource("1_3u410")] transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 1.5, 0) mask_dim = 64 source_gunk_material = SubResource("ShaderMaterial_awnx0") -[node name="MeshInstance3D" type="MeshInstance3D" parent="Wall"] +[node name="MeshInstance3D" type="MeshInstance3D" parent="TriggerNetWall"] mesh = SubResource("ArrayMesh_xrfi2") -[node name="CollisionShape3D" type="CollisionShape3D" parent="Wall"] +[node name="CollisionShape3D" type="CollisionShape3D" parent="TriggerNetWall"] shape = SubResource("ConcavePolygonShape3D_x2vho") -[node name="GunkTrigger" parent="." instance=ExtResource("8_gx82l")] -transform = Transform3D(1, 0, 0, 0, 0.707107, -0.707107, 0, 0.707107, 0.707107, -1, 1.5, 0) +[node name="GunkTrigger" parent="TriggerNetWall" instance=ExtResource("8_gx82l")] +transform = Transform3D(1, 0, 0, 0, 0.707107, 0.707107, 0, -0.707107, 0.707107, -1, 0, 0) -[node name="GunkRelay" parent="." instance=ExtResource("9_d4a3d")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.45, 2.1, 0) +[node name="GunkRelay" parent="TriggerNetWall" instance=ExtResource("9_d4a3d")] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -0.45, -2.62268e-08, -0.6) -[node name="GunkRelay2" parent="." instance=ExtResource("9_d4a3d")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.15, 1.75, 0) +[node name="GunkRelay2" parent="TriggerNetWall" instance=ExtResource("9_d4a3d")] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -0.15, -1.09278e-08, -0.25) -[node name="GunkRelay3" parent="." instance=ExtResource("9_d4a3d")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 1.95, 0) +[node name="GunkRelay3" parent="TriggerNetWall" instance=ExtResource("9_d4a3d")] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.2, -1.96701e-08, -0.45) -[node name="GunkRelay4" parent="." instance=ExtResource("9_d4a3d")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 1.45, 0) +[node name="GunkRelay4" parent="TriggerNetWall" instance=ExtResource("9_d4a3d")] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0.2, 2.18557e-09, 0.05) -[node name="GunkAlarm" parent="." instance=ExtResource("10_l8xa5")] -transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0.9, 1.75, 0) +[node name="GunkAlarm" parent="TriggerNetWall" instance=ExtResource("10_l8xa5")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.9, -1.09278e-08, -0.25) -[connection signal="destroyed" from="GunkTrigger" to="GunkRelay" method="trigger"] -[connection signal="triggered" from="GunkRelay" to="GunkRelay2" method="trigger"] -[connection signal="triggered" from="GunkRelay2" to="GunkRelay3" method="trigger"] -[connection signal="triggered" from="GunkRelay2" to="GunkRelay4" method="trigger"] -[connection signal="triggered" from="GunkRelay3" to="GunkAlarm" method="trigger"] -[connection signal="triggered" from="GunkRelay4" to="GunkAlarm" method="trigger"] +[node name="PulseNetWall" parent="." instance=ExtResource("1_3u410")] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 3.5, 1.5, 0) +mask_dim = 64 +source_gunk_material = SubResource("ShaderMaterial_tfbib") + +[node name="MeshInstance3D" type="MeshInstance3D" parent="PulseNetWall"] +mesh = SubResource("ArrayMesh_e8utx") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="PulseNetWall"] +shape = SubResource("ConcavePolygonShape3D_x2vho") + +[node name="GunkHeart" parent="PulseNetWall" instance=ExtResource("11_tfbib")] +transform = Transform3D(0.4, 0, 0, 0, 0.282843, -0.282843, 0, 0.282843, 0.282843, 0, 4.37114e-08, 1) + +[node name="GunkRelay" parent="PulseNetWall" instance=ExtResource("9_d4a3d")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.18557e-08, 0.5) + +[node name="GunkRelay2" parent="PulseNetWall" instance=ExtResource("9_d4a3d")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.3, 8.74228e-09, 0.2) + +[node name="GunkRelay3" parent="PulseNetWall" instance=ExtResource("9_d4a3d")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.3, 8.74228e-09, 0.2) + +[node name="GunkRelay4" parent="PulseNetWall" instance=ExtResource("9_d4a3d")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4.37114e-09, -0.1) + +[node name="GunkRelay5" parent="PulseNetWall" instance=ExtResource("9_d4a3d")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.3, -1.96701e-08, -0.45) + +[node name="GunkRelay6" parent="PulseNetWall" instance=ExtResource("9_d4a3d")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.3, -1.96701e-08, -0.45) + +[node name="GunkAlarm" parent="PulseNetWall" instance=ExtResource("10_l8xa5")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4.37114e-08, -1) + +[connection signal="destroyed" from="TriggerNetWall/GunkTrigger" to="TriggerNetWall/GunkRelay" method="trigger"] +[connection signal="triggered" from="TriggerNetWall/GunkRelay" to="TriggerNetWall/GunkRelay2" method="trigger"] +[connection signal="triggered" from="TriggerNetWall/GunkRelay2" to="TriggerNetWall/GunkRelay3" method="trigger"] +[connection signal="triggered" from="TriggerNetWall/GunkRelay2" to="TriggerNetWall/GunkRelay4" method="trigger"] +[connection signal="triggered" from="TriggerNetWall/GunkRelay3" to="TriggerNetWall/GunkAlarm" method="trigger"] +[connection signal="triggered" from="TriggerNetWall/GunkRelay4" to="TriggerNetWall/GunkAlarm" method="trigger"] +[connection signal="pulsed" from="PulseNetWall/GunkHeart" to="PulseNetWall/GunkRelay" method="pulse"] +[connection signal="pulsed" from="PulseNetWall/GunkRelay" to="PulseNetWall/GunkRelay2" method="pulse"] +[connection signal="pulsed" from="PulseNetWall/GunkRelay" to="PulseNetWall/GunkRelay3" method="pulse"] +[connection signal="pulsed" from="PulseNetWall/GunkRelay2" to="PulseNetWall/GunkRelay4" method="pulse"] +[connection signal="pulsed" from="PulseNetWall/GunkRelay3" to="PulseNetWall/GunkRelay4" method="pulse"] +[connection signal="pulsed" from="PulseNetWall/GunkRelay4" to="PulseNetWall/GunkRelay5" method="pulse"] +[connection signal="pulsed" from="PulseNetWall/GunkRelay4" to="PulseNetWall/GunkRelay6" method="pulse"] +[connection signal="pulsed" from="PulseNetWall/GunkRelay5" to="PulseNetWall/GunkAlarm" method="pulse"] +[connection signal="pulsed" from="PulseNetWall/GunkRelay6" to="PulseNetWall/GunkAlarm" method="pulse"] diff --git a/levels/grunkbeast_test/frame_skipper.gd b/src/util/frame_skipper.gd similarity index 100% rename from levels/grunkbeast_test/frame_skipper.gd rename to src/util/frame_skipper.gd diff --git a/levels/grunkbeast_test/frame_skipper.gd.uid b/src/util/frame_skipper.gd.uid similarity index 100% rename from levels/grunkbeast_test/frame_skipper.gd.uid rename to src/util/frame_skipper.gd.uid diff --git a/src/world/mechanics/alarm/gunk_alarm.gd b/src/world/mechanics/alarm/gunk_alarm.gd index ffd9df8..df52ade 100644 --- a/src/world/mechanics/alarm/gunk_alarm.gd +++ b/src/world/mechanics/alarm/gunk_alarm.gd @@ -1,12 +1,16 @@ -extends GunkNode +class_name GunkAlarm extends GunkNode ## Raises the grunk alert when triggered. const ALERT_DELTA := 1 +## Time to wait for a pulse signal before triggering. +@export var pulse_timeout := 6.0 + var _busy := false @onready var mesh_instance_3d: MeshInstance3D = %MeshInstance3D @onready var animation_player: AnimationPlayer = %AnimationPlayer +@onready var pulse_listener_timer: Timer = %PulseListenerTimer ## Trigger this alarm. @@ -19,6 +23,14 @@ func trigger() -> void: animation_player.play("trigger") +## Pulse this alarm, resetting the pulse countdown until triggering. +## +## Note that alarms will not begin the pulse countdown until receiving the first pulse. +## On networks without a heart, the pulse timeout will be completely ignored. +func pulse() -> void: + pulse_listener_timer.start(pulse_timeout) + + func _process(delta: float) -> void: super._process(delta) # TODO actual model & animation @@ -26,6 +38,8 @@ func _process(delta: float) -> void: var value := 1.0 - pct_damage() material.albedo_color = Color(value, value, value) + # TODO pulse animation + func _on_animation_finished(anim_name: StringName) -> void: if anim_name == "trigger": diff --git a/src/world/mechanics/alarm/gunk_alarm.tscn b/src/world/mechanics/alarm/gunk_alarm.tscn index e5ae548..871d77e 100644 --- a/src/world/mechanics/alarm/gunk_alarm.tscn +++ b/src/world/mechanics/alarm/gunk_alarm.tscn @@ -82,4 +82,9 @@ libraries = { &"": SubResource("AnimationLibrary_b6er8") } +[node name="PulseListenerTimer" type="Timer" parent="."] +unique_name_in_owner = true +one_shot = true + [connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_finished"] +[connection signal="timeout" from="PulseListenerTimer" to="." method="trigger"] diff --git a/src/world/mechanics/heart/gunk_heart.gd b/src/world/mechanics/heart/gunk_heart.gd new file mode 100644 index 0000000..70b34fa --- /dev/null +++ b/src/world/mechanics/heart/gunk_heart.gd @@ -0,0 +1,21 @@ +extends GunkNode +## Periodically emits a pulse. + +## Emitted at a regular interval. +signal pulsed + +## Time in seconds between pulses. +@export var interval := 3.0 + +@onready var pulse_timer: Timer = %PulseTimer +@onready var animation_player: AnimationPlayer = %AnimationPlayer + + +func _ready() -> void: + pulse_timer.start(interval) + + +func pulse() -> void: + # TODO animation + animation_player.play("pulse") + pulsed.emit() diff --git a/src/world/mechanics/heart/gunk_heart.gd.uid b/src/world/mechanics/heart/gunk_heart.gd.uid new file mode 100644 index 0000000..4d47dd5 --- /dev/null +++ b/src/world/mechanics/heart/gunk_heart.gd.uid @@ -0,0 +1 @@ +uid://d2k75cyykkk0s diff --git a/src/world/mechanics/heart/gunk_heart.tscn b/src/world/mechanics/heart/gunk_heart.tscn new file mode 100644 index 0000000..4ddf156 --- /dev/null +++ b/src/world/mechanics/heart/gunk_heart.tscn @@ -0,0 +1,137 @@ +[gd_scene load_steps=10 format=4 uid="uid://d0j20q65wnqsr"] + +[ext_resource type="Script" uid="uid://d2k75cyykkk0s" path="res://src/world/mechanics/heart/gunk_heart.gd" id="1_ftym0"] +[ext_resource type="Script" uid="uid://bukihqt1lybnx" path="res://src/util/frame_skipper.gd" id="2_xgyvt"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_xgyvt"] +albedo_color = Color(0, 0.0313726, 0.101961, 1) +emission_enabled = true +emission = Color(0.25098, 0.878431, 1, 1) +emission_energy_multiplier = 0.0 + +[sub_resource type="ArrayMesh" id="ArrayMesh_eu6st"] +_surfaces = [{ +"aabb": AABB(-0.894425, -1, -0.85064, 1.78885, 2, 1.70128), +"format": 34896613377, +"index_count": 60, +"index_data": PackedByteArray("AAABAAIAAgABAAMAAQAAAAQAAwABAAUABQABAAQABAAAAAYABQAEAAcABwAEAAYAAwAFAAgACAAFAAcAAgADAAkACQADAAgAAAACAAoACgACAAkABgAAAAoACAAHAAsABwAGAAsACQAIAAsABgAKAAsACgAJAAsA"), +"name": "Icosphere", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 12, +"vertex_data": PackedByteArray("jOfBRhrPAAD/fwAA/38AAHJYwUb//wAAAADBRv9/AACM58FG5DAAAHJYwUYAAAAA//89uf9/AACMpz25AAAAAHIYPbnkMAAAchg9uRrPAACMpz25//8AAP9/////fwAA") +}] +blend_shape_mode = 0 + +[sub_resource type="ArrayMesh" id="ArrayMesh_v3ru4"] +_surfaces = [{ +"aabb": AABB(-0.894425, -1, -0.85064, 1.78885, 2, 1.70128), +"attribute_data": PackedByteArray("0UWv14su//9FF6/XFl3//9FFr9dcdK/X//+v17no//9z0a/Xc9Gv1y26///ooq/X6KKv16KL//9cdK/XXHSv19FFr9cWXWCv0UWv10UXr9eLLmCv//+v13PRr9e56GCvc9Gv1+iir9ctumCv6KKv11x0r9eii2CvFl1gr9FFr9eLLmCviy5gr0UXr9cAAGCvuehgr3PRr9ctumCvLbpgr+iir9eii2Cvootgr1x0r9cWXWCvFl1gr4suYK/RRRGHiy5grwAAYK9FFxGHuehgry26YK9z0RGHLbpgr6KLYK/oohGHootgrxZdYK9cdBGH"), +"format": 34896613399, +"index_count": 60, +"index_data": PackedByteArray("AAABAAIAAwAEAAUABgAHAAgACQAKAAsADAANAA4ADwAQABEAEgATABQAFQAWABcAGAAZABoAGwAcAB0AHgAfACAAIQAiACMAJAAlACYAJwAoACkAKgArACwALQAuAC8AMAAxADIAMwA0ADUANgA3ADgAOQA6ADsA"), +"material": SubResource("StandardMaterial3D_xgyvt"), +"name": "Icosphere", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 60, +"vertex_data": PackedByteArray("jOfBRhrPZaf/fwAA/39lp3JYwUb//2Wn/38AAP9/DciM58FGGs8NyIznwUbkMA3IcljBRv//nLT/fwAA/3+ctAAAwUb/f5y0AADBRv9/2N3/fwAA/3/Y3XJYwUYAANjdcljBRgAAiPT/fwAA/3+I9IznwUbkMIj0jOfBRuQwW8CM58FGGs9bwP//Pbn/f1vAjOfBRhrP6Y5yWMFG///pjoynPbn//+mOcljBRv//GacAAMFG/38Zp3IYPbkazxmnAADBRv9/yNlyWMFGAADI2XIYPbnkMMjZcljBRgAAQfOM58FG5DBB84ynPbkAAEHz//89uf9/GaeM58FGGs8Zp4ynPbn//xmnjKc9uf//6Y5yWMFG///pjnIYPbkaz+mOchg9uRrPW8AAAMFG/39bwHIYPbnkMFvAchg9ueQwQfNyWMFGAABB84ynPbkAAEHzjKc9uQAAyNmM58FG5DDI2f//Pbn/f8jZ//89uf9/nLSMpz25//+ctP9/////f5y0jKc9uf//ZadyGD25Gs9lp/9/////f2Wnchg9uRrPDchyGD255DANyP9/////fw3Ichg9ueQwiPSMpz25AACI9P9/////f4j0jKc9uQAA2N3//z25/3/Y3f9/////f9jdbylFZG8pRWRvKUVkLWCkPy1gpD8tYKQ/7DOZzewzmc3sM5nNSkmH7UpJh+1KSYftn3mdLp95nS6feZ0uz3VfFM91XxTPdV8UzFJcNMxSXDTMUlw092Nt7fdjbe33Y23t/2+Y+v9vmPr/b5j6RH6lDER+pQxEfqUMB5yREgeckRIHnJESMq2iyzKtossyraLLL4qf6y+Kn+svip/ruoFZ87qBWfO6gVnz/49mBf+PZgX/j2YFEsxlMhLMZTISzGUyj9a5m4/WuZuP1rmb0Z9awNGfWsDRn1rAX4Zh0V+GYdFfhmHRtLZ3ErS2dxK0tncS") +}] +blend_shape_mode = 0 +shadow_mesh = SubResource("ArrayMesh_eu6st") + +[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_ftym0"] +data = PackedVector3Array(0.7236, -0.4472, 0.5257, 0, -1, 0, -0.2764, -0.4472, 0.8506, 0, -1, 0, 0.7236, -0.4472, 0.5257, 0.7236, -0.4472, -0.5257, -0.2764, -0.4472, 0.8506, 0, -1, 0, -0.8944, -0.4472, 0, -0.8944, -0.4472, 0, 0, -1, 0, -0.2764, -0.4472, -0.8506, -0.2764, -0.4472, -0.8506, 0, -1, 0, 0.7236, -0.4472, -0.5257, 0.7236, -0.4472, -0.5257, 0.7236, -0.4472, 0.5257, 0.8944, 0.4472, 0, 0.7236, -0.4472, 0.5257, -0.2764, -0.4472, 0.8506, 0.2764, 0.4472, 0.8506, -0.2764, -0.4472, 0.8506, -0.8944, -0.4472, 0, -0.7236, 0.4472, 0.5257, -0.8944, -0.4472, 0, -0.2764, -0.4472, -0.8506, -0.7236, 0.4472, -0.5257, -0.2764, -0.4472, -0.8506, 0.7236, -0.4472, -0.5257, 0.2764, 0.4472, -0.8506, 0.8944, 0.4472, 0, 0.7236, -0.4472, 0.5257, 0.2764, 0.4472, 0.8506, 0.2764, 0.4472, 0.8506, -0.2764, -0.4472, 0.8506, -0.7236, 0.4472, 0.5257, -0.7236, 0.4472, 0.5257, -0.8944, -0.4472, 0, -0.7236, 0.4472, -0.5257, -0.7236, 0.4472, -0.5257, -0.2764, -0.4472, -0.8506, 0.2764, 0.4472, -0.8506, 0.2764, 0.4472, -0.8506, 0.7236, -0.4472, -0.5257, 0.8944, 0.4472, 0, 0.8944, 0.4472, 0, 0.2764, 0.4472, 0.8506, 0, 1, 0, 0.2764, 0.4472, 0.8506, -0.7236, 0.4472, 0.5257, 0, 1, 0, -0.7236, 0.4472, 0.5257, -0.7236, 0.4472, -0.5257, 0, 1, 0, -0.7236, 0.4472, -0.5257, 0.2764, 0.4472, -0.8506, 0, 1, 0, 0.2764, 0.4472, -0.8506, 0.8944, 0.4472, 0, 0, 1, 0) + +[sub_resource type="Animation" id="Animation_eu6st"] +resource_name = "pulse" +step = 0.1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("MeshInstance3D:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6), +"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1), +"update": 0, +"values": [Vector3(1, 1, 1), Vector3(1.05, 1.05, 1.05), Vector3(0.95, 0.95, 0.95), Vector3(1.15, 1.15, 1.15), Vector3(0.9, 0.9, 0.9), Vector3(1.025, 1.025, 1.025), Vector3(1, 1, 1)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("MeshInstance3D:mesh:surface_0/material:emission_energy_multiplier") +tracks/1/interp = 2 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.3, 1), +"transitions": PackedFloat32Array(1.618, 1.618, 1), +"update": 0, +"values": [0.0, 2.0, 0.0] +} + +[sub_resource type="Animation" id="Animation_v3ru4"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("MeshInstance3D:scale") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector3(1, 1, 1)] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("MeshInstance3D:mesh:surface_0/material:emission_energy_multiplier") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [0.0] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_kv3oi"] +_data = { +&"RESET": SubResource("Animation_v3ru4"), +&"pulse": SubResource("Animation_eu6st") +} + +[node name="GunkHeart" type="StaticBody3D"] +collision_layer = 5 +collision_mask = 0 +script = ExtResource("1_ftym0") +durability = 3.0 +value = 4000.0 +metadata/_custom_type_script = "uid://bypgxi0gy56yk" + +[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +mesh = SubResource("ArrayMesh_v3ru4") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="."] +shape = SubResource("ConcavePolygonShape3D_ftym0") + +[node name="PulseTimer" type="Timer" parent="."] +unique_name_in_owner = true + +[node name="FrameSkipper" type="Node" parent="."] +script = ExtResource("2_xgyvt") +frame_skip = 3 +metadata/_custom_type_script = "uid://bukihqt1lybnx" + +[node name="AnimationPlayer" type="AnimationPlayer" parent="FrameSkipper"] +unique_name_in_owner = true +root_node = NodePath("../..") +libraries = { +&"": SubResource("AnimationLibrary_kv3oi") +} +speed_scale = 4.0 + +[connection signal="timeout" from="PulseTimer" to="." method="pulse"] diff --git a/src/world/mechanics/relay/gunk_relay.gd b/src/world/mechanics/relay/gunk_relay.gd index 3b838e9..1269f35 100644 --- a/src/world/mechanics/relay/gunk_relay.gd +++ b/src/world/mechanics/relay/gunk_relay.gd @@ -4,17 +4,59 @@ class_name GunkRelay extends GunkNode ## Emitted when `trigger` is called, after a short delay. signal triggered +## Emitted when `pulse` is called, after a short delay. +signal pulsed + +var _busy := false + @onready var animation_player: AnimationPlayer = %AnimationPlayer -@onready var rebroadcast_delay: Timer = %RebroadcastDelay +@onready var trigger_delay: Timer = %TriggerDelay +@onready var pulse_delay: Timer = %PulseDelay ## Trigger this relay. ## ## This will emit the `triggered` signal after a delay. func trigger() -> void: - animation_player.play("trigger") - rebroadcast_delay.start() + if not _busy: + _busy = true + animation_player.play("trigger") + trigger_delay.start() -func _on_rebroadcast_delay_timeout() -> void: +## Send a pulse through this relay. +## +## This will emit the `pulse` signal after a delay. +func pulse() -> void: + if not _busy: + _busy = true + animation_player.play("pulse") + pulse_delay.start() + + +func _on_trigger_delay_timeout() -> void: triggered.emit() + _busy = false + + +func _on_pulse_delay_timeout() -> void: + pulsed.emit() + _busy = false + + +## Find a path to a target node through a GunkRelay network. +static func find_path( + current: GunkRelay, target: GunkNode, visited: Array[GunkNode] = [] +) -> Array[GunkNode]: + # Depth-first search + for connection: Callable in current.triggered.get_connections(): + var neighbor := connection.get_object() as GunkNode + if neighbor and not neighbor in visited: + if neighbor == target: + return [current, neighbor] + var relay := neighbor as GunkRelay + if relay: + var path := find_path(relay, target, visited + [current]) + if path: + return [current] + path + return [] diff --git a/src/world/mechanics/relay/gunk_relay.tscn b/src/world/mechanics/relay/gunk_relay.tscn index 12c6bf5..7bb5397 100644 --- a/src/world/mechanics/relay/gunk_relay.tscn +++ b/src/world/mechanics/relay/gunk_relay.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=8 format=3 uid="uid://bttust5ohud8e"] +[gd_scene load_steps=10 format=3 uid="uid://bttust5ohud8e"] [ext_resource type="Script" uid="uid://1oup50bp0pwd" path="res://src/world/mechanics/relay/gunk_relay.gd" id="1_rdv5j"] +[ext_resource type="Script" uid="uid://bukihqt1lybnx" path="res://src/util/frame_skipper.gd" id="2_ipm58"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_gk1l0"] resource_local_to_scene = true +albedo_color = Color(0, 0.0313726, 0.101961, 1) emission_enabled = true emission = Color(1, 0, 0, 1) emission_energy_multiplier = 0.0 @@ -31,6 +33,18 @@ tracks/0/keys = { "update": 0, "values": [0.0] } +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("MeshInstance3D:mesh:material:emission") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 0, 0, 1)] +} [sub_resource type="Animation" id="Animation_rdv5j"] resource_name = "trigger" @@ -46,10 +60,51 @@ tracks/0/keys = { "update": 0, "values": [0.0, 2.0, 0.0] } +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("MeshInstance3D:mesh:material:emission") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(1, 0, 0, 1)] +} + +[sub_resource type="Animation" id="Animation_nfkbq"] +resource_name = "pulse" +step = 0.1 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("MeshInstance3D:mesh:material:emission_energy_multiplier") +tracks/0/interp = 2 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 0.166667, 1), +"transitions": PackedFloat32Array(1, 1, 1), +"update": 0, +"values": [0.0, 2.0, 0.0] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("MeshInstance3D:mesh:material:emission") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Color(0.25098, 0.878431, 1, 1)] +} [sub_resource type="AnimationLibrary" id="AnimationLibrary_ipm58"] _data = { &"RESET": SubResource("Animation_ipm58"), +&"pulse": SubResource("Animation_nfkbq"), &"trigger": SubResource("Animation_rdv5j") } @@ -65,15 +120,28 @@ mesh = SubResource("SphereMesh_hsruj") [node name="CollisionShape3D" type="CollisionShape3D" parent="."] shape = SubResource("SphereShape3D_gk1l0") -[node name="AnimationPlayer" type="AnimationPlayer" parent="."] -unique_name_in_owner = true -libraries = { -&"": SubResource("AnimationLibrary_ipm58") -} - -[node name="RebroadcastDelay" type="Timer" parent="."] +[node name="TriggerDelay" type="Timer" parent="."] unique_name_in_owner = true wait_time = 0.2 one_shot = true -[connection signal="timeout" from="RebroadcastDelay" to="." method="_on_rebroadcast_delay_timeout"] +[node name="PulseDelay" type="Timer" parent="."] +unique_name_in_owner = true +wait_time = 0.4 +one_shot = true + +[node name="FrameSkipper" type="Node" parent="."] +script = ExtResource("2_ipm58") +frame_skip = 3 +metadata/_custom_type_script = "uid://bukihqt1lybnx" + +[node name="AnimationPlayer" type="AnimationPlayer" parent="FrameSkipper"] +unique_name_in_owner = true +root_node = NodePath("../..") +libraries = { +&"": SubResource("AnimationLibrary_ipm58") +} +speed_scale = 4.0 + +[connection signal="timeout" from="TriggerDelay" to="." method="_on_trigger_delay_timeout"] +[connection signal="timeout" from="PulseDelay" to="." method="_on_pulse_delay_timeout"] diff --git a/src/world/mechanics/trigger/gunk_trigger.tscn b/src/world/mechanics/trigger/gunk_trigger.tscn index f2bfbd5..9b53e2d 100644 --- a/src/world/mechanics/trigger/gunk_trigger.tscn +++ b/src/world/mechanics/trigger/gunk_trigger.tscn @@ -45,7 +45,8 @@ data = PackedVector3Array(0.7236, -0.4472, 0.5257, 0, -1, 0, -0.2764, -0.4472, 0 collision_layer = 5 collision_mask = 0 script = ExtResource("1_t1c4j") -durability = 0.1 +durability = 3.0 +value = 4000.0 metadata/_custom_type_script = "uid://bypgxi0gy56yk" [node name="MeshInstance3D" type="MeshInstance3D" parent="."] diff --git a/src/world/mechanics/watchdog/gunk_watchdog.gd b/src/world/mechanics/watchdog/gunk_watchdog.gd deleted file mode 100644 index 2379854..0000000 --- a/src/world/mechanics/watchdog/gunk_watchdog.gd +++ /dev/null @@ -1,23 +0,0 @@ -extends GunkNode -## Triggers an alarm when connection to a target is lost. - -const TRIGGER_SIGNAL := "trigger" - -@export var entry_point: GunkRelay -@export var target: GunkNode - - -static func _build_path(current: GunkRelay, target: GunkNode) -> Array[GunkNode]: - for connection: Callable in current.triggered.get_connections(): - var next_node := connection.get_object() as GunkNode - if next_node: - if next_node == target: - return [current, next_node] - var relay := next_node as GunkRelay - if relay: - var ret: Array[GunkNode] = [current] - # XXX - ret.append_array(_build_path(relay, target)) - return ret - - return [] diff --git a/src/world/mechanics/watchdog/gunk_watchdog.gd.uid b/src/world/mechanics/watchdog/gunk_watchdog.gd.uid deleted file mode 100644 index 0e05f78..0000000 --- a/src/world/mechanics/watchdog/gunk_watchdog.gd.uid +++ /dev/null @@ -1 +0,0 @@ -uid://uw4lx3ohj6s4 diff --git a/src/world/mechanics/watchdog/gunk_watchdog.tscn b/src/world/mechanics/watchdog/gunk_watchdog.tscn deleted file mode 100644 index 1a6cb56..0000000 --- a/src/world/mechanics/watchdog/gunk_watchdog.tscn +++ /dev/null @@ -1,20 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://baavay05afcj8"] - -[ext_resource type="Script" uid="uid://uw4lx3ohj6s4" path="res://src/world/mechanics/watchdog/gunk_watchdog.gd" id="1_hr1mr"] - -[sub_resource type="SphereMesh" id="SphereMesh_hr1mr"] -radius = 0.25 -height = 0.5 - -[sub_resource type="SphereShape3D" id="SphereShape3D_lvqm8"] -radius = 0.25 - -[node name="GunkWatchdog" type="StaticBody3D"] -script = ExtResource("1_hr1mr") -metadata/_custom_type_script = "uid://bypgxi0gy56yk" - -[node name="MeshInstance3D" type="MeshInstance3D" parent="."] -mesh = SubResource("SphereMesh_hr1mr") - -[node name="CollisionShape3D" type="CollisionShape3D" parent="."] -shape = SubResource("SphereShape3D_lvqm8")