Heartbeat puzzle 1 in medbay

This commit is contained in:
Rob Kelly 2025-04-19 22:55:11 -06:00
parent 42ec80f098
commit e44bed8bff
8 changed files with 663 additions and 42 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,31 @@
@tool
extends GunkNode extends GunkNode
const BASE_DURABILITY := 3.0
const BASE_VALUE := 2000.0
const MIN_CHITTER_INTERVAL := 4.0 const MIN_CHITTER_INTERVAL := 4.0
@export_category("Editor Tools")
@export var randomize_rotation: bool:
set(v):
rotation = Vector3(randf_range(0, TAU), randf_range(0, TAU), randf_range(0, TAU))
@export var apply_scale: float:
set(v):
if v > 0.001:
scale = Vector3(v, v, v)
durability = BASE_DURABILITY * v
value = BASE_VALUE * v
@export_category("Jitter")
@export var jitter_scale_factor := 0.05 @export var jitter_scale_factor := 0.05
@export var jitter_inflation_factor := 1.0 @export var jitter_inflation_factor := 1.0
@export_category("Chatter")
@export var chitter: bool = false @export var chitter: bool = false
@export var chitter_time_mean := 60.0 @export var chitter_time_mean := 60.0
@export var chitter_time_st_dev := 30.0 @export var chitter_time_st_dev := 30.0
@export_category("Game Scenes")
@export var splatter_scene: PackedScene @export var splatter_scene: PackedScene
@onready var mesh_instance: MeshInstance3D = %MeshInstance3D @onready var mesh_instance: MeshInstance3D = %MeshInstance3D
@ -18,11 +35,17 @@ const MIN_CHITTER_INTERVAL := 4.0
func _ready() -> void: func _ready() -> void:
if Engine.is_editor_hint():
return
if chitter: if chitter:
start_chitter_timer() start_chitter_timer()
func _process(delta: float) -> void: func _process(delta: float) -> void:
if Engine.is_editor_hint():
return
super._process(delta) super._process(delta)
var shader: ShaderMaterial = mesh_instance.mesh.surface_get_material(0) var shader: ShaderMaterial = mesh_instance.mesh.surface_get_material(0)
var damage := pct_damage() var damage := pct_damage()

View File

@ -1,16 +1,16 @@
[gd_scene load_steps=31 format=4 uid="uid://b8rv6dg4tgaeb"] [gd_scene load_steps=31 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="Script" uid="uid://bvua1l2hb3an6" path="res://levels/mechanic_test/mechanic_test.gd" id="1_umjw2"]
[ext_resource type="PackedScene" uid="uid://bwe2jdmvinhqd" path="res://src/player/player.tscn" id="1_goufh"] [ext_resource type="PackedScene" uid="uid://bwe2jdmvinhqd" path="res://src/player/player.tscn" id="2_gut8u"]
[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://b6eg8t04rkh0c" path="res://src/props/wall_switch/wall_switch.tscn" id="3_4okgx"]
[ext_resource type="PackedScene" uid="uid://c2omlx4ptrc01" path="res://src/world/gunk_body/gunk_body.tscn" id="4_2uiim"] [ext_resource type="PackedScene" uid="uid://c2omlx4ptrc01" path="res://src/world/gunk_body/gunk_body.tscn" id="4_7v7un"]
[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_llot1"]
[ext_resource type="Texture2D" uid="uid://8cm835h4gxwe" path="res://assets/debug_mask.png" id="5_x2vho"] [ext_resource type="Shader" uid="uid://ckxc0ngd37rtk" path="res://src/shaders/gunk.gdshader" id="6_6agnv"]
[ext_resource type="FastNoiseLite" uid="uid://cnlvdtx68giv6" path="res://assets/materials/gunk_noise.tres" id="6_x2vho"] [ext_resource type="FastNoiseLite" uid="uid://cnlvdtx68giv6" path="res://assets/materials/gunk_noise.tres" id="7_aqwgb"]
[ext_resource type="PackedScene" uid="uid://cubwniraol1qn" path="res://src/props/bulkhead/bulkhead.tscn" id="8_f342o"] [ext_resource type="PackedScene" uid="uid://cubwniraol1qn" path="res://src/props/bulkhead/bulkhead.tscn" id="8_ny31q"]
[ext_resource type="PackedScene" uid="uid://b5jubpjj3d277" path="res://levels/mechanic_test/signal_test.tscn" id="9_x2vho"] [ext_resource type="PackedScene" uid="uid://b5jubpjj3d277" path="res://levels/mechanic_test/signal_test.tscn" id="9_dub8r"]
[ext_resource type="PackedScene" uid="uid://cfqirm2o3uo4k" path="res://levels/mechanic_test/prop_test.tscn" id="10_f342o"] [ext_resource type="PackedScene" uid="uid://cfqirm2o3uo4k" path="res://levels/mechanic_test/prop_test.tscn" id="10_ovu60"]
[ext_resource type="PackedScene" uid="uid://dbabcsp38wmid" path="res://levels/mechanic_test/item_test.tscn" id="11_iyuyb"] [ext_resource type="PackedScene" uid="uid://dbabcsp38wmid" path="res://levels/mechanic_test/item_test.tscn" id="11_crh2u"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_goufh"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_goufh"]
@ -93,7 +93,7 @@ height = 256
depth = 32 depth = 32
seamless = true seamless = true
seamless_blend_skirt = 0.5 seamless_blend_skirt = 0.5
noise = ExtResource("6_x2vho") noise = ExtResource("7_aqwgb")
[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_2pd8h"] [sub_resource type="NoiseTexture3D" id="NoiseTexture3D_2pd8h"]
width = 256 width = 256
@ -101,12 +101,12 @@ height = 256
depth = 32 depth = 32
seamless = true seamless = true
seamless_blend_skirt = 0.5 seamless_blend_skirt = 0.5
noise = ExtResource("6_x2vho") noise = ExtResource("7_aqwgb")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_iyuyb"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_qmfft"]
resource_local_to_scene = true resource_local_to_scene = true
render_priority = 0 render_priority = 0
shader = ExtResource("5_0j1ke") shader = ExtResource("6_6agnv")
shader_parameter/color_1 = Color(0, 0.03, 0.1, 1) shader_parameter/color_1 = Color(0, 0.03, 0.1, 1)
shader_parameter/color_2 = Color(0, 0.1, 0.3, 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/emission_color = Color(0.25, 0.88, 1, 1)
@ -131,9 +131,9 @@ shader_parameter/overlay_emission_scale = 1.0
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) 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"] [node name="MechanicTest" type="Node3D"]
script = ExtResource("1_bg05n") script = ExtResource("1_umjw2")
[node name="Player" parent="." instance=ExtResource("1_goufh")] [node name="Player" parent="." instance=ExtResource("2_gut8u")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.65, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.65, 0)
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
@ -160,7 +160,7 @@ mesh = SubResource("BoxMesh_goufh")
[node name="CollisionShape3D" type="CollisionShape3D" parent="ResetPodium"] [node name="CollisionShape3D" type="CollisionShape3D" parent="ResetPodium"]
shape = SubResource("ConcavePolygonShape3D_bg05n") shape = SubResource("ConcavePolygonShape3D_bg05n")
[node name="ResetSwitch" parent="ResetPodium" instance=ExtResource("2_pka60")] [node name="ResetSwitch" parent="ResetPodium" instance=ExtResource("3_4okgx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35)
clean = true clean = true
@ -177,7 +177,7 @@ mesh = SubResource("BoxMesh_goufh")
[node name="CollisionShape3D" type="CollisionShape3D" parent="NoduleSpawner"] [node name="CollisionShape3D" type="CollisionShape3D" parent="NoduleSpawner"]
shape = SubResource("ConcavePolygonShape3D_bg05n") shape = SubResource("ConcavePolygonShape3D_bg05n")
[node name="WallSwitch" parent="NoduleSpawner" instance=ExtResource("2_pka60")] [node name="WallSwitch" parent="NoduleSpawner" instance=ExtResource("3_4okgx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35)
clean = true clean = true
@ -199,7 +199,7 @@ mesh = SubResource("BoxMesh_goufh")
[node name="CollisionShape3D" type="CollisionShape3D" parent="AlarmSpawner"] [node name="CollisionShape3D" type="CollisionShape3D" parent="AlarmSpawner"]
shape = SubResource("ConcavePolygonShape3D_bg05n") shape = SubResource("ConcavePolygonShape3D_bg05n")
[node name="WallSwitch" parent="AlarmSpawner" instance=ExtResource("2_pka60")] [node name="WallSwitch" parent="AlarmSpawner" instance=ExtResource("3_4okgx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35)
clean = true clean = true
@ -221,7 +221,7 @@ mesh = SubResource("BoxMesh_goufh")
[node name="CollisionShape3D" type="CollisionShape3D" parent="AlarmTrigger"] [node name="CollisionShape3D" type="CollisionShape3D" parent="AlarmTrigger"]
shape = SubResource("ConcavePolygonShape3D_bg05n") shape = SubResource("ConcavePolygonShape3D_bg05n")
[node name="AlarmTriggerSwitch" parent="AlarmTrigger" instance=ExtResource("2_pka60")] [node name="AlarmTriggerSwitch" parent="AlarmTrigger" instance=ExtResource("3_4okgx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35)
clean = true clean = true
@ -234,15 +234,15 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.5, 0, -31)
mesh = SubResource("ArrayMesh_x2vho") mesh = SubResource("ArrayMesh_x2vho")
skeleton = NodePath("GunkHallBody") skeleton = NodePath("GunkHallBody")
[node name="GunkHallBody" parent="GunkHall" instance=ExtResource("4_2uiim")] [node name="GunkHallBody" parent="GunkHall" instance=ExtResource("4_7v7un")]
unique_name_in_owner = true unique_name_in_owner = true
initial_mask = ExtResource("5_x2vho") initial_mask = ExtResource("5_llot1")
source_gunk_material = SubResource("ShaderMaterial_iyuyb") source_gunk_material = SubResource("ShaderMaterial_qmfft")
[node name="CollisionShape3D" type="CollisionShape3D" parent="GunkHall/GunkHallBody"] [node name="CollisionShape3D" type="CollisionShape3D" parent="GunkHall/GunkHallBody"]
shape = SubResource("ConcavePolygonShape3D_qjnj2") shape = SubResource("ConcavePolygonShape3D_qjnj2")
[node name="Bulkhead" parent="." instance=ExtResource("8_f342o")] [node name="Bulkhead" parent="." instance=ExtResource("8_ny31q")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.5, 0, -2) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.5, 0, -2)
[node name="Podium" type="StaticBody3D" parent="Bulkhead"] [node name="Podium" type="StaticBody3D" parent="Bulkhead"]
@ -254,7 +254,7 @@ mesh = SubResource("BoxMesh_goufh")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Bulkhead/Podium"] [node name="CollisionShape3D" type="CollisionShape3D" parent="Bulkhead/Podium"]
shape = SubResource("ConcavePolygonShape3D_bg05n") shape = SubResource("ConcavePolygonShape3D_bg05n")
[node name="OpenSwitch" parent="Bulkhead/Podium" instance=ExtResource("2_pka60")] [node name="OpenSwitch" parent="Bulkhead/Podium" instance=ExtResource("3_4okgx")]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35)
clean = true clean = true
@ -272,7 +272,7 @@ mesh = SubResource("BoxMesh_goufh")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Bulkhead/Podium2"] [node name="CollisionShape3D" type="CollisionShape3D" parent="Bulkhead/Podium2"]
shape = SubResource("ConcavePolygonShape3D_bg05n") shape = SubResource("ConcavePolygonShape3D_bg05n")
[node name="CloseSwitch" parent="Bulkhead/Podium2" instance=ExtResource("2_pka60")] [node name="CloseSwitch" parent="Bulkhead/Podium2" instance=ExtResource("3_4okgx")]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35)
clean = true clean = true
@ -286,19 +286,19 @@ text = "Close"
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.5, 0, -6) 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="SignalTest" parent="SignalTestSpawnPoint" instance=ExtResource("9_dub8r")]
[node name="PropTestSpawnPoint" type="Marker3D" parent="."] [node name="PropTestSpawnPoint" type="Marker3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.5, 0, 4.5) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.5, 0, 4.5)
[node name="PropTest" parent="PropTestSpawnPoint" instance=ExtResource("10_f342o")] [node name="PropTest" parent="PropTestSpawnPoint" instance=ExtResource("10_ovu60")]
[node name="ItemTestSpawnPoint" type="Marker3D" parent="."] [node name="ItemTestSpawnPoint" type="Marker3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -13, 0, -2) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -13, 0, -2)
[node name="ItemTest" parent="ItemTestSpawnPoint" instance=ExtResource("11_iyuyb")] [node name="ItemTest" parent="ItemTestSpawnPoint" instance=ExtResource("11_crh2u")]
[connection signal="activated" from="ResetPodium/ResetSwitch" to="." method="reset"] [connection signal="activated" from="ResetPodium/ResetSwitch" to="." method="reset"]
[connection signal="activated" from="NoduleSpawner/WallSwitch" to="." method="spawn_nodule"] [connection signal="activated" from="NoduleSpawner/WallSwitch" to="." method="spawn_nodule"]

View File

@ -1,3 +1,4 @@
@tool
extends GunkNode extends GunkNode
## Periodically emits a pulse. ## Periodically emits a pulse.
@ -7,15 +8,24 @@ signal pulsed
## Time in seconds between pulses. ## Time in seconds between pulses.
@export var interval := 3.0 @export var interval := 3.0
@export var quick_connect_to: SignalNode:
set = _editor_connect
@onready var pulse_timer: Timer = %PulseTimer @onready var pulse_timer: Timer = %PulseTimer
@onready var animation_player: AnimationPlayer = %AnimationPlayer @onready var animation_player: AnimationPlayer = %AnimationPlayer
func _ready() -> void: func _ready() -> void:
pulse_timer.start(interval) if not Engine.is_editor_hint():
pulse_timer.start(interval)
func pulse() -> void: func pulse() -> void:
# TODO animation # TODO animation
animation_player.play("pulse") animation_player.play("pulse")
pulsed.emit() pulsed.emit()
func _editor_connect(node: SignalNode) -> void:
self.pulsed.connect(node.pulse, CONNECT_PERSIST)
self.notify_property_list_changed()

View File

@ -74,6 +74,7 @@ metadata/_custom_type_script = "uid://cfsiyhhrcua6o"
shape = SubResource("ConcavePolygonShape3D_2ibh1") shape = SubResource("ConcavePolygonShape3D_2ibh1")
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"] [node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D"]
gi_mode = 2
mesh = SubResource("CylinderMesh_ud3xk") mesh = SubResource("CylinderMesh_ud3xk")
skeleton = NodePath("../..") skeleton = NodePath("../..")

View File

@ -73,7 +73,7 @@ static func find_path(
func _editor_connect(node: SignalNode) -> void: func _editor_connect(node: SignalNode) -> void:
self.triggered.connect(node.trigger, CONNECT_PERSIST) self.triggered.connect(node.trigger, CONNECT_PERSIST)
self.pulsed.connect(node.trigger, CONNECT_PERSIST) self.pulsed.connect(node.pulse, CONNECT_PERSIST)
self.notify_property_list_changed() self.notify_property_list_changed()

View File

@ -117,6 +117,7 @@ editor_arrow_scene = ExtResource("2_nfkbq")
value = 800.0 value = 800.0
[node name="MeshInstance3D" type="MeshInstance3D" parent="."] [node name="MeshInstance3D" type="MeshInstance3D" parent="."]
gi_mode = 2
mesh = SubResource("SphereMesh_hsruj") mesh = SubResource("SphereMesh_hsruj")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."] [node name="CollisionShape3D" type="CollisionShape3D" parent="."]

View File

@ -48,13 +48,14 @@ data = PackedVector3Array(0.7236, -0.4472, 0.5257, 0, -1, 0, -0.2764, -0.4472, 0
collision_layer = 36 collision_layer = 36
collision_mask = 0 collision_mask = 0
script = ExtResource("1_t1c4j") script = ExtResource("1_t1c4j")
durability = 3.0 durability = 0.5
value = 4000.0 value = 4000.0
metadata/_custom_type_script = "uid://bypgxi0gy56yk" metadata/_custom_type_script = "uid://bypgxi0gy56yk"
[node name="MeshInstance3D" type="MeshInstance3D" parent="."] [node name="MeshInstance3D" type="MeshInstance3D" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0) transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
gi_mode = 2
mesh = SubResource("ArrayMesh_ulsff") mesh = SubResource("ArrayMesh_ulsff")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."] [node name="CollisionShape3D" type="CollisionShape3D" parent="."]