did some debugging
plus added a worldenvironment to the dev map scene
This commit is contained in:
parent
e4525233f1
commit
ce3b36d9fe
10 changed files with 74 additions and 60 deletions
|
|
@ -21,6 +21,15 @@
|
|||
[sub_resource type="BoxShape3D" id="BoxShape3D_57qmd"]
|
||||
size = Vector3(20.447998, 11.038544, 1)
|
||||
|
||||
[sub_resource type="Environment" id="Environment_b5l5s"]
|
||||
background_mode = 2
|
||||
background_energy_multiplier = 2.36
|
||||
|
||||
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_60a4j"]
|
||||
dof_blur_far_distance = 16.46
|
||||
dof_blur_amount = 0.01
|
||||
auto_exposure_max_sensitivity = 14462.9
|
||||
|
||||
[node name="DevMap" type="Node3D" unique_id=471389571]
|
||||
|
||||
[node name="Plane" type="StaticBody3D" parent="." unique_id=1943923809]
|
||||
|
|
@ -130,3 +139,7 @@ shape = SubResource("BoxShape3D_57qmd")
|
|||
[node name="CollisionShape3D2" type="CollisionShape3D" parent="StaticBody3D4" unique_id=967910627]
|
||||
transform = Transform3D(1, 1.3113416e-07, -1.3113416e-07, -1.3113416e-07, -4.371139e-08, -1, -1.3113416e-07, 1, -4.371137e-08, -9.723998, 10.984082, 10)
|
||||
shape = SubResource("BoxShape3D_57qmd")
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=376113449]
|
||||
environment = SubResource("Environment_b5l5s")
|
||||
camera_attributes = SubResource("CameraAttributesPractical_60a4j")
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ extends Control
|
|||
@onready var frame_time_counter: Label = %FrameCounter
|
||||
@onready var fps_counter_average: Label = %FpsCounterAverage
|
||||
@onready var frame_time_counter_average: Label = %FrameCounterAverage
|
||||
@onready var cpu: Label = %Cpu
|
||||
@onready var gpu: Label = %Gpu
|
||||
@onready var ram: Label = %Ram
|
||||
|
||||
|
||||
func update_fps_counter():
|
||||
|
|
@ -16,7 +19,6 @@ var fps_over_5s: Array[float] = []
|
|||
var ms_over_5s: Array[float] = []
|
||||
|
||||
func reset_avg():
|
||||
print("reset")
|
||||
fps_over_5s = []
|
||||
ms_over_5s = []
|
||||
|
||||
|
|
@ -34,9 +36,14 @@ func update_avg_ms_counter():
|
|||
avg += i
|
||||
frame_time_counter_average.text = "Frame time (ms avg over " + str(snapped(5 - reset_timer.time_left, 0.1)) +"s): " + str(snapped(avg / len(ms_over_5s), 0.01))
|
||||
|
||||
func update_ram():
|
||||
var current_usage: float = float(OS.get_static_memory_usage())
|
||||
ram.text = "RAM (GB): " + str(snapped(current_usage / (1000 ** 3), 0.001)) + " (" + str(int(current_usage)) + " bytes)"
|
||||
|
||||
func update_avg():
|
||||
update_avg_fps_counter()
|
||||
update_avg_ms_counter()
|
||||
update_ram()
|
||||
|
||||
func update():
|
||||
update_fps_counter()
|
||||
|
|
@ -56,6 +63,9 @@ func _ready() -> void:
|
|||
avg_polling_timer.timeout.connect(update_avg)
|
||||
avg_polling_timer.wait_time = 0.1
|
||||
|
||||
gpu.text = "GPU: " + RenderingServer.get_rendering_device().get_device_name()
|
||||
cpu.text = "CPU: " + OS.get_processor_name()
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if visible:
|
||||
|
|
|
|||
|
|
@ -44,6 +44,20 @@ unique_name_in_owner = true
|
|||
layout_mode = 2
|
||||
text = "Frame time (ms average over 5s): "
|
||||
|
||||
[node name="Gpu" type="Label" parent="LeftTop/VBoxContainer" unique_id=485978350]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Gpu: "
|
||||
|
||||
[node name="Cpu" type="Label" parent="LeftTop/VBoxContainer" unique_id=349131798]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Cpu: "
|
||||
|
||||
[node name="Ram" type="Label" parent="LeftTop/VBoxContainer" unique_id=1245382762]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="LeftTop2" type="PanelContainer" parent="." unique_id=269613358]
|
||||
layout_mode = 1
|
||||
anchors_preset = -1
|
||||
|
|
|
|||
|
|
@ -57,15 +57,6 @@ func handle_joypad_movement(delta: float):
|
|||
func equip_object(object: RigidBody3D):
|
||||
player_manager.add_item(object)
|
||||
|
||||
func check_raycast(raycast):
|
||||
if raycast.is_colliding():
|
||||
var hit_object = raycast.get_collider()
|
||||
|
||||
# THIS WILL REVEAL THE BUG:
|
||||
print("Raycast hit: ", hit_object.name)
|
||||
print("Is hit object equippable? ", hit_object.is_in_group("equippable"))
|
||||
print("Is hit object's parent equippable? ", hit_object.get_parent().is_in_group("equippable"))
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if not player_state.in_menu:
|
||||
if event is InputEventMouseMotion:
|
||||
|
|
@ -78,7 +69,10 @@ func _input(event: InputEvent) -> void:
|
|||
mouse_motion_delta = event.relative
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if !Console.toggled:
|
||||
if Input.is_action_just_pressed("open_menu"):
|
||||
ui_handler.toggle_menu()
|
||||
|
||||
if !Console.toggled and not player_state.in_menu:
|
||||
handle_joypad_movement(delta)
|
||||
|
||||
mouse_motion.y = clamp(mouse_motion.y, -1560, 1560)
|
||||
|
|
@ -90,9 +84,6 @@ func _process(delta: float) -> void:
|
|||
|
||||
if Input.is_action_just_pressed("prev_item"):
|
||||
player_manager.prev_item()
|
||||
|
||||
if Input.is_action_just_pressed("open_menu"):
|
||||
ui_handler.toggle_menu()
|
||||
|
||||
if Input.is_action_just_pressed("show_debug_menu"):
|
||||
debug_menu.visible = !debug_menu.visible
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ target_position = Vector3(0, -2, 0)
|
|||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.5)
|
||||
|
||||
[node name="EquippedItemPosition" type="RigidBody3D" parent="CameraPivot/PlayerCamera" unique_id=1800356500]
|
||||
[node name="EquippedItemPosition" type="StaticBody3D" parent="CameraPivot/PlayerCamera" unique_id=273241291]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.5698267)
|
||||
collision_layer = 0
|
||||
|
|
@ -128,11 +128,11 @@ collision_mask = 0
|
|||
|
||||
[node name="EquippedItemMesh" type="MeshInstance3D" parent="CameraPivot/PlayerCamera/EquippedItemPosition" unique_id=1561364797]
|
||||
unique_name_in_owner = true
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0.44286752, 0, 0.8769744)
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0.44286752, -0.2449894, 0.8769744)
|
||||
mesh = SubResource("PlaceholderMesh_60a4j")
|
||||
|
||||
[node name="EquippedItemCollision" type="CollisionShape3D" parent="CameraPivot/PlayerCamera/EquippedItemPosition" unique_id=492114455]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0.44286752, 0, 0.8769744)
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0.44286752, -0.2449894, 0.8769744)
|
||||
shape = SubResource("SphereShape3D_b5l5s")
|
||||
|
||||
[node name="GrabbableFinder" type="Area3D" parent="CameraPivot/PlayerCamera" unique_id=988433915]
|
||||
|
|
@ -141,6 +141,11 @@ shape = SubResource("SphereShape3D_b5l5s")
|
|||
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, -1, 0, 1, -4.371139e-08, 0, 0, -1)
|
||||
shape = SubResource("CylinderShape3D_g4v7s")
|
||||
|
||||
[node name="PlayerAmbiantLight" type="OmniLight3D" parent="CameraPivot/PlayerCamera" unique_id=450850774]
|
||||
light_energy = 0.1
|
||||
omni_range = 3.0
|
||||
omni_attenuation = 0.5
|
||||
|
||||
[node name="PlayerListener" type="AudioListener3D" parent="CameraPivot" unique_id=1468948553]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.7621309, 0)
|
||||
doppler_tracking = 2
|
||||
|
|
@ -161,20 +166,18 @@ visible = false
|
|||
unique_name_in_owner = true
|
||||
visible = false
|
||||
|
||||
[node name="Cursor" type="TextureRect" parent="." unique_id=785138925]
|
||||
unique_name_in_owner = true
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -20.0
|
||||
offset_top = -20.0
|
||||
offset_right = 20.0
|
||||
offset_bottom = 20.0
|
||||
[node name="AspectRatioContainer" type="AspectRatioContainer" parent="." unique_id=1574569435]
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.49
|
||||
anchor_top = 0.49
|
||||
anchor_right = 0.51
|
||||
anchor_bottom = 0.51
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
offset_transform_enabled = true
|
||||
|
||||
[node name="Cursor" type="TextureRect" parent="AspectRatioContainer" unique_id=785138925]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
offset_transform_scale = Vector2(0.345, 0.345)
|
||||
texture = SubResource("CurveXYZTexture_d0u6y")
|
||||
expand_mode = 1
|
||||
|
|
|
|||
|
|
@ -42,27 +42,6 @@ func select_item(index:int = selected_item):
|
|||
for i in inventory[index].get_children():
|
||||
if i is MeshInstance3D:
|
||||
equipped_item_mesh.mesh = i.mesh
|
||||
|
||||
|
||||
#selecting empty slot makes all inventory items invisible
|
||||
#if inventory[index] == null:
|
||||
#for c in inventory:
|
||||
#c.visible = false
|
||||
#return
|
||||
#
|
||||
#else:
|
||||
##deselect item --> hide currently equipped item object
|
||||
##show newly selected item, since its not null because of the else statement it shouldnt crash
|
||||
##if called from outside, sets the selected item to the index called from the argument
|
||||
#if index != selected_item:
|
||||
#prev_selected_item = selected_item
|
||||
#if inventory[prev_selected_item] != null:
|
||||
#inventory[prev_selected_item].visible = false
|
||||
#else:
|
||||
#if inventory[prev_selected_item] != null:
|
||||
#inventory[prev_selected_item].visible = false
|
||||
#selected_item = index
|
||||
#inventory[index].visible = true
|
||||
|
||||
func add_item(item: RigidBody3D):
|
||||
#add item to current equipped slot if empty
|
||||
|
|
@ -145,8 +124,8 @@ func _ready() -> void:
|
|||
#
|
||||
#selected_item_object.angular_velocity = axis * angle * PlayerConsts.GRAB_ROTATION_POWER
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
func _process(delta: float) -> void:
|
||||
if stamina_recharge:
|
||||
stamina = move_toward(stamina, 100, .5)
|
||||
stamina = move_toward(stamina, 100, .5 * delta)
|
||||
if flashlight.visible:
|
||||
flashlight_power = move_toward(flashlight_power, 0, .2)
|
||||
flashlight_power = move_toward(flashlight_power, 0, .2 * delta)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ anchor_right = 1.0
|
|||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
script = ExtResource("1_ddq1g")
|
||||
|
||||
[node name="AspectRatioContainer" type="AspectRatioContainer" parent="." unique_id=1898441113]
|
||||
|
|
|
|||
|
|
@ -93,6 +93,9 @@ func _process(delta: float) -> void:
|
|||
if audio_cooldowns[i] > 0:
|
||||
audio_cooldowns[i] -= delta
|
||||
|
||||
if not player.is_on_floor():
|
||||
cur_player_in_air_velocity = player.velocity.length()
|
||||
|
||||
play_wind()
|
||||
|
||||
var is_right_leg := func () -> SpatialAudio3D:
|
||||
|
|
@ -132,7 +135,7 @@ func play_stream_on_player(player:SpatialAudio3D, audio:AudioStream, pitch: floa
|
|||
if audio_cooldowns[get_player_str.call(player)] <= 0:
|
||||
player.do_set_stream(audio)
|
||||
player.pitch_scale = pitch
|
||||
player.volume_db = player.volume_db * volume
|
||||
player.volume_linear = volume ** 2
|
||||
player.do_play()
|
||||
audio_cooldowns[get_player_str.call(player)] = audio.get_length() / 1.5
|
||||
|
||||
|
|
@ -184,6 +187,8 @@ func play_flashlight_sound():
|
|||
play_stream_on_player(head_texture, play_sound)
|
||||
_current_flashlight_sound = play_sound
|
||||
|
||||
var cur_player_in_air_velocity: float = 0
|
||||
|
||||
func play_jump_sound(start:bool = true):
|
||||
var sound_to_play_foot: AudioStream = null
|
||||
var sound_to_play_breath: AudioStream = null
|
||||
|
|
@ -198,7 +203,7 @@ func play_jump_sound(start:bool = true):
|
|||
while sound_to_play_breath == _current_jump_start_breath_sound:
|
||||
sound_to_play_breath = Sounds.get_random_sound(Sounds.JUMP_STARTING_BREATH_SOUNDS)
|
||||
false:
|
||||
print(volume)
|
||||
volume = cur_player_in_air_velocity
|
||||
while sound_to_play_foot == _current_jump_land_sound:
|
||||
sound_to_play_foot = Sounds.get_random_sound(Sounds.JUMP_LANDING_SOUNDS)
|
||||
while sound_to_play_breath == _current_jump_land_breath_sound:
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ func _on_action_finder_body_entered(body: Node3D) -> void:
|
|||
else:
|
||||
return
|
||||
action_panel_body = body
|
||||
prompt.position = -(cursor.position - player_camera.unproject_position(action_panel_body.global_position)) / 2
|
||||
prompt.position = -(cursor.global_position - player_camera.unproject_position(action_panel_body.global_position)) / 2
|
||||
prompt.visible = true
|
||||
|
||||
func _on_action_finder_body_exited(body: Node3D) -> void:
|
||||
|
|
@ -39,7 +39,7 @@ func _on_action_finder_body_exited(body: Node3D) -> void:
|
|||
|
||||
func _process(delta: float) -> void:
|
||||
if action_panel_body != null:
|
||||
var target_position = cursor.position - player_camera.unproject_position(action_panel_body.global_position)
|
||||
var target_position = cursor.global_position - player_camera.unproject_position(action_panel_body.global_position)
|
||||
prompt.position = prompt.position.lerp(-target_position / 2, delta * 50)
|
||||
|
||||
func toggle_menu():
|
||||
|
|
|
|||
|
|
@ -10,9 +10,7 @@ func sound_loading_done():
|
|||
hide()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
hide()
|
||||
|
||||
func _ready() -> void:
|
||||
Sounds.loading_sounds.connect(sound_loading)
|
||||
Sounds.loading_sounds_done.connect(sound_loading_done)
|
||||
pass # Replace with function body.
|
||||
|
|
|
|||
Loading…
Reference in a new issue