Compare commits

..

No commits in common. "b089ca968e62b5f3885dfafe8a056ba598903534" and "b164b513d7785608833078504ca67f79afc5d261" have entirely different histories.

135 changed files with 750 additions and 18256 deletions

3
.gitignore vendored
View file

@ -4,6 +4,3 @@
#icon assets #icon assets
addons/at-icons/* addons/at-icons/*
#rendered images
assets/models/crt-render-1/*

File diff suppressed because it is too large Load diff

View file

@ -1,9 +0,0 @@
MIT License
Copyright (c) 2025 Tienne_k
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,42 +0,0 @@
# raytraced-audio
Adds procedural audio effects to Godot like echo, ambient outdoor sounds, and muffle.
Check out [this amazing video](https://youtu.be/u6EuAUjq92k?si=6W-sGozYBQITEgQo) by **Vercidium** for insights on how this works!
No need to create and maintain zones while creating levels, just put the `RaytracedAudioListener` node in your scene and most features will be available for you to use!
Additionally, by using `RaytracedAudioPlayer3D`s instead of regular `AudioPlayer3D`s, sounds will get automatically muffled behind walls.
### Audio buses
Right off the bat, this plugin creates 2 new audio buses for you to use across your project:
a *"Reverb"* bus, and an *"Ambient"* bus.
Note: both buses' names can be changed under `Project Settings > Raytraced Audio`.
The reverb bus controls echo / reverb.
For example, there will be a much bigger reverb in large enclosed rooms compared to small ones, or outside in the open.
The ambient bus controls the strength and pan of sounds coming from outside.
For example, in a room with a single opening leading outisde, sounds in this bus will appear to come from that opening, and will fade based on the player's distance to it.
### Performace
Because the rays need to gather different informations about the environment, the actual number of processed rays can go up to:
`rays_count * (2 + n)` where `n` is the number of enabled `RaytracedAudioPlayer3D`s in the scene.
That is:
`(rays_count: configurable) * (1 ray that bounces around + 1 echo ray + (1 muffle ray per enabled RaytracedAudioPlayer3D))`
Raytraced Audio also adds 2 performance monitors:
- `raytraced_audio/raycast_updates`: How many raycast updates happened in the update tick
- `raytraced_audio/enabled_players_count`: How many `RaytracedAudioPlayer3D`s are currently enabled in the scene
### Installation
#### Manual installation
- Download or clone this repository
- Copy the `addons/raytraced_audio` folder into your project's `addons/` folder
- Enable the plugin in `Project Settings > Plugins > Raytraced Audio`

View file

@ -1,138 +0,0 @@
extends RayCast3D
# dont you worry about this class, habibi
# shhhhhh its okay
# ( - ͜ʖ -)☞(ʘ_ʘ; )
var cast_dist: float = 0.0
var max_bounces: int = 1
var ray_scatter: Callable
var echo_dist: float = 0.0
var echo_count: int = 0
var bounces: int = 0
var has_bounced_this_tick: bool = false
var ray_casts_this_tick: int = 0
var escaped: bool = false
var escape_dir: Vector3 = Vector3.ZERO
var _space_state: PhysicsDirectSpaceState3D
func _init(raycast_dist: float, max_bounce_count: int) -> void:
top_level = true
enabled = false
cast_dist = raycast_dist
max_bounces = max_bounce_count
func _enter_tree() -> void:
owner = get_parent()
assert(owner is RaytracedAudioListener)
func _ready() -> void:
_space_state = get_world_3d().direct_space_state
reset()
# TODO: optimize
func update():
# Reset if needed
if escaped or bounces > max_bounces:
reset()
force_raycast_update()
ray_casts_this_tick += 1
bounces += 1
# Escaped outside
if !is_colliding():
escaped = true
global_position += target_position
# Muffle ray: Check for line of sight with audio players
for player: RaytracedAudioPlayer3D in get_tree().get_nodes_in_group(RaytracedAudioPlayer3D.ENABLED_GROUP_NAME):
var has_line_of_sight: bool = _cast_ray(player.global_position).is_empty()
player._lowpass_rays_count += int(has_line_of_sight)
return
# Bounce
var hit_pos: Vector3 = get_collision_point()
var normal: Vector3 = get_collision_normal()
global_position = hit_pos + normal * 0.1
target_position = target_position.bounce(normal)
has_bounced_this_tick = true
# Muffle ray: Check for line of sight with audio players
for player: RaytracedAudioPlayer3D in get_tree().get_nodes_in_group(RaytracedAudioPlayer3D.ENABLED_GROUP_NAME):
var has_line_of_sight: bool = _cast_ray(player.global_position).is_empty()
player._lowpass_rays_count += int(has_line_of_sight)
# Same as:
# if has_line_of_sight:
# player.lowpass_rays_count += 1
# Echo ray: Check for line of light with listener
# Optimization: no need to raycast for first echo bounce
if bounces == 1:
echo_dist = hit_pos.distance_to(owner.global_position)
echo_count += 1
escape_dir = target_position.normalized()
elif _cast_ray(owner.global_position).is_empty():
# The way is clear -> echo
echo_dist = hit_pos.distance_to(owner.global_position)
echo_count += 1
escape_dir = owner.global_position.direction_to(hit_pos)
# Return to the listener with a random direction
func reset():
var dir: Vector3 = ray_scatter.call()
global_position = owner.global_position
target_position = dir * cast_dist
bounces = 0
escaped = false
escape_dir = dir
reset_tick_stats()
# Called after this ray is done ticking, in RaytracedAudioListener
func reset_tick_stats() -> void:
has_bounced_this_tick = false
ray_casts_this_tick = 0
echo_dist = 0.0
echo_count = 0
func set_scatter_model(model: RaytracedAudioListener.RayScatterModel) -> void:
match model:
RaytracedAudioListener.RayScatterModel.RANDOM:
ray_scatter = _random_dir
RaytracedAudioListener.RayScatterModel.XZ:
ray_scatter = _random_dir_xz_plane
_:
push_error("Unknown ray scatter model: '", model, "'")
ray_scatter = _random_dir
func _cast_ray(to: Vector3) -> Dictionary:
var params: PhysicsRayQueryParameters3D = PhysicsRayQueryParameters3D.create(
global_position,
to,
0b01
)
ray_casts_this_tick += 1
return _space_state.intersect_ray(params)
func _random_dir_xz_plane() -> Vector3:
var yaw = randf_range(0.0, TAU)
return Vector3(-sin(yaw), 0.0, -cos(yaw))
func _random_dir() -> Vector3:
var theta: float = randf_range(0.0, TAU)
var y: float = randf_range(-1.0, 1.0)
var k: float = sqrt(1.0 - y*y)
return Vector3(k * cos(theta), k * sin(theta), y)

View file

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

View file

@ -1,7 +0,0 @@
[plugin]
name="Raytraced Audio"
description="Adds procedural audio effects to Godot like echo, ambient outdoor sounds, and muffle"
author="Tienne_k"
version="1.0"
script="plugin.gd"

View file

@ -1,83 +0,0 @@
@tool
extends EditorPlugin
func _enter_tree() -> void:
_setup_settings()
# For some reason, adding custom types like this fails to generate documentation sometimes??
# add_custom_type(
# "RaytracedAudioListener",
# "AudioListener3D",
# load("res://addons/raytraced_audio/raytraced_audio_listener.gd"),
# null
# )
# add_custom_type(
# "RaytracedAudioPlayer3D",
# "AudioStreamPlayer3D",
# load("res://addons/raytraced_audio/raytraced_audio_player_3d.gd"),
# null
# )
_setup_audio_buses()
func _exit_tree() -> void:
# remove_custom_type("RaytracedAudioListener")
# remove_custom_type("RaytracedAudioPlayer3D")
_clean_up_settings()
_clean_up_audio_buses()
func _setup_settings() -> void:
ProjectSettings.set_setting("raytraced_audio/reverb_bus", &"RaytracedReverb")
ProjectSettings.set_setting("raytraced_audio/ambient_bus", &"RaytracedAmbient")
if ProjectSettings.get_setting("audio/general/3d_panning_strength") < 1.0:
print("[INFO] RaytracedAudio: I recommend setting Audio/General/3d_panning_strength in Project Settings to 1.0 or above")
func _clean_up_settings() -> void:
ProjectSettings.set_setting("raytraced_audio/reverb_bus", null)
ProjectSettings.set_setting("raytraced_audio/ambient_bus", null)
func _setup_audio_buses() -> void:
print("[INFO] Raytraced Audio: setting up audio buses")
_clean_up_audio_buses()
# Reverb
var i: int = AudioServer.bus_count
AudioServer.add_bus()
AudioServer.set_bus_name(i, ProjectSettings.get_setting("raytraced_audio/reverb_bus", &"RaytracedReverb"))
AudioServer.set_bus_send(i, &"Master")
var reverb: AudioEffectReverb = AudioEffectReverb.new()
reverb.hipass = 1.0
reverb.resource_name = "reverb"
AudioServer.add_bus_effect(i, reverb)
# Ambient
i = AudioServer.bus_count
AudioServer.add_bus()
AudioServer.set_bus_name(i, ProjectSettings.get_setting("raytraced_audio/ambient_bus", &"RaytracedAmbient"))
AudioServer.set_bus_send(i, &"Master")
var panner: AudioEffectPanner = AudioEffectPanner.new()
panner.resource_name = "pan"
AudioServer.add_bus_effect(i, panner)
# There's a bug in Godot that makes it so the ambient bus doesnt show properly in the editor
# This is "fixable" by adding a temporary bus afterwards and deleting it immediately because ofc.
# fuck you (respectfully)
i = AudioServer.bus_count
AudioServer.add_bus()
AudioServer.remove_bus(i)
func _clean_up_audio_buses() -> void:
var i: int = AudioServer.get_bus_index(ProjectSettings.get_setting("raytraced_audio/reverb_bus", &"RaytracedReverb"))
if i != -1:
AudioServer.remove_bus(i)
i = AudioServer.get_bus_index(ProjectSettings.get_setting("raytraced_audio/ambient_bus", &"RaytracedAmbient"))
if i != -1:
AudioServer.remove_bus(i)

View file

@ -1 +0,0 @@
uid://8y7slc7nck0o

View file

@ -1,342 +0,0 @@
class_name RaytracedAudioListener extends AudioListener3D
## 3D audio listener for raytraced audio
##
## [b]Audio buses[/b]
## [br]This plugin creates 2 new audio buses for you to use across your project:
## a [i]"Reverb"[/i] bus, and an [i]"Ambient"[/i] bus.
## [br]Note: both buses' names can be changed under [code]Project Settings > Raytraced Audio[/code].
## [br]
## [br]The reverb bus controls echo / reverb.
## [br]For example, there will be a much bigger reverb in large enclosed rooms compared to small ones, or outside in the open
## [br]
## [br]The ambient bus controls the strength and pan of sounds coming from outside.
## [br]For example, in a room with a single opening leading outisde, sounds in this bus will appear to come from that opening, and will fade based on the player's distance to it
## [br]
## [br][b]Performace[/b]
## [br]Raytraced Audio adds 2 performance monitors:
## [br] - [code]raytraced_audio/raycast_updates[/code]: How many raycast updates happened in one update tick
## [br] - [code]raytraced_audio/enabled_players_count[/code]: How many [RaytracedAudioPlayer3D]s are enabled in the scene
## [br]
## [br]Note: There should be only one [RaytracedAudioListener] in a given scene, just like how there should be only one AudioListener3D in a scene.
## [br]See also [RaytracedAudioPlayer3D]
## Speed of sound in m/s
const SPEED_OF_SOUND: float = 343.0
## All [RaytracedAudioListener]s will be in this group
const GROUP_NAME: StringName = &"raytraced_audio_listener"
const AudioRay: Script = preload("res://addons/raytraced_audio/audio_ray.gd")
enum RayScatterModel {
## Rays will be shot out in a random 3d direction
RANDOM,
## Rays will be shot out on the listener's XZ plane (i.e. [code]Vector3(random, 0, random)[/code])
XZ,
}
## Emitted when this node is enabled
signal enabled
## Emitted when this node is disabled
signal disabled
## Emitted when any configuration for the rays are changed
## [br]This includes: [member rays_count], [member max_raycast_dist], [member max_bounces], and [member ray_scatter_model]
signal ray_configuration_changed
## List of rays instanced by this node
var rays: Array[AudioRay] = []
## Enable or disable raycasting
## [br]Disabled nodes can't be updated (see [method update]) even if [member auto_update] is set to [code]true[/code]
@export var is_enabled: bool = true:
set(v):
if is_enabled == v:
return
is_enabled = v
if is_enabled:
if is_node_ready():
setup()
enabled.emit()
else:
disabled.emit()
if is_node_ready():
clear()
## Whether to update automatically
## [br]If set to [code]true[/code], this [RaytracedAudioListener] will update every [i]process[/i] frame
@export var auto_update: bool = true:
set(v):
auto_update = v
set_process(auto_update)
## Number of rays to use
## [br]More rays and more bounces mean a more accurate model of the environment can be made
## [br] See also [member max_bounces]
## [br]
## [br][i]Technical note[/i]:
## [br] Because the rays need to gather different informations about the environment,
## the actual number of processed rays can go up to:
## [br] [code]rays_count * (2 + n)[/code] where [code]n[/code] is the number of enabled [RaytracedAudioPlayer3D]s in the scene
## [br] ([code]rays_count * (1 ray that bounces around + 1 echo ray + 1 muffle ray per enabled RaytracedAudioPlayer3D[/code])
@export var rays_count: int = 4:
set(v):
if v == rays_count:
return
rays_count = maxi(v, 1)
clear()
setup()
ray_configuration_changed.emit()
## The maximum distance which any given ray instanced by this node will cast
@export var max_raycast_dist: float = SPEED_OF_SOUND:
set(v):
max_raycast_dist = v
_update_ray_configuration()
ray_configuration_changed.emit()
## [br]More rays and more bounces mean a more accurate model of the environment can be made
## [br] See also [member rays_count]
@export var max_bounces: int = 3:
set(v):
max_bounces = v
_update_ray_configuration()
ray_configuration_changed.emit()
## Controls how rays will be instanced
@export var ray_scatter_model: RayScatterModel = RayScatterModel.RANDOM:
set(v):
ray_scatter_model = v
_update_ray_configuration()
ray_configuration_changed.emit()
@export_category("Muffle")
## Enables [RaytracedAudioPlayer3D]s muffling behind walls
@export var muffle_enabled: bool = true
## The interpolation strength of the muffle
## [br]See [member muffle_enabled]
@export_range(0.0, 1.0, 0.01) var muffle_interpolation: float = 0.01
@export_category("Echo")
## Enables updates to the reverb audio bus
## [br]See [code]Project Settings > Raytraced Audio > Reverb Bus[/code]
@export var echo_enabled: bool = true
## The "intensity" of the reverb
## [br]More specifically, multiplies the reverb's room size by this amount
## [br]The default is [code]2.0[/code] to account for sound waves coming back to the listener after hitting a wall
@export var echo_room_size_multiplier: float = 2.0
## The interpolation strength of the echo
## [br]See [member echo_enabled]
@export_range(0.0, 1.0, 0.01) var echo_interpolation: float = 0.01
@export_category("Ambient")
## Enables updates to the ambient audio bus
## [br]See [code]Project Settings > Raytraced Audio > Ambient Bus[/code]
@export var ambient_enabled: bool = true
## The interpolation strength of ambient sounds' direction (pan)
## [br]See [member ambient_enabled], [member ambient_pan_strength]
@export_range(0.0, 1.0, 0.01) var ambient_pan_interpolation: float = 0.02
## How strong the pan between right and left ear will be
## Setting this to 0 disables panning completely
## [br]See [member ambient_enabled], [member ambient_pan_interpolation]
@export_range(0.0, 1.0, 0.01) var ambient_pan_strength: float = 1.0
## The interpolation strength of ambient sounds' volume
## [br]See [member ambient_enabled]
@export var ambient_volume_interpolation: float = 0.01
## How smoothly the ambient sounds will fade away when the [AudioListener3D] is no longer "outside"
## Values close to 1 will make sounds linger for longer, while values close to 0 will make them drop suddenly
## [br]See [member ambient_enabled]
@export_range(0.0, 1.0, 0.001) var ambient_volume_attenuation: float = 0.998
## The size of the room based on data gathered from rays, in world units
## [br]Used in reverb calculation
var room_size: float = 0.0
## How "outside" this [RaytracedAudioListener] is based on data gathered from rays, between 0 and 1
var ambience: float = 0.0
## The direction to "outside" based on data gathered from rays
## [br]Should average out to 0 when this [RaytracedAudioListener] is completely outside
var ambient_dir: Vector3 = Vector3.ZERO
## For debugging purposes
## [br]See the [code]raytraced_audio/raycast_updates[/code] performance monitor
var ray_casts_this_tick: int = 0
var _reverb_effect: AudioEffectReverb
var _pan_effect: AudioEffectPanner
# Keep track of whether we've set up debug monitors
var _debug_monitors_setup: bool = false
func _enter_tree() -> void:
add_to_group(GROUP_NAME)
func _ready() -> void:
# Reverb effect
var i: int = AudioServer.get_bus_index(ProjectSettings.get_setting("raytraced_audio/reverb_bus"))
if i == -1:
push_error("Failed to get reverb bus for raytraced audio. Disabling echo...")
echo_enabled = false
else:
_reverb_effect = AudioServer.get_bus_effect(i, 0)
# Pan effect
i = AudioServer.get_bus_index(ProjectSettings.get_setting("raytraced_audio/ambient_bus"))
if i == -1:
push_error("Failed to get ambient bus for raytraced audio. Disabling ambience...")
ambient_enabled = false
else:
_pan_effect = AudioServer.get_bus_effect(i, 0)
if is_enabled:
setup()
set_process(auto_update)
if is_enabled:
make_current()
_setup_debug()
func _exit_tree() -> void:
_cleanup_debug()
func _setup_debug() -> void:
if _debug_monitors_setup:
return
_debug_monitors_setup = true
Performance.add_custom_monitor(&"raytraced_audio/raycast_updates", func():
# Check if this instance is still valid
if not is_instance_valid(self):
return 0
return ray_casts_this_tick
)
Performance.add_custom_monitor(&"raytraced_audio/enabled_players_count", func():
# Check if this instance is still valid and if we're in a scene tree
if not is_instance_valid(self) or not is_inside_tree():
return 0
return get_tree().get_node_count_in_group(RaytracedAudioPlayer3D.ENABLED_GROUP_NAME)
)
func _cleanup_debug() -> void:
if not _debug_monitors_setup:
return
_debug_monitors_setup = false
# Remove the custom monitors
Performance.remove_custom_monitor(&"raytraced_audio/raycast_updates")
Performance.remove_custom_monitor(&"raytraced_audio/enabled_players_count")
## Initiates this [RaytracedAudioListener]'s rays
func setup() -> void:
for __ in rays_count:
var rc: AudioRay = AudioRay.new(max_raycast_dist, max_bounces)
rc.set_scatter_model(ray_scatter_model)
add_child(rc, INTERNAL_MODE_BACK)
rays.push_back(rc)
## Clears all created rays
func clear():
for ray: AudioRay in rays:
remove_child(ray)
ray.queue_free()
rays.clear()
func _process(delta: float) -> void:
if !auto_update:
set_process(false)
return
update()
## Updates this [RaytracedAudioListener]
## [br]If you are updating this node manually (i.e. [member auto_update] is [code]false[/code]), this is the method to call
func update():
ray_casts_this_tick = 0
if !is_enabled:
return
var echo: float = 0.0 # Avg echo from all rays
var echo_count: int = 0 # Number of echo rays that came back
var bounces_this_tick: int = 0
var escaped_count: int = 0
var escaped_dir: Vector3 = Vector3.ZERO # Avg escape direction
var escaped_strength: float = 0.0
# Gather data
for ray: AudioRay in rays:
ray.update()
ray_casts_this_tick += ray.ray_casts_this_tick
echo += ray.echo_dist
echo_count += ray.echo_count
bounces_this_tick += int(ray.has_bounced_this_tick)
if ray.escaped:
escaped_count += 1
escaped_strength += 1.0 / ray.bounces
escaped_dir += ray.escape_dir
ray.reset_tick_stats()
echo = 0.0 if echo_count == 0 else (echo / float(echo_count))
escaped_dir = Vector3.ZERO if escaped_count == 0 else (escaped_dir / float(escaped_count))
if muffle_enabled:
_update_muffle()
if echo_enabled:
_update_echo(echo, echo_count, bounces_this_tick)
if ambient_enabled:
_update_ambient(escaped_strength, escaped_dir)
func _update_muffle() -> void:
for player: RaytracedAudioPlayer3D in get_tree().get_nodes_in_group(RaytracedAudioPlayer3D.GROUP_NAME):
player.update(self)
func _update_echo(echo: float, echo_count: int, bounces: int) -> void:
# Length -> echo delay
room_size = lerpf(room_size, echo, echo_interpolation)
var e: float = (room_size * echo_room_size_multiplier) / SPEED_OF_SOUND
# print("e = ", e)
_reverb_effect.room_size = lerpf(_reverb_effect.room_size, clampf(e, 0.0, 1.0), echo_interpolation)
_reverb_effect.predelay_msec = lerpf(_reverb_effect.predelay_msec, e * 1000, echo_interpolation)
_reverb_effect.predelay_feedback = lerpf(_reverb_effect.predelay_feedback, clampf(e, 0.0, 0.98), echo_interpolation)
# More rays % -> echo strength
var return_ratio: float = 0.0 if bounces == 0 else float(echo_count) / float(bounces)
_reverb_effect.hipass = lerpf(_reverb_effect.hipass, 1.0 - return_ratio, echo_interpolation)
func _update_ambient(escaped_strength: float, escaped_dir: Vector3) -> void:
var ambience_ratio: float = float(escaped_strength) / float(rays_count)
# More rays % -> louder
if escaped_strength > 0:
ambience = lerpf(ambience, 1.0, ambience_ratio)
else:
ambience *= ambient_volume_attenuation
var ambient_bus_idx: int = AudioServer.get_bus_index(ProjectSettings.get_setting("raytraced_audio/ambient_bus"))
var volume: float = AudioServer.get_bus_volume_linear(ambient_bus_idx)
AudioServer.set_bus_volume_linear(ambient_bus_idx, lerpf(volume, ambience, ambient_volume_interpolation))
# Avg escape direction -> pan
ambient_dir = ambient_dir.lerp(escaped_dir, ambient_pan_interpolation)
var target_pan: float = 0.0 if ambient_dir.is_zero_approx() else owner.transform.basis.x.dot(ambient_dir.normalized())
_pan_effect.pan = target_pan * ambient_pan_strength
# ✨ the name says it all ✨
func _update_ray_configuration() -> void:
for ray: AudioRay in rays:
ray.cast_dist = max_raycast_dist
ray.max_bounces = max_bounces
ray.set_scatter_model(ray_scatter_model)

View file

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

View file

@ -1,223 +0,0 @@
class_name RaytracedAudioPlayer3D extends AudioStreamPlayer3D
## Audio stream player that allows for audio muffling
##
## You can already use the reverb and ambient audio buses (see the documentation for [RaytracedAudioListener] for more details)
## to make use of raytraced audio effects, but using [RaytracedAudioPlayer3D]s allows you to use more capabilities.
## Namely, muffling sounds behind walls.
## [br]
## [br][b][color=yellow]Warning[/color][/b]: [RaytracedAudioPlayer3D]s will default to using the reverb audio bus
## [br]If you wish to use another bus instead, please set it after this node has been added to the scene tree (i.e. after [code]_enter_tree()[/code])
## [br]
## [br][i]Technical note[/i]:
## [br]Currently, there is no way to muffle only one audio player (or apply any effect for that matter).
## [br]So we create a new bus for every audio player that is audible from the [RaytracedAudioListener]
## [br]Godot doesn't provide methods to calculate the volume of an audio at certain distances, so we calculate
## that ourselves (see [method calculate_audible_distance_threshold()])
## All [RaytracedAudioPlayer3D]s (regardless of state) will be in this group
const GROUP_NAME: StringName = &"raytraced_audio_player_3d"
## All [b]enabled[/b] [RaytracedAudioPlayer3D]s will be in this group
const ENABLED_GROUP_NAME: StringName = &"enabled_raytraced_audio_player_3d"
## The lowpass frequency when completely muffled
const LOWPASS_MIN_HZ: float = 250.0
## The lowpass frequency when completely not-muffled (?)
const LOWPASS_MAX_HZ: float = 20000.0
## Used in internal calculations
const LOG2: float = log(2.0)
## Used in internal calculations
const LOG_MIN_HZ: float = log(LOWPASS_MIN_HZ) / LOG2
## Used in internal calculations
const LOG_MAX_HZ: float = log(LOWPASS_MAX_HZ) / LOG2
## Emitted when this node is enabled
## [br]See also [constant ENABLED_GROUP_NAME]
signal enabled
## Emitted when this node is disabled
signal disabled
## Emitted when the maximum audible distance for this node is changed
## [br]See also [member AudioStreamPlayer3D.max_distance] and [member audibility_threshold_db]
signal audible_distance_updated(distance: float)
## The threshold (in decibels) at which sounds will be considered inaudible
## [br]This is used to enable / disable this node when it's not audible to save resources
## [br]The distance at which this node is no longer considered audible is automatically stored inside [member AudioStreamPlayer3D.max_distance]
## (if not already set), also to save resources
## [br]Though, setting [member AudioStreamPlayer3D.max_distance] doesn't update this field automatically
## [br]See also [method get_volume_db_from_pos] and [method calculate_audible_distance_threshold]
@export var audibility_threshold_db: float = -30.0:
set(v):
audibility_threshold_db = v
# Max distance not configured
if is_node_ready() and max_distance == 0.0:
max_distance = calculate_audible_distance_threshold()
audible_distance_updated.emit(max_distance)
var _lowpass_rays_count: int = 0
var _is_enabled: bool = false
func _enter_tree() -> void:
add_to_group(GROUP_NAME)
bus = ProjectSettings.get_setting("raytraced_audio/reverb_bus") # Fallback
func _ready() -> void:
# Max distance not configured
if max_distance == 0.0:
max_distance = calculate_audible_distance_threshold()
audible_distance_updated.emit(max_distance)
## Enables this node
## [br]Note: you should almost never have to worry about enabling / disabling [RaytracedAudioPlayer3D]s manually
## [br]See [method update]
func enable():
if _is_enabled:
return
_is_enabled = true
var i: int = _create_bus()
bus = AudioServer.get_bus_name(i)
add_to_group(ENABLED_GROUP_NAME)
enabled.emit()
## Enables this node
## [br]Note: you should almost never have to worry about enabling / disabling [RaytracedAudioPlayer3D]s manually
## [br]See [method update]
func disable():
if !_is_enabled:
return
# Don't remove the fallback bus lol
if bus == ProjectSettings.get_setting("raytraced_audio/reverb_bus"):
_disable()
return
# Remove this node's specific bus
var idx: int = AudioServer.get_bus_index(bus)
if idx == -1:
push_warning("audio bus ", bus, " not found")
_disable()
return
_disable()
AudioServer.remove_bus(idx)
func _disable():
_is_enabled = false
bus = ProjectSettings.get_setting("raytraced_audio/reverb_bus") # Fallback
remove_from_group(ENABLED_GROUP_NAME)
_lowpass_rays_count = 0
disabled.emit()
# Returns the index of the created bus
func _create_bus() -> int:
var i: int = AudioServer.bus_count
AudioServer.add_bus()
AudioServer.set_bus_name(i, generate_bus_name())
AudioServer.set_bus_send(i, ProjectSettings.get_setting("raytraced_audio/reverb_bus"))
AudioServer.add_bus_effect(i, AudioEffectLowPassFilter.new())
return i
## Returns a name for the audio bus created for this node
func generate_bus_name() -> String:
return str("RTAudioPlayer3D_", name, randi())
## ✨ the name says it all ✨
func is_enabled() -> bool:
return _is_enabled
## Updates this [RaytracedAudioPlayer3D]
## [br]This method will adjust the muffle of the played stream, as well as enable or disable it
## based on whether it's audible from the given [RaytracedAudioListener]
## [br]If you are updating this node manually, this is the method to call
func update(listener: RaytracedAudioListener) -> void:
if _is_enabled:
_update(listener.rays_count, listener.muffle_interpolation)
_lowpass_rays_count = 0
# Enable based on position
var dist_sq: float = global_position.distance_squared_to(listener.global_position)
if dist_sq > max_distance*max_distance or !playing:
disable()
else:
enable()
func _update(rays_count: int, interpolation: float):
if bus == ProjectSettings.get_setting("raytraced_audio/reverb_bus"):
_disable()
return
var idx: int = AudioServer.get_bus_index(bus)
if idx == -1:
push_error("audio bus ", bus, " not found")
_disable()
else:
var ratio: float = float(_lowpass_rays_count) / float(rays_count)
var lowpass: AudioEffectLowPassFilter = AudioServer.get_bus_effect(idx, 0)
# Frequencies aren't linear, they scale logarithmically (log2 space) +1 octave = 2x the frequency
# So we scale frequencies down before lerping, then scale them back up
var log_t: float = lerpf(LOG_MIN_HZ, LOG_MAX_HZ, ratio)
var log_hz: float = log(lowpass.cutoff_hz) / LOG2 # Scale current frequency down: log2(x) = ln(x) / ln(2)
log_hz = lerpf(log_hz, log_t, interpolation) # Lerp in scaled down space
lowpass.cutoff_hz = pow(2, log_hz) # Scale back up
# Translated from the godot repo
## Calculates the volume (in decibels) of the audio stream from the given position
## [br]Please note that the final volume will vary depending on the stream that is being played
func get_volume_db_from_pos(from_pos: Vector3) -> float:
const CMP_EPSILON: float = 0.0001
var dist: float = from_pos.distance_to(global_position)
var vol: float = 0.0
match attenuation_model:
ATTENUATION_INVERSE_DISTANCE:
vol = linear_to_db(1.0 / ((dist / unit_size) + CMP_EPSILON))
ATTENUATION_INVERSE_SQUARE_DISTANCE:
var d: float = (dist / unit_size)
vol = linear_to_db(1.0 / (d*d + CMP_EPSILON))
ATTENUATION_LOGARITHMIC:
vol = -20.0 * log(dist / unit_size + CMP_EPSILON)
ATTENUATION_DISABLED:
pass
_:
push_error("Unknown attenuation type: '", attenuation_model, "'")
vol = minf(vol + volume_db, max_db)
return vol
## Calculates the distance at which this [RaytracedAudioPlayer3D] is no longer considered audible
## [br]See also [member audibility_threshold_db]
func calculate_audible_distance_threshold() -> float:
if max_distance > 0.0:
return max_distance
match attenuation_model:
ATTENUATION_INVERSE_DISTANCE:
var t_lin: float = db_to_linear(audibility_threshold_db - volume_db)
# Unit_size / dist < T_lin
return unit_size / t_lin
ATTENUATION_INVERSE_SQUARE_DISTANCE:
var t_lin: float = db_to_linear(audibility_threshold_db - volume_db)
# (Unit_size / dist)^2 < T_lin
return sqrt(unit_size*unit_size / t_lin)
ATTENUATION_LOGARITHMIC:
var t_db: float = audibility_threshold_db - volume_db
# -20 * log(dist / Unit_size) > T_db
return exp(t_db / -20.0) * unit_size
ATTENUATION_DISABLED:
return 0.0
_:
push_error("Unknown attenuation model: '", attenuation_model, "'")
return 0.0
## Checks wheter this [RaytracedAudioPlayer3D] is considered audible from the given position
## [br]See also [member audibility_threshold_db]
func is_audible(from_pos: Vector3) -> bool:
return get_volume_db_from_pos(from_pos) >= audibility_threshold_db

View file

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

View file

@ -48,7 +48,7 @@ class_name SpatialAudio3D extends AudioStreamPlayer3D
@export var shut_up: bool = false ## Mute output. @export var shut_up: bool = false ## Mute output.
@export var debug: bool = false ## Visualize raycasts, measurement rays and reverb-audioplayers. @export var debug: bool = false ## Visualize raycasts, measurement rays and reverb-audioplayers.
@onready var player_camera: Camera3D = null # store reference to camera so that global_position is always up to date @onready var player_camera: Camera3D = get_viewport().get_camera_3d() # store reference to camera so that global_position is always up to date
#@onready var raycasts_coords: Array = [ #@onready var raycasts_coords: Array = [
#Vector3(0, 0, max_raycast_distance), # N #Vector3(0, 0, max_raycast_distance), # N
#Vector3(max_raycast_distance, 0, max_raycast_distance), # NW #Vector3(max_raycast_distance, 0, max_raycast_distance), # NW
@ -134,8 +134,8 @@ func _physics_process(_delta):
_tick_counter += 1 _tick_counter += 1
func do_play(start:float = 0.0): func do_play():
soundsource.do_play(start) soundsource.do_play()
func do_stop(): func do_stop():
@ -507,7 +507,7 @@ class Soundsource extends SpatialAudio3D:
r.soundplayer_standby.stream = s r.soundplayer_standby.stream = s
func do_play(start:float = 0.0): func do_play():
if shut_up: if shut_up:
return return
@ -521,11 +521,11 @@ class Soundsource extends SpatialAudio3D:
if reverb_enabled: if reverb_enabled:
for r in reverbers: for r in reverbers:
r.do_play(start) r.do_play()
# start play on both # start play on both
soundplayer_active.do_play(start) soundplayer_active.do_play()
soundplayer_standby.do_play(start) soundplayer_standby.do_play()
func _clear_play_lock(): func _clear_play_lock():
@ -542,9 +542,7 @@ class Soundsource extends SpatialAudio3D:
func update_run(): func update_run():
player_camera = get_viewport().get_camera_3d() distance_to_player = global_position.distance_to(player_camera.global_position)
if player_camera:
distance_to_player = global_position.distance_to(player_camera.global_position)
# only update delay when moved >5m since last update # only update delay when moved >5m since last update
if abs(distance_to_player - distance_to_player_since_last_delay_update) > 5: if abs(distance_to_player - distance_to_player_since_last_delay_update) > 5:
@ -639,18 +637,19 @@ class Reverber extends SpatialAudio3D:
var raycast_index: int var raycast_index: int
var distance_to_soundsource: float var distance_to_soundsource: float
var distance_to_player: float var distance_to_player: float
var soundplayer_active: Soundplayer = create_soundplayer(name + "-A") var soundplayer_active: Soundplayer
var soundplayer_standby: Soundplayer = create_soundplayer(name + "-B") var soundplayer_standby: Soundplayer
func _ready(): func _ready():
name = name + "#" + str(raycast_index) name = name + "#" + str(raycast_index)
# create reverb-soundplayers for AB-reverb # create reverb-soundplayers for AB-reverb
#soundplayer_active = create_soundplayer(name + "-A") soundplayer_active = create_soundplayer(name + "-A")
#soundplayer_standby = create_soundplayer(name + "-B") soundplayer_standby = create_soundplayer(name + "-B")
get_tree().get_root().add_child(soundplayer_active) get_tree().get_root().add_child(soundplayer_active)
get_tree().get_root().add_child(soundplayer_standby) get_tree().get_root().add_child(soundplayer_standby)
func _exit_tree(): func _exit_tree():
soundplayer_active.queue_free() soundplayer_active.queue_free()
soundplayer_standby.queue_free() soundplayer_standby.queue_free()
@ -661,9 +660,9 @@ class Reverber extends SpatialAudio3D:
pass pass
func do_play(start:float = 0.0): func do_play():
soundplayer_active.do_play(start) soundplayer_active.do_play()
soundplayer_standby.do_play(start) soundplayer_standby.do_play()
func do_stop(): func do_stop():
@ -834,9 +833,9 @@ class Soundplayer extends SpatialAudio3D:
remove_child(c) remove_child(c)
func do_play(start:float = 0.0): func do_play():
#if debug: printerr(str(Time.get_ticks_msec()) + ": start playing on " + name + ", stream: " + str(stream)) #if debug: printerr(str(Time.get_ticks_msec()) + ": start playing on " + name + ", stream: " + str(stream))
play(start) play()
func do_stop(): func do_stop():
@ -912,12 +911,8 @@ class Soundplayer extends SpatialAudio3D:
func update_effect_params(): func update_effect_params():
# update distance vars # update distance vars
if soundsource == null:
return
distance_to_soundsource = global_position.distance_to(soundsource.global_position) distance_to_soundsource = global_position.distance_to(soundsource.global_position)
if player_camera: distance_to_player = global_position.distance_to(player_camera.global_position)
distance_to_player = global_position.distance_to(player_camera.global_position)
# occlusion # occlusion
lp_cutoff = calculate_occlusion_lowpass() lp_cutoff = calculate_occlusion_lowpass()
@ -969,8 +964,7 @@ class Soundplayer extends SpatialAudio3D:
func calculate_occlusion_lowpass(): func calculate_occlusion_lowpass():
var limited_distance_to_player = clamp(distance_to_player, 0, max_raycast_distance) var limited_distance_to_player = clamp(distance_to_player, 0, max_raycast_distance)
if player_camera: occlusion_raycast.target_position = global_position.direction_to(player_camera.global_position) * max_raycast_distance * 10
occlusion_raycast.target_position = global_position.direction_to(player_camera.global_position) * max_raycast_distance * 10
var _cutoff = 20500 var _cutoff = 20500
occlusion_raycast.force_raycast_update() occlusion_raycast.force_raycast_update()

Binary file not shown.

View file

@ -1,36 +0,0 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://ddnuq5h5loicn"
path="res://.godot/imported/BebasNeue-Regular.ttf-7a75156d35bda4b35a4dba5fd3b7b0ab.fontdata"
[deps]
source_file="res://assets/fonts/BebasNeue-Regular.ttf"
dest_files=["res://.godot/imported/BebasNeue-Regular.ttf-7a75156d35bda4b35a4dba5fd3b7b0ab.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
modulate_color_glyphs=false
hinting=3
subpixel_positioning=4
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View file

@ -1,19 +0,0 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://b14wn4nntykxv"
path="res://.godot/imported/Bach_ Toccata and Fugue in D Minor, BWV 565.mp3-858103b4fd6b6728e77f9911964a975e.mp3str"
[deps]
source_file="res://assets/sounds/music/Bach_ Toccata and Fugue in D Minor, BWV 565.mp3"
dest_files=["res://.godot/imported/Bach_ Toccata and Fugue in D Minor, BWV 565.mp3-858103b4fd6b6728e77f9911964a975e.mp3str"]
[params]
loop=true
loop_offset=3.5
bpm=0.0
beat_count=0
bar_beats=4

View file

@ -1,5 +1,5 @@
@icon("res://addons/at-icons/node3d/hand.svg") @icon("res://addons/at-icons/node3d/hand.svg")
class_name PickupableItem extends RigidBody3D class_name EquippableItem extends RigidBody3D
# The @export_file tag creates a folder icon in the Inspector # The @export_file tag creates a folder icon in the Inspector
# that only lets you select saved .tscn files! # that only lets you select saved .tscn files!
@ -11,7 +11,7 @@ class_name PickupableItem extends RigidBody3D
var weight: float = 10.0 var weight: float = 10.0
func _ready() -> void: func _ready() -> void:
self.add_to_group("pickupable") self.add_to_group("equippable")
for x in get_children(): for x in get_children():
x.add_to_group("pickupable") x.add_to_group("equippable")
collision_layer = 17 collision_layer = 17

View file

@ -13,25 +13,6 @@ cutoff_hz = 32.0
[sub_resource type="AudioEffectLimiter" id="AudioEffectLimiter_j3pel"] [sub_resource type="AudioEffectLimiter" id="AudioEffectLimiter_j3pel"]
resource_name = "Limiter" resource_name = "Limiter"
[sub_resource type="AudioEffectDelay" id="AudioEffectDelay_j3pel"]
resource_name = "Delay"
tap1_delay_ms = 953.0
feedback_active = true
[sub_resource type="AudioEffectReverb" id="AudioEffectReverb_j3pel"]
resource_name = "Reverb"
predelay_msec = 20.0
predelay_feedback = 0.0
hipass = 0.42
wet = 0.24
[sub_resource type="AudioEffectReverb" id="AudioEffectReverb_g28q7"]
resource_name = "reverb"
hipass = 1.0
[sub_resource type="AudioEffectPanner" id="AudioEffectPanner_n8wo2"]
resource_name = "pan"
[resource] [resource]
bus/1/name = &"wind" bus/1/name = &"wind"
bus/1/solo = false bus/1/solo = false
@ -47,29 +28,3 @@ bus/1/effect/2/effect = SubResource("AudioEffectHighPassFilter_j3pel")
bus/1/effect/2/enabled = true bus/1/effect/2/enabled = true
bus/1/effect/3/effect = SubResource("AudioEffectLimiter_j3pel") bus/1/effect/3/effect = SubResource("AudioEffectLimiter_j3pel")
bus/1/effect/3/enabled = true bus/1/effect/3/enabled = true
bus/2/name = &"reverb"
bus/2/solo = false
bus/2/mute = false
bus/2/bypass_fx = false
bus/2/volume_db = 0.0
bus/2/send = &"Master"
bus/2/effect/0/effect = SubResource("AudioEffectDelay_j3pel")
bus/2/effect/0/enabled = false
bus/2/effect/1/effect = SubResource("AudioEffectReverb_j3pel")
bus/2/effect/1/enabled = false
bus/3/name = &"RaytracedReverb"
bus/3/solo = false
bus/3/mute = false
bus/3/bypass_fx = false
bus/3/volume_db = 0.0
bus/3/send = &"Master"
bus/3/effect/0/effect = SubResource("AudioEffectReverb_g28q7")
bus/3/effect/0/enabled = true
bus/4/name = &"RaytracedAmbient"
bus/4/solo = false
bus/4/mute = false
bus/4/bypass_fx = false
bus/4/volume_db = 0.0
bus/4/send = &"Master"
bus/4/effect/0/effect = SubResource("AudioEffectPanner_n8wo2")
bus/4/effect/0/enabled = true

View file

@ -1,5 +1,5 @@
@icon("res://addons/at-icons/node3d/backpack.svg") @icon("res://addons/at-icons/node3d/backpack.svg")
class_name Backpack extends PickupableItem class_name Backpack extends EquippableItem
@export var inventory_size: int = 10 @export var inventory_size: int = 10
@ -17,6 +17,6 @@ func _ready() -> void:
for i in range(inventory_size): for i in range(inventory_size):
inventory.append(null) inventory.append(null)
add_to_group("pickupable") add_to_group("equippable")
for i in get_children(): for i in get_children():
i.add_to_group("pickupable") i.add_to_group("equippable")

View file

@ -6,12 +6,8 @@
[sub_resource type="BoxShape3D" id="BoxShape3D_60a4j"] [sub_resource type="BoxShape3D" id="BoxShape3D_60a4j"]
[node name="BackpackBase" type="RigidBody3D" unique_id=1120864530 node_paths=PackedStringArray("mesh", "collision")] [node name="BackpackBase" type="RigidBody3D" unique_id=1120864530]
script = ExtResource("1_lb1lj") script = ExtResource("1_lb1lj")
inventory_size = 5
scene_path = "uid://bmqm4andgetsd"
mesh = NodePath("MeshInstance3D")
collision = NodePath("CollisionShape3D")
metadata/_custom_type_script = "uid://r4y2lmkaoou6" metadata/_custom_type_script = "uid://r4y2lmkaoou6"
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=320717816] [node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=320717816]

View file

@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://don2g5auhwbl8"] [gd_scene format=3 uid="uid://don2g5auhwbl8"]
[ext_resource type="Script" uid="uid://yggv7ie8yere" path="res://entities/pickupable/pickupable_item.gd" id="1_xb40d"] [ext_resource type="Script" uid="uid://yggv7ie8yere" path="res://classes/equippable_item.gd" id="1_xb40d"]
[sub_resource type="BoxShape3D" id="BoxShape3D_yf5fn"] [sub_resource type="BoxShape3D" id="BoxShape3D_yf5fn"]

View file

@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://codt2h7ojcsae"] [gd_scene format=3 uid="uid://codt2h7ojcsae"]
[ext_resource type="Script" uid="uid://yggv7ie8yere" path="res://entities/pickupable/pickupable_item.gd" id="1_sb4pp"] [ext_resource type="Script" uid="uid://yggv7ie8yere" path="res://classes/equippable_item.gd" id="1_sb4pp"]
[sub_resource type="BoxShape3D" id="BoxShape3D_yf5fn"] [sub_resource type="BoxShape3D" id="BoxShape3D_yf5fn"]

View file

@ -4,124 +4,17 @@ var selected_item: int = 0
var prev_selected_item: int = 0 var prev_selected_item: int = 0
var inventory: Array[ItemData] = [null, null] var inventory: Array[ItemData] = [null, null]
@export var equipped_item_position: Marker3D @export var equipped_item_mesh: MeshInstance3D
@export var hold_position: Marker3D @export var hold_position: Marker3D
@export var cursor_raycast: RayCast3D @export var cursor_raycast: RayCast3D
signal added_inventory_slot(successful: bool) signal added_inventory_slot(successful: bool)
signal removed_inventory_slot(successful: bool) signal removed_inventory_slot(successful: bool)
signal select_item(index: int)
# For UI elements # For UI elements
signal add_item(index: int, item: ItemData) signal add_item(index: int, item: ItemData)
signal remove_item(index: int) signal remove_item(index: int)
signal select_item(index: int)
var hand_cache: Dictionary = {}
func _select_item(index:int = selected_item) -> void:
# --- 1. HIDE ALL ITEMS IN CACHE TO BE SAFE ---
# Instead of relying on prev_selected_item (which can break during inventory swaps),
# we quickly hide everything in the cache. This guarantees no "ghost" items.
for key in hand_cache:
var cached_node = hand_cache[key]
if is_instance_valid(cached_node):
cached_node.hide()
cached_node.process_mode = Node.PROCESS_MODE_DISABLED
# Update the index
selected_item = index
var current_data = inventory[index]
# --- 2. SHOW OR INSTANTIATE THE NEW ITEM ---
if current_data != null and current_data.scene_path != "":
var item_path = current_data.scene_path
# Did we already instantiate this item type, AND is it still valid (not freed)?
if hand_cache.has(item_path) and is_instance_valid(hand_cache[item_path]):
var cached_item = hand_cache[item_path]
cached_item.show()
cached_item.process_mode = Node.PROCESS_MODE_INHERIT
else:
# Build it once.
var item_scene = load(item_path) as PackedScene
if item_scene:
var new_item = item_scene.instantiate()
equipped_item_position.add_child(new_item)
if new_item is RigidBody3D:
new_item.freeze = true
new_item.position = Vector3.ZERO
new_item.rotation = Vector3.ZERO
# Save it to the dictionary
hand_cache[item_path] = new_item
select_item.emit(index)
func update_slot(index: int, new_item: ItemData) -> void:
# 1. Clean up the physical 3D mesh of the old item being replaced/removed
var old_item = inventory[index]
if old_item != null and old_item.scene_path != "":
if hand_cache.has(old_item.scene_path):
var old_node = hand_cache[old_item.scene_path]
if is_instance_valid(old_node):
old_node.queue_free() # Free the 3D node from the equippable marker!
hand_cache.erase(old_item.scene_path)
# 2. Update the array
inventory[index] = new_item
# 3. Tell the in-game HUD that the slot changed
if new_item != null:
add_item.emit(index, new_item)
else:
remove_item.emit(index)
# 4. Instantly refresh the hand visual (whether we added a new item or emptied it)
_select_item(selected_item)
func _remove_item(index: int):
# Clean up the physical 3D mesh before clearing the array
var old_item = inventory[index]
if old_item != null and old_item.scene_path != "":
if hand_cache.has(old_item.scene_path):
var old_node = hand_cache[old_item.scene_path]
if is_instance_valid(old_node):
old_node.queue_free() # Free the 3D node!
hand_cache.erase(old_item.scene_path)
remove_item.emit(index)
inventory[index] = null
_select_item(selected_item) # Refresh the hand model
func use_active_item() -> void:
var current_data = inventory[selected_item]
if current_data == null:
return
if current_data.item_type == ItemData.ItemType.BACKPACK:
print("Equip Backpack via Hotbar!")
return
elif current_data.item_type == ItemData.ItemType.POCKET:
print("Equip Pocket via Hotbar!")
return
var item_path = current_data.scene_path
if item_path != "" and hand_cache.has(item_path):
var active_3d_item = hand_cache[item_path]
if is_instance_valid(active_3d_item) and active_3d_item is UsableItem:
active_3d_item.use()
update_slot(selected_item, null)
func add_inventory_slot() -> bool: func add_inventory_slot() -> bool:
if len(inventory) < 5: if len(inventory) < 5:
@ -131,7 +24,6 @@ func add_inventory_slot() -> bool:
added_inventory_slot.emit(false) added_inventory_slot.emit(false)
return false return false
func remove_inventory_slot() -> bool: func remove_inventory_slot() -> bool:
if len(inventory) > 2: if len(inventory) > 2:
inventory.remove_at(len(inventory) - 1) inventory.remove_at(len(inventory) - 1)
@ -140,7 +32,6 @@ func remove_inventory_slot() -> bool:
removed_inventory_slot.emit(false) removed_inventory_slot.emit(false)
return false return false
func next_item(): func next_item():
prev_selected_item = selected_item prev_selected_item = selected_item
if selected_item + 1 > len(inventory) - 1: if selected_item + 1 > len(inventory) - 1:
@ -149,7 +40,6 @@ func next_item():
selected_item += 1 selected_item += 1
_select_item() _select_item()
func prev_item(): func prev_item():
prev_selected_item = selected_item prev_selected_item = selected_item
if selected_item - 1 < 0: if selected_item - 1 < 0:
@ -158,10 +48,22 @@ func prev_item():
selected_item -= 1 selected_item -= 1
_select_item() _select_item()
func _select_item(index: int = selected_item):
selected_item = index
if index >= 0 and index < len(inventory):
select_item.emit(index)
func _add_item(item: PickupableItem): # Update the hand visual
if inventory[index] == null:
equipped_item_mesh.mesh = PlaceholderMesh.new()
else:
# Apply the mesh directly from the ItemData!
equipped_item_mesh.mesh = inventory[index].hand_mesh
func _add_item(item: EquippableItem):
var target_index = -1 var target_index = -1
# 1. Decide which slot to use (current slot first, then first empty)
if inventory[selected_item] == null: if inventory[selected_item] == null:
target_index = selected_item target_index = selected_item
else: else:
@ -170,10 +72,12 @@ func _add_item(item: PickupableItem):
target_index = i target_index = i
break break
# If inventory is full, do nothing
if target_index == -1: if target_index == -1:
print("Inventory Full!") print("Inventory Full!")
return return
# 2. Extract Data from the physical item
var new_item_data: ItemData = ItemData.new() var new_item_data: ItemData = ItemData.new()
new_item_data.name = item.name new_item_data.name = item.name
new_item_data.weight = item.weight new_item_data.weight = item.weight
@ -184,49 +88,75 @@ func _add_item(item: PickupableItem):
new_item_data.provided_slots = item.inventory_size new_item_data.provided_slots = item.inventory_size
elif item is Pocket: elif item is Pocket:
new_item_data.item_type = ItemData.ItemType.POCKET new_item_data.item_type = ItemData.ItemType.POCKET
elif item is UsableItem:
new_item_data.item_type = ItemData.ItemType.USABLE
else: else:
new_item_data.item_type = ItemData.ItemType.NORMAL new_item_data.item_type = ItemData.ItemType.NORMAL
# Save the mesh so we can display it in the player's hand later
if item.mesh: if item.mesh:
new_item_data.hand_mesh = item.mesh.mesh new_item_data.hand_mesh = item.mesh.mesh
# Await your custom icon generator (if it requires awaiting)
new_item_data.ui_icon = await GrabbableBase.create_icon_from_mesh(item.mesh.mesh) new_item_data.ui_icon = await GrabbableBase.create_icon_from_mesh(item.mesh.mesh)
# 3. Add to inventory array and UI
inventory[target_index] = new_item_data inventory[target_index] = new_item_data
add_item.emit(target_index, new_item_data) add_item.emit(target_index, new_item_data)
# 4. CRITICAL: Delete the physical item from the world!
item.queue_free() item.queue_free()
# Update the hand model if we added it to our currently selected slot
_select_item(selected_item) _select_item(selected_item)
func update_slot(index: int, new_item: ItemData) -> void:
inventory[index] = new_item
# Tell the in-game HUD that the slot changed
if new_item != null:
add_item.emit(index, new_item)
else:
remove_item.emit(index)
# If this is the slot the player is currently holding, update the 3D hand mesh!
if index == selected_item:
_select_item(selected_item)
func _drop_item(index: int = selected_item): func _drop_item(index: int = selected_item):
var item_data = inventory[index] var item_data = inventory[index]
if item_data != null and item_data.scene_path != "": if item_data != null and item_data.scene_path != "":
# 1. Load the original scene file for the item
var packed_scene = load(item_data.scene_path) as PackedScene var packed_scene = load(item_data.scene_path) as PackedScene
if not packed_scene: if not packed_scene:
push_error("Could not load scene path: " + item_data.scene_path) push_error("Could not load scene path: " + item_data.scene_path)
return return
# 2. Instantiate a brand new physical object
var new_object = packed_scene.instantiate() as RigidBody3D var new_object = packed_scene.instantiate() as RigidBody3D
# 3. Add it to the world (Parent it to the main scene, not the player!)
get_tree().current_scene.add_child(new_object) get_tree().current_scene.add_child(new_object)
# 4. Place it in front of the player
new_object.global_position = hold_position.global_position new_object.global_position = hold_position.global_position
new_object.global_rotation = Vector3.ZERO new_object.global_rotation = Vector3.ZERO
# 5. Clear the inventory slot
_remove_item(index) _remove_item(index)
func _remove_item(index: int):
remove_item.emit(index)
inventory[index] = null
_select_item(selected_item) # Refresh the hand model
func get_selected_item() -> ItemData: func get_selected_item() -> ItemData:
return inventory[selected_item] return inventory[selected_item]
func _ready() -> void: func _ready() -> void:
get_tree().create_timer(0.1).timeout.connect(func(): _select_item(0)) get_tree().create_timer(0.1).timeout.connect(func(): _select_item(0))
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
if Console.toggled or UiManager.in_game_menu.visible: if Console.toggled or UiManager.in_game_menu.visible:
return return
@ -242,16 +172,170 @@ func _process(_delta: float) -> void:
if Input.is_action_just_pressed("select_item_4"): _select_item(3) if Input.is_action_just_pressed("select_item_4"): _select_item(3)
if Input.is_action_just_pressed("select_item_5"): _select_item(4) if Input.is_action_just_pressed("select_item_5"): _select_item(4)
if Input.is_action_just_pressed("use"): if Input.is_action_just_pressed("equip"):
if cursor_raycast.is_colliding(): if cursor_raycast.is_colliding():
var hit_object = cursor_raycast.get_collider() var hit_object = cursor_raycast.get_collider()
if hit_object is PickupableItem: if hit_object is EquippableItem:
_add_item(hit_object) _add_item(hit_object)
elif hit_object is Button3D:
hit_object.press()
else:
if inventory[selected_item] != null:
use_active_item()
if Input.is_action_just_pressed("drop"): if Input.is_action_just_pressed("drop"):
_drop_item() _drop_item()
#class_name HotbarComponent extends Node
#
#var selected_item: int = 0
#var prev_selected_item: int = 0
#var selected_item_object: EquippableItem = null
#var inventory: Array[ItemData] = [null,null]
#
#@export var equipped_item_mesh: MeshInstance3D
#@export var hold_position: Marker3D
#@export var cursor_raycast: RayCast3D
#
#signal added_inventory_slot(successful:bool)
#signal removed_inventory_slot(successful:bool)
#signal select_item(index: int)
#
##for ui elements
#signal add_item(index: int, item: ItemData)
#signal remove_item(index: int)
#
#func add_inventory_slot() -> bool:
#if len(inventory) < 5:
#inventory.append(null)
#added_inventory_slot.emit(true)
#return true
#added_inventory_slot.emit(false)
#return false
#
#func remove_inventory_slot() -> bool:
#if len(inventory) > 2:
#inventory.remove_at(len(inventory) - 1)
#removed_inventory_slot.emit(true)
#return true
#added_inventory_slot.emit(false)
#return false
#
#func next_item():
#prev_selected_item = selected_item
#if selected_item + 1 > len(inventory) - 1:
#selected_item = 0
#else:
#selected_item += 1
#_select_item()
#
#func prev_item():
#prev_selected_item = selected_item
#if selected_item - 1 < 0:
#selected_item = len(inventory) - 1
#else:
#selected_item -= 1
#_select_item()
#
#func _select_item(index:int = selected_item):
#if index >= 0 and index < len(inventory):
#select_item.emit(index)
#
#if inventory[index] == null:
##if current index is empty in the inventory, replace held object with placeholder (empty mesh)
#equipped_item_mesh.mesh = PlaceholderMesh.new()
#else:
#var mesh = null
#for i in inventory[index].get_children():
#if i is MeshInstance3D:
#equipped_item_mesh.mesh = i.mesh
#
#func _add_item(item: EquippableItem):
##add item to current equipped slot if empty
#
#var new_item_data = ItemData.new()
#new_item_data.name = item.name
#new_item_data.weight = item.weight
#new_item_data.scene_path = item.scene_file_path
#new_item_data.ui_icon = await GrabbableBase.create_icon_from_mesh(item.mesh.mesh)
#if inventory[selected_item] == null:
#inventory[selected_item] = new_item_data
#
#add_item.emit(selected_item, new_item_data)
#
##ui.add_item(selected_item, item)
#item.reparent(get_parent().get_parent())
#item.collision_layer = 0
#item.visible = false
#_select_item(selected_item)
#return
#
##add item to first empty slot if currently equipped slot is full
#for i in range(0, len(inventory)):
#if inventory[i] == null:
#inventory[i] = new_item_data
#
#add_item.emit(i, new_item_data)
##ui.add_item(i, item)
#item.reparent(get_parent().get_parent())
#item.collision_layer = 0
#item.visible = false
#return
#
##dont equip item if inventory full
#
#func _drop_item(index: int = selected_item):
#if inventory[index] != null:
#var object = inventory[index]
#
#object.scale = Vector3.ONE
#
#if object.is_inside_tree():
#object.reparent(get_tree().current_scene, true)
#
#object.collision_layer = 17
#object.global_position = hold_position.global_position
#object.visible = true
#object.global_rotation = Vector3.ZERO
#
#_remove_item(index)
#
#func _remove_item(index: int):
##ui.remove_item(index)
#remove_item.emit(index)
#inventory[index] = null
#_select_item(index)
#
#func get_selected_item() -> ItemData:
#return inventory[selected_item]
#
#func _ready() -> void:
#get_tree().create_timer(0.1).timeout.connect(func (): _select_item(0))
#
#func _process(_delta: float) -> void:
#if not Console.toggled and not UiManager.in_game_menu.visible:
#if Input.is_action_just_pressed("next_item"):
#next_item()
#
#if Input.is_action_just_pressed("prev_item"):
#prev_item()
#
#if Input.is_action_just_pressed("select_item_1"):
#_select_item(0)
#
#if Input.is_action_just_pressed("select_item_2"):
#_select_item(1)
#
#if Input.is_action_just_pressed("select_item_3"):
#_select_item(2)
#
#if Input.is_action_just_pressed("select_item_4"):
#_select_item(3)
#
#if Input.is_action_just_pressed("select_item_5"):
#_select_item(4)
#
#if Input.is_action_just_pressed("equip"):
#if cursor_raycast.is_colliding():
#var hit_object = cursor_raycast.get_collider()
#
#if hit_object is EquippableItem:
#_add_item(hit_object)
#
#if Input.is_action_just_pressed("drop"):
#_drop_item()

View file

@ -50,7 +50,7 @@ func _process(_delta: float) -> void:
if cursor_raycast.is_colliding(): if cursor_raycast.is_colliding():
var hit_object = cursor_raycast.get_collider() var hit_object = cursor_raycast.get_collider()
if hit_object is RigidBody3D and hit_object.is_in_group("grabbable") or hit_object.is_in_group("pickupable") or hit_object.is_in_group("equippable"): if hit_object is RigidBody3D and hit_object.is_in_group("grabbable") or hit_object.is_in_group("equippable"):
held_object = hit_object held_object = hit_object
held_object.gravity_scale = 0.0 held_object.gravity_scale = 0.0
held_object.angular_damp = 5.0 held_object.angular_damp = 5.0

View file

@ -6,24 +6,13 @@ var toggled: bool = false
signal toggle(toggle: bool) signal toggle(toggle: bool)
func _process(delta: float) -> void: func _process(delta: float) -> void:
if not Console.toggled: if Input.is_action_just_pressed("open_inventory"):
if Input.is_action_just_pressed("open_inventory"): if toggled:
if toggled: print("toggle off")
print("toggle off") UiManager.toggle_inventory_menu(false)
toggle.emit(false) toggle.emit(false)
else: else:
print("toggle on") print("toggle on")
toggle.emit(true) UiManager.toggle_inventory_menu(true)
toggled = !toggled toggle.emit(true)
toggled = !toggled
#func _process(delta: float) -> void:
#if Input.is_action_just_pressed("open_inventory"):
#if toggled:
#print("toggle off")
#UiManager.toggle_inventory_menu(false)
#toggle.emit(false)
#else:
#print("toggle on")
#UiManager.toggle_inventory_menu(true)
#toggle.emit(true)
#toggled = !toggled

View file

@ -1,145 +1,3 @@
#class_name MovementComponent extends Node
#
#@export var camera_pivot: Node3D
#@export var player_hit_box: CollisionShape3D
#@export var player: Player
#
#signal jumped
#signal landed(speed: float)
#signal state_changed(state: String)
#
#var mouse_motion: Vector2 = Vector2.ZERO
#var mouse_motion_delta: Vector2 = Vector2.ZERO
#var crouched: bool = false
#var runs: bool = false
#var walks: bool = false
#
#var _player_spawned: bool = false
#var _current_state: String = "idle"
#var _move_toggled: bool = false
#
## CACHE: Fetching Scene Unique Nodes (%) every frame is slightly expensive.
## Cache it once when the node loads.
#@onready var noclip_component: Node = %Noclip
#
#func _ready() -> void:
#Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
#get_tree().create_timer(0.5).timeout.connect(func(): _player_spawned = true)
#
#func _input(event: InputEvent) -> void:
## EARLY EXIT: Check the fastest conditions first to save CPU cycles
#if Input.get_mouse_mode() != Input.MOUSE_MODE_CAPTURED:
#return
#
#if event is InputEventMouseMotion and not UiManager.in_game_menu.visible:
## Anti-yank threshold
#if event.relative.length() > 400:
#return
#
#mouse_motion += event.relative
#mouse_motion_delta = event.relative
#
#func toggle_movement():
#_move_toggled = !_move_toggled
#if _move_toggled:
#Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
#else:
#Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
#
#func handle_joypad_movement():
#var controller_look = Input.get_vector("look_left", "look_right", "look_up", "look_down") * 50.0
#if controller_look != Vector2.ZERO:
#mouse_motion += controller_look
#mouse_motion_delta += controller_look
#
#func head_movement(delta: float) -> void:
## 1. Gather all inputs FIRST
#handle_joypad_movement()
#
## 2. Clamp the Y motion BEFORE applying it to rotation (Fixes 1-frame camera jitter)
#mouse_motion.y = clampf(mouse_motion.y, -1560.0, 1560.0)
#
## 3. Apply rotations based on the finalized inputs
#player.rotation.y = lerp_angle(player.rotation.y, mouse_motion.x * -0.001 * PlayerConsts.LOOK_SENSITIVITY, delta * 30.0)
#
#var target_pitch = mouse_motion.y * -0.001 * PlayerConsts.LOOK_SENSITIVITY
#camera_pivot.rotation.x = lerp_angle(camera_pivot.rotation.x, target_pitch, delta * 30.0)
#
#func _physics_process(delta: float) -> void:
#head_movement(delta)
#
#if Console.toggled or UiManager.in_game_menu.visible or UiManager.inventory_menu.visible:
## Use move_toward for stopping. lerpf() never truly reaches 0, which
## leaves tiny float decimals calculating forever.
#player.velocity.x = move_toward(player.velocity.x, 0.0, delta * 100.0)
#player.velocity.z = move_toward(player.velocity.z, 0.0, delta * 100.0)
#player.move_and_slide()
#return
#
#if noclip_component.is_noclip:
#noclip_component._process_noclip_movement(delta)
#return
#
#var was_on_floor: bool = player.is_on_floor()
#var fall_velocity: float = player.velocity.y
#
#if not was_on_floor:
#player.velocity += player.get_gravity() * delta
#
#var input_dir := Vector2.ZERO
#if not _move_toggled:
#input_dir = Input.get_vector("left", "right", "forward", "backward")
#
#var target_speed = PlayerConsts.SPEED
#var new_state := "idle"
#var is_moving := input_dir != Vector2.ZERO
#
#if Input.is_action_pressed("crouch"):
#target_speed *= PlayerConsts.CROUCH_SPEED_MULTIPLIER
#new_state = "crouching"
#player_hit_box.shape.height = lerpf(player_hit_box.shape.height, 0.5, delta * 3.0)
#else:
#player_hit_box.shape.height = lerpf(player_hit_box.shape.height, 2.0, delta * 3.0)
#
#if is_moving:
#if Input.is_action_pressed("sprint") and player.stamina_component.stamina > 0:
#target_speed *= PlayerConsts.SPRINT_MULTIPLIER
#new_state = "running"
#else:
#new_state = "walking"
#
#if new_state != _current_state:
#_current_state = new_state
#state_changed.emit(new_state)
#
#if Input.is_action_just_pressed("jump") and was_on_floor and player.stamina_component.stamina > PlayerConsts.JUMP_STAMINA_COST:
#player.velocity.y += PlayerConsts.JUMP_VELOCITY
#jumped.emit()
#
## Calculate horizontal velocity
#var direction = (player.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
#var accel_rate = 6.0 if is_moving else 9.0
#
## Vectorize the lerp for cleaner math
#var h_vel = Vector2(player.velocity.x, player.velocity.z)
#var target_h_vel = Vector2(direction.x, direction.z) * target_speed
#h_vel = h_vel.lerp(target_h_vel, delta * accel_rate)
#
#player.velocity.x = h_vel.x
#player.velocity.z = h_vel.y
#
## Leaning
#var lean_dir = -Input.get_axis("lean_left", "lean_right") * 0.1
#camera_pivot.rotation.z = lerpf(camera_pivot.rotation.z, lean_dir, delta * 10.0)
#
#var target_lean_pos = -lean_dir * 5.0
#camera_pivot.position.x = lerpf(camera_pivot.position.x, target_lean_pos, delta * 7.0)
#
#player.move_and_slide()
#
#if not was_on_floor and player.is_on_floor() and _player_spawned:
#landed.emit(fall_velocity)
class_name MovementComponent extends Node class_name MovementComponent extends Node
@export var camera_pivot: Node3D @export var camera_pivot: Node3D
@ -165,7 +23,7 @@ func handle_joypad_movement():
if controller_look_vector.length() > 0: if controller_look_vector.length() > 0:
mouse_motion += controller_look_vector mouse_motion += controller_look_vector
mouse_motion_delta = controller_look_vector mouse_motion_delta += controller_look_vector
func toggle_movement(): func toggle_movement():
_move_toggled = !_move_toggled _move_toggled = !_move_toggled
@ -178,6 +36,10 @@ func _input(event: InputEvent) -> void:
if not UiManager.in_game_menu.visible: if not UiManager.in_game_menu.visible:
if event is InputEventMouseMotion: if event is InputEventMouseMotion:
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED: if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
#so it doesnt yank
if event.relative.length() > 400:
return
mouse_motion += event.relative mouse_motion += event.relative
mouse_motion_delta = event.relative mouse_motion_delta = event.relative
@ -185,29 +47,22 @@ func _ready() -> void:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
get_tree().create_timer(0.5).timeout.connect(func(): _player_spawned = true) get_tree().create_timer(0.5).timeout.connect(func(): _player_spawned = true)
func head_movement(delta:float) -> void:
player.rotation.y = lerp_angle(player.rotation.y, mouse_motion.x * -0.001 * PlayerConsts.LOOK_SENSITIVITY, delta * 30)
var target_pitch = mouse_motion.y * -0.001 * PlayerConsts.LOOK_SENSITIVITY
camera_pivot.rotation.x = lerp_angle(camera_pivot.rotation.x, target_pitch, delta * 30)
handle_joypad_movement()
func _physics_process(delta: float) -> void: func _physics_process(delta: float) -> void:
head_movement(delta)
if Console.toggled or UiManager.in_game_menu.visible or UiManager.inventory_menu.visible: if Console.toggled or UiManager.in_game_menu.visible or UiManager.inventory_menu.visible:
player.velocity.x = lerpf(player.velocity.x, 0, delta * 10) player.velocity.x = lerpf(player.velocity.x, 0, delta * 10)
player.velocity.z = lerpf(player.velocity.z, 0, delta * 10) player.velocity.z = lerpf(player.velocity.z, 0, delta * 10)
player.move_and_slide() player.move_and_slide()
return return
if %Noclip.is_noclip:
%Noclip._process_noclip_movement(delta)
return
mouse_motion.y = clamp(mouse_motion.y, -1560, 1560) mouse_motion.y = clamp(mouse_motion.y, -1560, 1560)
player.rotation.y = lerp_angle(player.rotation.y, mouse_motion.x * -0.001 * PlayerConsts.LOOK_SENSITIVITY, delta * 30)
var target_pitch = mouse_motion.y * -0.001 * PlayerConsts.LOOK_SENSITIVITY
camera_pivot.rotation.x = lerp_angle(camera_pivot.rotation.x, target_pitch, delta * 30)
handle_joypad_movement()
var was_on_floor: bool = player.is_on_floor() var was_on_floor: bool = player.is_on_floor()
var fall_velocity: float = player.velocity.y var fall_velocity: float = player.velocity.y

View file

@ -1,48 +0,0 @@
extends Node
@export_group("Noclip")
@export var noclip_speed: float = 15.0
@export var noclip_sprint_multiplier: float = 3.0
var is_noclip: bool = false
# Make sure these paths match your actual node setup!
@export var head_camera: Camera3D
@export var player_hitbox: CollisionShape3D
@export var player: Player
func toggle():
is_noclip = !is_noclip
# Disable physics collision so you pass through walls
player_hitbox.disabled = is_noclip
# Reset velocity so you don't carry momentum when toggling it on/off
player.velocity = Vector3.ZERO
print("Noclip: ", "ON" if is_noclip else "OFF")
func _process_noclip_movement(_delta: float) -> void:
var input_dir = Input.get_vector("left", "right", "forward", "backward")
# Optional: Add keys to fly straight up and down (like Space and Ctrl)
var vertical_input = Input.get_axis("crouch", "jump")
# Calculate direction based on the CAMERA'S rotation, not the body's!
var cam_basis = head_camera.global_transform.basis
var direction = (cam_basis * Vector3(input_dir.x, vertical_input, input_dir.y)).normalized()
# Calculate speed (allow sprinting while flying)
var current_speed = noclip_speed
if Input.is_action_pressed("sprint"):
current_speed *= noclip_sprint_multiplier
# Apply movement instantly (no friction/acceleration smoothing)
if direction != Vector3.ZERO:
player.velocity = direction * current_speed
else:
player.velocity = Vector3.ZERO
# move_and_slide() still works perfectly!
# Because collision_shape is disabled, it will just glide through everything.
player.move_and_slide()

View file

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

View file

@ -19,9 +19,6 @@ class_name Player extends CharacterBody3D
static var player: Player static var player: Player
func toggle_noclip():
%Noclip.toggle()
func _ready() -> void: func _ready() -> void:
Console.context["player"] = self Console.context["player"] = self
GameState.player = self GameState.player = self
@ -68,18 +65,13 @@ func _ready() -> void:
stamina_component.run(false)) stamina_component.run(false))
movement_component.state_changed.connect(player_state.handle_state_change) movement_component.state_changed.connect(player_state.handle_state_change)
#SignalSniffer.watch(stamina_component)
#SignalSniffer.watch(flashlight_component)
#SignalSniffer.watch(hotbar_component)
#SignalSniffer.watch(movement_component)
#SignalSniffer.watch(input_controller)
#SignalSniffer.watch(procedural_animator)
#SignalSniffer.watch(sound_controller)
#SignalSniffer.watch(player_state)
#SignalSniffer.watch(inventory_component)
#temporary so i can prototype #temporary so i can prototype
func _process(delta: float) -> void: func _process(delta: float) -> void:
if Input.is_action_just_pressed("open_inventory"): if Input.is_action_just_pressed("open_inventory"):
UiManager.toggle_inventory_menu(equipped_backpack, hotbar_component) if UiManager.inventory_menu.visible:
UiManager.toggle_inventory_menu(false)
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
else:
UiManager.toggle_inventory_menu(true)
UiManager.inventory_menu.open_inventory(equipped_backpack, hotbar_component)
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE

View file

@ -5,17 +5,15 @@
[ext_resource type="Script" uid="uid://2mpqfiofksnu" path="res://entities/player/hotbar_component.gd" id="10_ugbui"] [ext_resource type="Script" uid="uid://2mpqfiofksnu" path="res://entities/player/hotbar_component.gd" id="10_ugbui"]
[ext_resource type="Script" uid="uid://c32j8acbe3myf" path="res://entities/player/inventory_component.gd" id="11_b2kln"] [ext_resource type="Script" uid="uid://c32j8acbe3myf" path="res://entities/player/inventory_component.gd" id="11_b2kln"]
[ext_resource type="Script" uid="uid://dntoi54g4hqce" path="res://entities/player/flashlight_component.gd" id="11_myrg7"] [ext_resource type="Script" uid="uid://dntoi54g4hqce" path="res://entities/player/flashlight_component.gd" id="11_myrg7"]
[ext_resource type="Script" uid="uid://bk20reld17wlp" path="res://entities/player/noclip.gd" id="12_b2kln"]
[ext_resource type="Script" uid="uid://cdfis3askl3gb" path="res://entities/player/stamina_component.gd" id="12_kvlxm"] [ext_resource type="Script" uid="uid://cdfis3askl3gb" path="res://entities/player/stamina_component.gd" id="12_kvlxm"]
[ext_resource type="PackedScene" uid="uid://bmqm4andgetsd" path="res://entities/backpack/backpack_base.tscn" id="13_b2kln"] [ext_resource type="PackedScene" uid="uid://bmqm4andgetsd" path="res://entities/backpack/backpack_base.tscn" id="13_b2kln"]
[ext_resource type="PackedScene" uid="uid://c02fkimxlbrje" path="res://entities/player/prompt.tscn" id="13_ugbui"] [ext_resource type="PackedScene" uid="uid://c02fkimxlbrje" path="res://entities/player/prompt.tscn" id="13_ugbui"]
[ext_resource type="Script" uid="uid://v7j6ovrub5cp" path="res://scenes/changable_sound_emitter.gd" id="13_we0b7"]
[ext_resource type="PackedScene" uid="uid://blh2biuk44qqj" path="res://entities/player/cursor.tscn" id="14_fcs02"] [ext_resource type="PackedScene" uid="uid://blh2biuk44qqj" path="res://entities/player/cursor.tscn" id="14_fcs02"]
[ext_resource type="AudioStream" uid="uid://0q6nhlhgnxu2" path="res://assets/sounds/whitenoise.mp3" id="14_ugbui"] [ext_resource type="AudioStream" uid="uid://0q6nhlhgnxu2" path="res://assets/sounds/whitenoise.mp3" id="14_ugbui"]
[ext_resource type="Script" uid="uid://bjpmu5sklv5h8" path="res://addons/raytraced_audio/raytraced_audio_listener.gd" id="14_we0b7"]
[ext_resource type="Script" uid="uid://dr2lwciaohf6f" path="res://entities/player/movement_component.gd" id="60_s3g0c"] [ext_resource type="Script" uid="uid://dr2lwciaohf6f" path="res://entities/player/movement_component.gd" id="60_s3g0c"]
[ext_resource type="Script" uid="uid://cjk6a0da11ge6" path="res://entities/player/procedural_animator.gd" id="61_hggc2"] [ext_resource type="Script" uid="uid://cjk6a0da11ge6" path="res://entities/player/procedural_animator.gd" id="61_hggc2"]
[ext_resource type="Script" uid="uid://v8er7yn0hdh8" path="res://entities/player/sound_controller_component.gd" id="62_b2j0d"] [ext_resource type="Script" uid="uid://v8er7yn0hdh8" path="res://entities/player/sound_controller_component.gd" id="62_b2j0d"]
[ext_resource type="Script" uid="uid://y8x4svl5kej2" path="res://addons/spatial_audio_3d/spatial_audio_3d.gd" id="62_jbx34"]
[ext_resource type="Script" uid="uid://7aa26wi66kqq" path="res://entities/player/prompt_handler.gd" id="63_7l6ig"] [ext_resource type="Script" uid="uid://7aa26wi66kqq" path="res://entities/player/prompt_handler.gd" id="63_7l6ig"]
[ext_resource type="Script" uid="uid://bvvwwkswavy5x" path="res://entities/player/input_controller_component.gd" id="64_j3r50"] [ext_resource type="Script" uid="uid://bvvwwkswavy5x" path="res://entities/player/input_controller_component.gd" id="64_j3r50"]
[ext_resource type="Script" uid="uid://7hmwhf7acwpj" path="res://entities/player/state_handler_component.gd" id="65_kssj8"] [ext_resource type="Script" uid="uid://7hmwhf7acwpj" path="res://entities/player/state_handler_component.gd" id="65_kssj8"]
@ -23,6 +21,11 @@
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_g4v7s"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_g4v7s"]
radius = 0.6166992 radius = 0.6166992
[sub_resource type="PlaceholderMesh" id="PlaceholderMesh_b5l5s"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_g4v7s"]
radius = 0.04638672
[sub_resource type="CapsuleMesh" id="CapsuleMesh_b5l5s"] [sub_resource type="CapsuleMesh" id="CapsuleMesh_b5l5s"]
[node name="Player" type="CharacterBody3D" unique_id=423228143 node_paths=PackedStringArray("stamina_component", "flashlight_component", "hotbar_component", "movement_component", "input_controller", "procedural_animator", "sound_controller", "player_state", "inventory_component", "equipped_backpack") groups=["player"]] [node name="Player" type="CharacterBody3D" unique_id=423228143 node_paths=PackedStringArray("stamina_component", "flashlight_component", "hotbar_component", "movement_component", "input_controller", "procedural_animator", "sound_controller", "player_state", "inventory_component", "equipped_backpack") groups=["player"]]
@ -69,12 +72,11 @@ head = NodePath("../../CameraPivot/Head")
head_texture = NodePath("../../CameraPivot/Head/HeadTexture") head_texture = NodePath("../../CameraPivot/Head/HeadTexture")
wind = NodePath("../../SoundEmitters/Wind") wind = NodePath("../../SoundEmitters/Wind")
[node name="PromptHandler" type="Node" parent="Components" unique_id=1264775993 node_paths=PackedStringArray("prompt", "player", "grabbable_finder")] [node name="PromptHandler" type="Node" parent="Components" unique_id=1264775993 node_paths=PackedStringArray("prompt", "player")]
unique_name_in_owner = true unique_name_in_owner = true
script = ExtResource("63_7l6ig") script = ExtResource("63_7l6ig")
prompt = NodePath("../../Prompt") prompt = NodePath("../../Prompt")
player = NodePath("../..") player = NodePath("../..")
grabbable_finder = NodePath("../../CameraPivot/PlayerCamera/GrabbableFinder")
[node name="InputController" type="Node" parent="Components" unique_id=1680856401 node_paths=PackedStringArray("cursor_raycast", "prompt", "player", "hold_position")] [node name="InputController" type="Node" parent="Components" unique_id=1680856401 node_paths=PackedStringArray("cursor_raycast", "prompt", "player", "hold_position")]
unique_name_in_owner = true unique_name_in_owner = true
@ -89,10 +91,10 @@ unique_name_in_owner = true
script = ExtResource("65_kssj8") script = ExtResource("65_kssj8")
player = NodePath("../..") player = NodePath("../..")
[node name="HotbarComponent" type="Node" parent="Components" unique_id=1980833408 node_paths=PackedStringArray("equipped_item_position", "hold_position", "cursor_raycast")] [node name="HotbarComponent" type="Node" parent="Components" unique_id=1980833408 node_paths=PackedStringArray("equipped_item_mesh", "hold_position", "cursor_raycast")]
unique_name_in_owner = true unique_name_in_owner = true
script = ExtResource("10_ugbui") script = ExtResource("10_ugbui")
equipped_item_position = NodePath("../../CameraPivot/PlayerCamera/CurrentItemPosition") equipped_item_mesh = NodePath("../../CameraPivot/PlayerCamera/EquippedItemMesh")
hold_position = NodePath("../../CameraPivot/PlayerCamera/HoldPosition") hold_position = NodePath("../../CameraPivot/PlayerCamera/HoldPosition")
cursor_raycast = NodePath("../../CameraPivot/PlayerCamera/CursorRaycast") cursor_raycast = NodePath("../../CameraPivot/PlayerCamera/CursorRaycast")
@ -109,37 +111,25 @@ script = ExtResource("12_kvlxm")
unique_name_in_owner = true unique_name_in_owner = true
script = ExtResource("11_b2kln") script = ExtResource("11_b2kln")
[node name="DevComponents" type="Node" parent="Components" unique_id=382197235]
[node name="Noclip" type="Node" parent="Components/DevComponents" unique_id=1210144577 node_paths=PackedStringArray("head_camera", "player_hitbox", "player")]
unique_name_in_owner = true
script = ExtResource("12_b2kln")
head_camera = NodePath("../../../CameraPivot/PlayerCamera")
player_hitbox = NodePath("../../../PlayerHitBox")
player = NodePath("../../..")
[node name="PlayerHitBox" type="CollisionShape3D" parent="." unique_id=1513955228] [node name="PlayerHitBox" type="CollisionShape3D" parent="." unique_id=1513955228]
shape = SubResource("CapsuleShape3D_g4v7s") shape = SubResource("CapsuleShape3D_g4v7s")
[node name="CameraPivot" type="Node3D" parent="." unique_id=963377832] [node name="CameraPivot" type="Node3D" parent="." unique_id=963377832]
unique_name_in_owner = true unique_name_in_owner = true
[node name="Head" type="AudioStreamPlayer3D" parent="CameraPivot" unique_id=824331652] [node name="Head" type="AudioStreamPlayer3D" parent="CameraPivot" unique_id=799817251]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.6971706, -0.42015946) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.53598464, 0)
panning_strength = 0.0 script = ExtResource("62_jbx34")
area_mask = 1 reverb_volume_db = -12.0
script = ExtResource("13_we0b7") reverb_fadeintime = -1.0
easy_audio = false reverb_fadeouttime = -1.0
metadata/_custom_type_script = "uid://v7j6ovrub5cp" metadata/_custom_type_script = "uid://y8x4svl5kej2"
[node name="HeadTexture" type="AudioStreamPlayer3D" parent="CameraPivot/Head" unique_id=2073564595] [node name="HeadTexture" type="AudioStreamPlayer3D" parent="CameraPivot/Head" unique_id=732916843]
unique_name_in_owner = true unique_name_in_owner = true
panning_strength = 0.0 script = ExtResource("62_jbx34")
area_mask = 1 metadata/_custom_type_script = "uid://y8x4svl5kej2"
script = ExtResource("13_we0b7")
easy_audio = false
metadata/_custom_type_script = "uid://v7j6ovrub5cp"
[node name="PlayerCamera" type="Camera3D" parent="CameraPivot" unique_id=303347613] [node name="PlayerCamera" type="Camera3D" parent="CameraPivot" unique_id=303347613]
unique_name_in_owner = true unique_name_in_owner = true
@ -165,13 +155,16 @@ target_position = Vector3(0, -2, 0)
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.5) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.5)
[node name="CurrentItemPosition" type="Marker3D" parent="CameraPivot/PlayerCamera" unique_id=1900704334] [node name="EquippedItemMesh" type="MeshInstance3D" parent="CameraPivot/PlayerCamera" unique_id=825894473]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0.4, -0.30000004, -0.7) transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0.4, -0.30000004, -0.7)
mesh = SubResource("PlaceholderMesh_b5l5s")
[node name="GrabbableFinder" type="RayCast3D" parent="CameraPivot/PlayerCamera" unique_id=1419402232] [node name="GrabbableFinder" type="Area3D" parent="CameraPivot/PlayerCamera" unique_id=988433915]
unique_name_in_owner = true
target_position = Vector3(0, 0, -2) [node name="GrabbableFinderShape" type="CollisionShape3D" parent="CameraPivot/PlayerCamera/GrabbableFinder" unique_id=1432103460]
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] [node name="PlayerAmbiantLight" type="OmniLight3D" parent="CameraPivot/PlayerCamera" unique_id=450850774]
light_energy = 0.1 light_energy = 0.1
@ -181,23 +174,15 @@ omni_attenuation = 0.5
[node name="PlayerListener" type="AudioListener3D" parent="CameraPivot" unique_id=1468948553] [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) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.7621309, 0)
doppler_tracking = 2 doppler_tracking = 2
[node name="RaytracedAudioListener" type="AudioListener3D" parent="CameraPivot/PlayerListener" unique_id=154629324]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.45788532, 0)
doppler_tracking = 2
current = true current = true
script = ExtResource("14_we0b7")
muffle_interpolation = 0.04
echo_room_size_multiplier = 3.0
ambient_pan_interpolation = 0.22
ambient_volume_interpolation = 0.1
ambient_volume_attenuation = 1.0
metadata/_custom_type_script = "uid://bjpmu5sklv5h8"
[node name="MeshInstance3D" type="MeshInstance3D" parent="CameraPivot" unique_id=539906244] [node name="MeshInstance3D" type="MeshInstance3D" parent="CameraPivot" unique_id=539906244]
mesh = SubResource("CapsuleMesh_b5l5s") mesh = SubResource("CapsuleMesh_b5l5s")
[node name="BackpackBase" parent="CameraPivot/MeshInstance3D" unique_id=1120864530 instance=ExtResource("13_b2kln")] [node name="BackpackBase" parent="CameraPivot/MeshInstance3D" unique_id=1120864530 instance=ExtResource("13_b2kln")]
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.18192899, 0.7772218)
inventory_size = 5
[node name="Prompt" parent="." unique_id=318901794 instance=ExtResource("13_ugbui")] [node name="Prompt" parent="." unique_id=318901794 instance=ExtResource("13_ugbui")]
unique_name_in_owner = true unique_name_in_owner = true
@ -251,38 +236,45 @@ one_shot = true
[node name="SoundEmitters" type="Node3D" parent="." unique_id=661429541] [node name="SoundEmitters" type="Node3D" parent="." unique_id=661429541]
[node name="LeftFoot" type="AudioStreamPlayer3D" parent="SoundEmitters" unique_id=166056711] [node name="LeftFoot" type="AudioStreamPlayer3D" parent="SoundEmitters" unique_id=575461780]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.8749303, 0.24958718, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.43042383, -0.90646136, 0)
area_mask = 1 script = ExtResource("62_jbx34")
script = ExtResource("13_we0b7") reverb_volume_db = -12.0
easy_audio = false reverb_fadeintime = -1.0
metadata/_custom_type_script = "uid://v7j6ovrub5cp" reverb_fadeouttime = -1.0
metadata/_custom_type_script = "uid://y8x4svl5kej2"
[node name="LeftFootTexture" type="AudioStreamPlayer3D" parent="SoundEmitters/LeftFoot" unique_id=412267863] [node name="LeftFootTexture" type="AudioStreamPlayer3D" parent="SoundEmitters/LeftFoot" unique_id=1541799094]
unique_name_in_owner = true unique_name_in_owner = true
area_mask = 1 script = ExtResource("62_jbx34")
script = ExtResource("13_we0b7") reverb_volume_db = -12.0
easy_audio = false reverb_fadeintime = -1.0
metadata/_custom_type_script = "uid://v7j6ovrub5cp" reverb_fadeouttime = -1.0
metadata/_custom_type_script = "uid://y8x4svl5kej2"
[node name="RightFoot" type="AudioStreamPlayer3D" parent="SoundEmitters" unique_id=1825432395] [node name="RightFoot" type="AudioStreamPlayer3D" parent="SoundEmitters" unique_id=1964632523]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.7457278, 0.24676013, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.3428033, -0.8860581, 0)
area_mask = 1 script = ExtResource("62_jbx34")
script = ExtResource("13_we0b7") reverb_volume_db = -12.0
easy_audio = false reverb_fadeintime = -1.0
metadata/_custom_type_script = "uid://v7j6ovrub5cp" reverb_fadeouttime = -1.0
metadata/_custom_type_script = "uid://y8x4svl5kej2"
[node name="RightFootTexture" type="AudioStreamPlayer3D" parent="SoundEmitters/RightFoot" unique_id=332096966] [node name="RightFootTexture" type="AudioStreamPlayer3D" parent="SoundEmitters/RightFoot" unique_id=370583799]
unique_name_in_owner = true unique_name_in_owner = true
area_mask = 1 script = ExtResource("62_jbx34")
script = ExtResource("13_we0b7") reverb_volume_db = -12.0
easy_audio = false reverb_fadeintime = -1.0
metadata/_custom_type_script = "uid://v7j6ovrub5cp" reverb_fadeouttime = -1.0
metadata/_custom_type_script = "uid://y8x4svl5kej2"
[node name="Wind" type="AudioStreamPlayer3D" parent="SoundEmitters" unique_id=1950929206] [node name="Wind" type="AudioStreamPlayer3D" parent="SoundEmitters" unique_id=1950929206]
unique_name_in_owner = true unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.7, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.7, 0)
stream = ExtResource("14_ugbui") stream = ExtResource("14_ugbui")
bus = &"wind" bus = &"wind"
[connection signal="body_entered" from="CameraPivot/PlayerCamera/GrabbableFinder" to="Components/PromptHandler" method="_on_action_finder_body_entered"]
[connection signal="body_exited" from="CameraPivot/PlayerCamera/GrabbableFinder" to="Components/PromptHandler" method="_on_action_finder_body_exited"]

View file

@ -61,7 +61,7 @@ func ui_movement_handling(delta: float, cam_local_vel: Vector3):
if Console.toggled: if Console.toggled:
return return
var mouse_offset = -(movement.mouse_motion_delta * .005 / delta) * PlayerConsts.UI_MOVEMENT_SENSITIVITY var mouse_offset = -movement.mouse_motion_delta * PlayerConsts.UI_MOVEMENT_SENSITIVITY
_smoothed_mouse_offset = _smoothed_mouse_offset.lerp(mouse_offset, 1.0 - exp(-15.0 * delta)) _smoothed_mouse_offset = _smoothed_mouse_offset.lerp(mouse_offset, 1.0 - exp(-15.0 * delta))
@ -73,7 +73,7 @@ func ui_movement_handling(delta: float, cam_local_vel: Vector3):
cam_local_vel.y cam_local_vel.y
) * PlayerConsts.CAMERA_VELOCITY_MULTIPLIER ) * PlayerConsts.CAMERA_VELOCITY_MULTIPLIER
var camera_velocity = (camera.position - _last_camera_position) var camera_velocity = (camera.position - _last_camera_position) / delta
var bob_offset: Vector2 = Vector2(-camera_velocity.x, camera_velocity.y) var bob_offset: Vector2 = Vector2(-camera_velocity.x, camera_velocity.y)
@ -82,7 +82,7 @@ func ui_movement_handling(delta: float, cam_local_vel: Vector3):
ui.position = ui.position.lerp(ui_base_position + target_offset, weighted_lerp) ui.position = ui.position.lerp(ui_base_position + target_offset, weighted_lerp)
var target_scale = -cam_local_vel.z * PlayerConsts.UI_MOVEMENT_SCALE_SENSITIVITY + 1 var target_scale = -cam_local_vel.z * PlayerConsts.UI_MOVEMENT_SENSITIVITY * .01 + 1
var ui_scaling_target = Vector2(target_scale, target_scale) var ui_scaling_target = Vector2(target_scale, target_scale)
ui.offset_transform_scale = ui.offset_transform_scale.lerp(Vector2.ONE * ui_scaling_target, weighted_lerp) ui.offset_transform_scale = ui.offset_transform_scale.lerp(Vector2.ONE * ui_scaling_target, weighted_lerp)

View file

@ -2,34 +2,27 @@ extends Node
@export var prompt: Node @export var prompt: Node
@export var player: Player @export var player: Player
@export var grabbable_finder: RayCast3D
var action_panel_body = null var action_panel_body = null
func handle_body(body: Node3D) -> void: func _on_action_finder_body_entered(body: Node3D) -> void:
if body != null: if body != null:
if body.is_in_group("grabbable"): if body.is_in_group("grabbable"):
prompt.change_text("[LMB] to grab") prompt.change_text("[LMB] to grab")
elif body is PickupableItem: elif body is EquippableItem:
prompt.change_text("[R] to pick up") prompt.change_text("[R] to equip")
elif body is Button3D:
prompt.change_text("[R] to use")
else: else:
return return
action_panel_body = body action_panel_body = body
prompt.position = -(get_viewport().get_visible_rect().size / 2 - player.camera.unproject_position(action_panel_body.global_position)) / 2 prompt.position = -(get_viewport().get_visible_rect().size / 2 - player.camera.unproject_position(action_panel_body.global_position)) / 2
prompt.visible = true prompt.visible = true
func hide_prompt() -> void: func _on_action_finder_body_exited(body: Node3D) -> void:
action_panel_body = null if body != null and body == action_panel_body:
prompt.visible = false action_panel_body = null
prompt.visible = false
func _process(delta: float) -> void: func _process(delta: float) -> void:
if grabbable_finder.get_collider(): if action_panel_body != null:
var body = grabbable_finder.get_collider() var target_position = get_viewport().get_visible_rect().size / 2 - player.camera.unproject_position(action_panel_body.global_position)
handle_body(body) prompt.position = prompt.position.lerp(-target_position / 2, delta * 50)
if action_panel_body != null:
var target_position = get_viewport().get_visible_rect().size / 2 - player.camera.unproject_position(action_panel_body.global_position)
prompt.position = prompt.position.lerp(-target_position / 2, delta * 50)
else:
hide_prompt()

View file

@ -51,12 +51,12 @@ var cur_priorities: Dictionary = {
@export var player: Player @export var player: Player
@export var left_foot: ChangableAudioStreamPlayer3D @export var left_foot: SpatialAudio3D
@export var right_foot: ChangableAudioStreamPlayer3D @export var right_foot: SpatialAudio3D
@export var right_foot_texture: ChangableAudioStreamPlayer3D @export var right_foot_texture: SpatialAudio3D
@export var left_foot_texture: ChangableAudioStreamPlayer3D @export var left_foot_texture: SpatialAudio3D
@export var head: ChangableAudioStreamPlayer3D @export var head: SpatialAudio3D
@export var head_texture: ChangableAudioStreamPlayer3D @export var head_texture: SpatialAudio3D
@export var wind: AudioStreamPlayer3D @export var wind: AudioStreamPlayer3D
#var audio_cooldowns = { #var audio_cooldowns = {
@ -68,7 +68,7 @@ var cur_priorities: Dictionary = {
#"head_texture": 0 #"head_texture": 0
#} #}
var get_player_str = func (player:ChangableAudioStreamPlayer3D): var get_player_str = func (player:SpatialAudio3D):
match player: match player:
left_foot: return "left_foot" left_foot: return "left_foot"
right_foot: return "right_foot" right_foot: return "right_foot"
@ -86,14 +86,14 @@ enum Priority {
} }
var debug: bool = false var debug: bool = false
var reverb: bool = false var reverb: bool = true
func _ready() -> void: func _ready() -> void:
var sound_players:Array[ChangableAudioStreamPlayer3D] = [left_foot, left_foot_texture, right_foot, right_foot_texture, head, head_texture] var sound_players:Array[SpatialAudio3D] = [left_foot, left_foot_texture, right_foot, right_foot_texture, head, head_texture]
for i in sound_players: for i in sound_players:
#i.debug = debug i.debug = debug
#i.reverb_enabled = reverb i.reverb_enabled = reverb
cur_priorities.get_or_add(i, -1) cur_priorities.get_or_add(i, -1)
get_tree().create_timer(1).timeout.connect(init_wind) get_tree().create_timer(1).timeout.connect(init_wind)
@ -107,7 +107,7 @@ func _process(delta: float) -> void:
play_wind() play_wind()
var is_right_leg := func () -> ChangableAudioStreamPlayer3D: var is_right_leg := func () -> SpatialAudio3D:
if _current_leg_is_right: if _current_leg_is_right:
_current_leg_is_right = !_current_leg_is_right _current_leg_is_right = !_current_leg_is_right
return right_foot return right_foot
@ -117,7 +117,7 @@ var is_right_leg := func () -> ChangableAudioStreamPlayer3D:
##only use for sparse effects ##only use for sparse effects
func create_spatial_audio_sphere(pos:Vector3, audio:AudioStream, pitch:float = 1.0): func create_spatial_audio_sphere(pos:Vector3, audio:AudioStream, pitch:float = 1.0):
var spatial_audio = ChangableAudioStreamPlayer3D.new() var spatial_audio = SpatialAudio3D.new()
spatial_audio.collision_mask = 1 spatial_audio.collision_mask = 1
spatial_audio.stream = audio spatial_audio.stream = audio
@ -139,7 +139,7 @@ func create_spatial_audio_sphere(pos:Vector3, audio:AudioStream, pitch:float = 1
spatial_audio.queue_free() spatial_audio.queue_free()
@warning_ignore("shadowed_variable") @warning_ignore("shadowed_variable")
func play_stream_on_player(audio_player:ChangableAudioStreamPlayer3D, audio:AudioStream, pitch: float = randf_range(.8, 1.2), volume = 1.0, priority: Priority = Priority.LOW): func play_stream_on_player(audio_player:SpatialAudio3D, audio:AudioStream, pitch: float = randf_range(.8, 1.2), volume = 1.0, priority: Priority = Priority.LOW):
if not is_instance_valid(audio_player) or audio == null or not audio_player: if not is_instance_valid(audio_player) or audio == null or not audio_player:
return return

View file

@ -22,7 +22,7 @@ func restart_timer():
_timer.start() _timer.start()
func _process(delta: float) -> void: func _process(delta: float) -> void:
if stamina_recharge and stamina < 100: if stamina_recharge and stamina <= 100:
add_stamina(10 * delta) add_stamina(10 * delta)
if running and stamina > 0: if running and stamina > 0:

View file

@ -1,3 +1,3 @@
class_name Pocket extends PickupableItem class_name Pocket extends EquippableItem
#TODO: add pocket logic later #TODO: add pocket logic later

View file

@ -1,9 +0,0 @@
class_name Button3D extends StaticBody3D
@onready var animation_player: AnimationPlayer = %AnimationPlayer
signal pressed
func press():
animation_player.play("pressed")
pressed.emit()

View file

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

View file

@ -1,79 +0,0 @@
[gd_scene format=3 uid="uid://cbpl3s326ok8d"]
[ext_resource type="Script" uid="uid://d0n5sjpvtitix" path="res://entities/usable/button/button_3d.gd" id="1_r4dn2"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_f58a4"]
albedo_color = Color(0.48374587, 0.48374587, 0.4837458, 1)
metallic = 1.0
metallic_specular = 1.0
[sub_resource type="BoxMesh" id="BoxMesh_b5l5s"]
material = SubResource("StandardMaterial3D_f58a4")
size = Vector3(1, 1, 0.36279297)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_5rii2"]
albedo_color = Color(0.8627451, 0, 0, 1)
[sub_resource type="CylinderMesh" id="CylinderMesh_b5l5s"]
material = SubResource("StandardMaterial3D_5rii2")
top_radius = 0.25927734
bottom_radius = 0.25927734
height = 0.12780762
[sub_resource type="Animation" id="Animation_r4krq"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("MeshInstance3D2:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector3(0, -0.0034615695, 0)]
}
[sub_resource type="Animation" id="Animation_friup"]
resource_name = "pressed"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("MeshInstance3D2:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.06, 0.26, 0.39),
"transitions": PackedFloat32Array(1, 1, 1, 0.124999836),
"update": 0,
"values": [Vector3(0, -0.0034615695, 0), Vector3(0, -0.0034615695, -0.013730846), Vector3(0, -0.0034615695, -0.013730846), Vector3(0, -0.003, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_cd38i"]
_data = {
&"RESET": SubResource("Animation_r4krq"),
&"pressed": SubResource("Animation_friup")
}
[sub_resource type="BoxShape3D" id="BoxShape3D_b5l5s"]
size = Vector3(0.1, 0.1, 0.1)
[node name="Button" type="StaticBody3D" unique_id=1942355311]
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 0, 0)
script = ExtResource("1_r4dn2")
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=192699806]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, -0.043018993)
mesh = SubResource("BoxMesh_b5l5s")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="." unique_id=1753022499]
transform = Transform3D(0.2, 0, 0, 0, -8.742278e-09, -0.2, 0, 0.2, -8.742278e-09, 0, -0.0034615695, 0)
mesh = SubResource("CylinderMesh_b5l5s")
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=587532613]
unique_name_in_owner = true
libraries/ = SubResource("AnimationLibrary_cd38i")
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=612145148]
shape = SubResource("BoxShape3D_b5l5s")

View file

@ -1,13 +0,0 @@
extends Node3D
@onready var audio_player: ChangableAudioStreamPlayer3D = $ChangableAudioStreamPlayer3D
var is_playing: bool = false
func toggle():
is_playing = !is_playing
audio_player.do_play(3.5)
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
%Button.pressed.connect(toggle)

View file

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

View file

@ -1,43 +0,0 @@
[gd_scene format=3 uid="uid://clr8dvbm56jn8"]
[ext_resource type="Script" uid="uid://dw22i7cf5ekjx" path="res://entities/usable/music_player.gd" id="1_johh1"]
[ext_resource type="PackedScene" uid="uid://cbpl3s326ok8d" path="res://entities/usable/button/button_3d.tscn" id="1_t1vpp"]
[ext_resource type="Script" uid="uid://v7j6ovrub5cp" path="res://scenes/changable_sound_emitter.gd" id="3_johh1"]
[ext_resource type="AudioStream" uid="uid://b14wn4nntykxv" path="res://assets/sounds/music/Bach_ Toccata and Fugue in D Minor, BWV 565.mp3" id="3_rf3au"]
[sub_resource type="CylinderMesh" id="CylinderMesh_b5l5s"]
top_radius = 0.025390625
bottom_radius = 0.025390625
[sub_resource type="Curve" id="Curve_60a4j"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(1, 1), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="TubeTrailMesh" id="TubeTrailMesh_b5l5s"]
radius = 0.1
radial_steps = 14
section_length = 0.1
curve = SubResource("Curve_60a4j")
[node name="MusicPlayer" type="Node3D" unique_id=1866568806]
script = ExtResource("1_johh1")
[node name="Button" parent="." unique_id=1942355311 instance=ExtResource("1_t1vpp")]
unique_name_in_owner = true
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=1565274282]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -0.08234948)
mesh = SubResource("CylinderMesh_b5l5s")
[node name="MeshInstance3D2" type="MeshInstance3D" parent="." unique_id=1532772581]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 1.9501299, -0.08872458)
mesh = SubResource("TubeTrailMesh_b5l5s")
[node name="ChangableAudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="." unique_id=2198078 groups=["sound_player"]]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.9425293, 0.25567618)
stream = ExtResource("3_rf3au")
attenuation_model = 3
unit_size = 32.04
script = ExtResource("3_johh1")
easy_audio = false
metadata/_custom_type_script = "uid://v7j6ovrub5cp"

View file

@ -1,5 +0,0 @@
class_name StaminaRechargeItem extends UsableItem
func use():
Player.player.stamina_component.add_stamina(10)
queue_free()

View file

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

View file

@ -1,28 +0,0 @@
[gd_scene format=3 uid="uid://cr58irln78feo"]
[ext_resource type="Script" uid="uid://ltgcsertsux7" path="res://entities/usable_items/stamina_recharge_item.gd" id="1_gy8nx"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_gy8nx"]
albedo_color = Color(0.41262913, 0.69107723, 7.70092e-07, 1)
[sub_resource type="CapsuleMesh" id="CapsuleMesh_b5l5s"]
material = SubResource("StandardMaterial3D_gy8nx")
radius = 0.1
height = 0.5
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_b5l5s"]
radius = 0.1
height = 0.5
[node name="UsableBase" type="RigidBody3D" unique_id=1625119467 node_paths=PackedStringArray("mesh", "collision")]
script = ExtResource("1_gy8nx")
scene_path = "uid://cr58irln78feo"
mesh = NodePath("MeshInstance3D")
collision = NodePath("CollisionShape3D")
metadata/_custom_type_script = "uid://ltgcsertsux7"
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=789013428]
mesh = SubResource("CapsuleMesh_b5l5s")
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=227869647]
shape = SubResource("CapsuleShape3D_b5l5s")

View file

@ -1,3 +0,0 @@
@abstract class_name UsableItem extends PickupableItem
@abstract func use()

View file

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

View file

@ -1,13 +1,13 @@
[gd_scene format=3 uid="uid://chykk2a3opu0d"] [gd_scene format=3 uid="uid://chykk2a3opu0d"]
[ext_resource type="PackedScene" uid="uid://dvw51mhd42wg7" path="res://entities/backpack/bakpakbruh.tscn" id="1_de016"] [ext_resource type="PackedScene" uid="uid://dvw51mhd42wg7" path="res://entities/backpack/bakpakbruh.tscn" id="1_de016"]
[ext_resource type="Script" uid="uid://d5aotywdqlh5" path="res://entities/grabbable_base/grabbable_item.gd" id="1_l7v2h"] [ext_resource type="Script" uid="uid://d5aotywdqlh5" path="res://classes/grabbable_item.gd" id="1_l7v2h"]
[ext_resource type="PackedScene" uid="uid://kqq30y24c6kd" path="res://entities/player/player.tscn" id="1_s8b7j"] [ext_resource type="PackedScene" uid="uid://kqq30y24c6kd" path="res://entities/player/player.tscn" id="1_s8b7j"]
[ext_resource type="PackedScene" uid="uid://don2g5auhwbl8" path="res://entities/pickupable/test_object_pickupable.tscn" id="3_omlgy"] [ext_resource type="AudioStream" uid="uid://b6wlbiittcu48" path="res://assets/sounds/ambiance/harmonika-paulstretched.mp3" id="3_mtlx8"]
[ext_resource type="PackedScene" uid="uid://codt2h7ojcsae" path="res://entities/pickupable/test_object_pickupable_2.tscn" id="4_8r7k8"] [ext_resource type="PackedScene" uid="uid://don2g5auhwbl8" path="res://entities/equippable/test_object_equippable.tscn" id="3_omlgy"]
[ext_resource type="PackedScene" uid="uid://codt2h7ojcsae" path="res://entities/equippable/test_object_equippable_2.tscn" id="4_8r7k8"]
[ext_resource type="Script" uid="uid://y8x4svl5kej2" path="res://addons/spatial_audio_3d/spatial_audio_3d.gd" id="4_yb1w3"]
[ext_resource type="PackedScene" uid="uid://wvsly1kbdney" path="res://entities/pocket/pocket.tscn" id="5_8r7k8"] [ext_resource type="PackedScene" uid="uid://wvsly1kbdney" path="res://entities/pocket/pocket.tscn" id="5_8r7k8"]
[ext_resource type="PackedScene" uid="uid://cr58irln78feo" path="res://entities/usable_items/stamina_recharge_item.tscn" id="9_hupuo"]
[ext_resource type="PackedScene" uid="uid://clr8dvbm56jn8" path="res://entities/usable/music_player.tscn" id="10_13hof"]
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_g4v7s"] [sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_g4v7s"]
@ -22,7 +22,7 @@
[sub_resource type="BoxMesh" id="BoxMesh_yf5fn"] [sub_resource type="BoxMesh" id="BoxMesh_yf5fn"]
[sub_resource type="BoxShape3D" id="BoxShape3D_57qmd"] [sub_resource type="BoxShape3D" id="BoxShape3D_57qmd"]
size = Vector3(20.447998, 16.566147, 1) size = Vector3(20.447998, 11.038544, 1)
[sub_resource type="Environment" id="Environment_b5l5s"] [sub_resource type="Environment" id="Environment_b5l5s"]
background_mode = 2 background_mode = 2
@ -35,9 +35,6 @@ dof_blur_far_distance = 16.46
dof_blur_amount = 0.01 dof_blur_amount = 0.01
auto_exposure_max_sensitivity = 14462.9 auto_exposure_max_sensitivity = 14462.9
[sub_resource type="BoxShape3D" id="BoxShape3D_7j4jp"]
size = Vector3(100, 100, 1)
[node name="DevMap" type="Node3D" unique_id=471389571] [node name="DevMap" type="Node3D" unique_id=471389571]
[node name="bakpakbruh" parent="." unique_id=829759791 instance=ExtResource("1_de016")] [node name="bakpakbruh" parent="." unique_id=829759791 instance=ExtResource("1_de016")]
@ -95,6 +92,21 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.3125359, 1.137004)
[node name="OmniLight3D" type="OmniLight3D" parent="." unique_id=1317582521] [node name="OmniLight3D" type="OmniLight3D" parent="." unique_id=1317582521]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2949467, -3.755646) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2949467, -3.755646)
[node name="SpatialAudio3D" type="AudioStreamPlayer3D" parent="." unique_id=351573539]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 15.887349, 4.01754, -1.2293816)
stream = ExtResource("3_mtlx8")
volume_db = -8.235
autoplay = true
max_distance = 1927.53
script = ExtResource("4_yb1w3")
occlusion_fadetime = 0.0
bass_proximity = 0
max_raycast_distance = 30
roomsize_multiplicator = 2.0
prox_reduction = 16.0
debug = true
metadata/_custom_type_script = "uid://y8x4svl5kej2"
[node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=1656249102] [node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=1656249102]
transform = Transform3D(1, 0, -1.7484555e-07, 0, 1, 0, 1.7484555e-07, 0, 1, 10.053528, 0, 9.284716) transform = Transform3D(1, 0, -1.7484555e-07, 0, 1, 0, 1.7484555e-07, 0, 1, 10.053528, 0, 9.284716)
@ -130,39 +142,3 @@ shape = SubResource("BoxShape3D_57qmd")
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=376113449] [node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=376113449]
environment = SubResource("Environment_b5l5s") environment = SubResource("Environment_b5l5s")
camera_attributes = SubResource("CameraAttributesPractical_60a4j") camera_attributes = SubResource("CameraAttributesPractical_60a4j")
[node name="UsableBase" parent="." unique_id=1189819781 instance=ExtResource("9_hupuo")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.8267124, 0.65320015, -0.25214243)
[node name="StaticBody3D5" type="StaticBody3D" parent="." unique_id=1060538462]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.8267124, 0.65320015, -0.25214243)
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D5" unique_id=517469897]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 83.8801, 49.864983, -50.69651)
shape = SubResource("BoxShape3D_7j4jp")
[node name="CollisionShape3D3" type="CollisionShape3D" parent="StaticBody3D5" unique_id=1764096820]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, -1, 0, 1, -4.371139e-08, 83.8801, -1.9845104, 0.8780961)
shape = SubResource("BoxShape3D_7j4jp")
[node name="CollisionShape3D4" type="CollisionShape3D" parent="StaticBody3D5" unique_id=2021497330]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, -1, 0, 1, -4.371139e-08, 83.8801, 98.95747, 0.8780961)
shape = SubResource("BoxShape3D_7j4jp")
[node name="CollisionShape3D5" type="CollisionShape3D" parent="StaticBody3D5" unique_id=674733187]
transform = Transform3D(-4.371139e-08, -4.371139e-08, -1, -1, 1.9106855e-15, 4.371139e-08, 0, 1, -4.371139e-08, 135.2068, 48.38263, 0.8780961)
shape = SubResource("BoxShape3D_7j4jp")
[node name="CollisionShape3D6" type="CollisionShape3D" parent="StaticBody3D5" unique_id=225589793]
transform = Transform3D(-4.371139e-08, -4.371139e-08, -1, -1, 1.9106855e-15, 4.371139e-08, 0, 1, -4.371139e-08, 35.339264, 48.38263, 0.8780961)
shape = SubResource("BoxShape3D_7j4jp")
[node name="CollisionShape3D2" type="CollisionShape3D" parent="StaticBody3D5" unique_id=445238902]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 83.8801, 49.864983, 47.276882)
shape = SubResource("BoxShape3D_7j4jp")
[node name="MusicPlayer" parent="." unique_id=1866568806 instance=ExtResource("10_13hof")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -4.569429, 1.810069, 2.4010668)
[node name="MusicPlayer2" parent="." unique_id=248560085 instance=ExtResource("10_13hof")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 62.980488, 1.810069, 2.4010668)

View file

@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://bqi71jcv228ha"] [gd_scene format=3 uid="uid://bqi71jcv228ha"]
[ext_resource type="Script" uid="uid://cufnrtuy8ihp8" path="res://scenes/maps/procedural_map_parts_ver_premade/blocks/corridor_base.gd" id="1_xccyg"] [ext_resource type="Script" uid="uid://cufnrtuy8ihp8" path="res://maps/procedural_map_parts_ver_premade/blocks/corridor_base.gd" id="1_xccyg"]
[sub_resource type="BoxShape3D" id="BoxShape3D_2uy16"] [sub_resource type="BoxShape3D" id="BoxShape3D_2uy16"]
size = Vector3(3, 3, 0.2) size = Vector3(3, 3, 0.2)
@ -25,8 +25,6 @@ script = ExtResource("1_xccyg")
[node name="StaticBody3D3" type="StaticBody3D" parent="." unique_id=1155377467] [node name="StaticBody3D3" type="StaticBody3D" parent="." unique_id=1155377467]
transform = Transform3D(-4.371139e-08, 0, 1, 1, -4.371139e-08, 4.371139e-08, 4.371139e-08, 1, 1.9106855e-15, -1.05, 1, 0) transform = Transform3D(-4.371139e-08, 0, 1, 1, -4.371139e-08, 4.371139e-08, 4.371139e-08, 1, 1.9106855e-15, -1.05, 1, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D3" unique_id=407288997] [node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D3" unique_id=407288997]
shape = SubResource("BoxShape3D_2uy16") shape = SubResource("BoxShape3D_2uy16")
@ -36,8 +34,6 @@ mesh = SubResource("BoxMesh_xccyg")
[node name="StaticBody3D2" type="StaticBody3D" parent="." unique_id=859289845] [node name="StaticBody3D2" type="StaticBody3D" parent="." unique_id=859289845]
transform = Transform3D(-4.371139e-08, -4.371139e-08, 1, -1, 1.9106855e-15, -4.371139e-08, 0, -1, -4.371139e-08, 1.05, 1, 0) transform = Transform3D(-4.371139e-08, -4.371139e-08, 1, -1, 1.9106855e-15, -4.371139e-08, 0, -1, -4.371139e-08, 1.05, 1, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D2" unique_id=633037051] [node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D2" unique_id=633037051]
shape = SubResource("BoxShape3D_r2fmj") shape = SubResource("BoxShape3D_r2fmj")
@ -47,8 +43,6 @@ mesh = SubResource("BoxMesh_t5b2u")
[node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=756323465] [node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=756323465]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 2.55, 0) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 2.55, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" unique_id=782523] [node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" unique_id=782523]
shape = SubResource("BoxShape3D_rq4n7") shape = SubResource("BoxShape3D_rq4n7")
@ -58,8 +52,6 @@ mesh = SubResource("BoxMesh_xccyg")
[node name="StaticBody3D4" type="StaticBody3D" parent="." unique_id=1520669484] [node name="StaticBody3D4" type="StaticBody3D" parent="." unique_id=1520669484]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0, 0) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D4" unique_id=1344836418] [node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D4" unique_id=1344836418]
shape = SubResource("BoxShape3D_rq4n7") shape = SubResource("BoxShape3D_rq4n7")

View file

@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://72meffei7m1x"] [gd_scene format=3 uid="uid://72meffei7m1x"]
[ext_resource type="Script" uid="uid://cbpmudbod58kd" path="res://scenes/maps/procedural_map_parts_ver_premade/blocks/corridor_turn_base.gd" id="1_8qdpf"] [ext_resource type="Script" uid="uid://cbpmudbod58kd" path="res://maps/procedural_map_parts_ver_premade/blocks/corridor_turn_base.gd" id="1_8qdpf"]
[sub_resource type="BoxShape3D" id="BoxShape3D_wc7xr"] [sub_resource type="BoxShape3D" id="BoxShape3D_wc7xr"]
size = Vector3(2, 5.0625, 0.2) size = Vector3(2, 5.0625, 0.2)
@ -49,8 +49,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2.5)
[node name="StaticBody3D3" type="StaticBody3D" parent="Corridor1" unique_id=1155377467] [node name="StaticBody3D3" type="StaticBody3D" parent="Corridor1" unique_id=1155377467]
transform = Transform3D(-5.4639237e-08, 0, 1, 1.25, -4.371139e-08, 4.371139e-08, 5.4639237e-08, 1, 1.9106855e-15, -1.05, 1.2, -1.25) transform = Transform3D(-5.4639237e-08, 0, 1, 1.25, -4.371139e-08, 4.371139e-08, 5.4639237e-08, 1, 1.9106855e-15, -1.05, 1.2, -1.25)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor1/StaticBody3D3" unique_id=407288997] [node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor1/StaticBody3D3" unique_id=407288997]
transform = Transform3D(1, 0, 8.351872e-23, 0, 1, 0, 8.351872e-23, 0, 1, 2.3841858e-07, 0.21875, 0) transform = Transform3D(1, 0, 8.351872e-23, 0, 1, 0, 8.351872e-23, 0, 1, 2.3841858e-07, 0.21875, 0)
@ -62,8 +60,6 @@ mesh = SubResource("BoxMesh_yjdan")
[node name="StaticBody3D2" type="StaticBody3D" parent="Corridor1" unique_id=859289845] [node name="StaticBody3D2" type="StaticBody3D" parent="Corridor1" unique_id=859289845]
transform = Transform3D(-5.4639237e-08, -4.371139e-08, 1, -1.25, 1.9106855e-15, -4.371139e-08, 0, -1, -4.371139e-08, 1.05, 1.2, 0) transform = Transform3D(-5.4639237e-08, -4.371139e-08, 1, -1.25, 1.9106855e-15, -4.371139e-08, 0, -1, -4.371139e-08, 1.05, 1.2, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor1/StaticBody3D2" unique_id=633037051] [node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor1/StaticBody3D2" unique_id=633037051]
shape = SubResource("BoxShape3D_rq4n7") shape = SubResource("BoxShape3D_rq4n7")
@ -73,8 +69,6 @@ mesh = SubResource("BoxMesh_xccyg")
[node name="StaticBody3D" type="StaticBody3D" parent="Corridor1" unique_id=756323465] [node name="StaticBody3D" type="StaticBody3D" parent="Corridor1" unique_id=756323465]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 2.45, 0) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 2.45, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor1/StaticBody3D" unique_id=782523] [node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor1/StaticBody3D" unique_id=782523]
shape = SubResource("BoxShape3D_rq4n7") shape = SubResource("BoxShape3D_rq4n7")
@ -84,8 +78,6 @@ mesh = SubResource("BoxMesh_xccyg")
[node name="StaticBody3D4" type="StaticBody3D" parent="Corridor1" unique_id=1520669484] [node name="StaticBody3D4" type="StaticBody3D" parent="Corridor1" unique_id=1520669484]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0, 0) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor1/StaticBody3D4" unique_id=1344836418] [node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor1/StaticBody3D4" unique_id=1344836418]
shape = SubResource("BoxShape3D_rq4n7") shape = SubResource("BoxShape3D_rq4n7")
@ -98,8 +90,6 @@ transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 3, 0
[node name="StaticBody3D3" type="StaticBody3D" parent="Corridor2" unique_id=1681537155] [node name="StaticBody3D3" type="StaticBody3D" parent="Corridor2" unique_id=1681537155]
transform = Transform3D(-5.4639234e-08, 0, 1, 1.25, -4.371139e-08, 4.371139e-08, 5.4639237e-08, 1, 3.5527137e-15, -1.05, 1.2, 0) transform = Transform3D(-5.4639234e-08, 0, 1, 1.25, -4.371139e-08, 4.371139e-08, 5.4639237e-08, 1, 3.5527137e-15, -1.05, 1.2, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor2/StaticBody3D3" unique_id=1519415059] [node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor2/StaticBody3D3" unique_id=1519415059]
transform = Transform3D(1, 1.6420284e-15, 0, 1.6420284e-15, 1, 0, 0, 0, 1, 0, -0.19360352, 0) transform = Transform3D(1, 1.6420284e-15, 0, 1.6420284e-15, 1, 0, 0, 0, 1, 0, -0.19360352, 0)
@ -111,8 +101,6 @@ mesh = SubResource("BoxMesh_vav0j")
[node name="StaticBody3D2" type="StaticBody3D" parent="Corridor2" unique_id=1507709423] [node name="StaticBody3D2" type="StaticBody3D" parent="Corridor2" unique_id=1507709423]
transform = Transform3D(-5.4639237e-08, -4.371139e-08, 1, -1.25, 1.9106855e-15, -4.371139e-08, -2.1175824e-22, -1, -4.371139e-08, 1.05, 1.2, 0) transform = Transform3D(-5.4639237e-08, -4.371139e-08, 1, -1.25, 1.9106855e-15, -4.371139e-08, -2.1175824e-22, -1, -4.371139e-08, 1.05, 1.2, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor2/StaticBody3D2" unique_id=784288059] [node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor2/StaticBody3D2" unique_id=784288059]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2445676, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2445676, 0)
@ -123,8 +111,6 @@ mesh = SubResource("BoxMesh_wc7xr")
[node name="StaticBody3D" type="StaticBody3D" parent="Corridor2" unique_id=1007808616] [node name="StaticBody3D" type="StaticBody3D" parent="Corridor2" unique_id=1007808616]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 2.45, 0) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 2.45, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor2/StaticBody3D" unique_id=877001388] [node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor2/StaticBody3D" unique_id=877001388]
transform = Transform3D(1, 0, 0, 0, 1, 8.351872e-23, 0, 8.351872e-23, 1, -1.4210855e-14, 1.2611692, 4.7683716e-07) transform = Transform3D(1, 0, 0, 0, 1, 8.351872e-23, 0, 8.351872e-23, 1, -1.4210855e-14, 1.2611692, 4.7683716e-07)
@ -135,8 +121,6 @@ mesh = SubResource("BoxMesh_eoxma")
[node name="StaticBody3D4" type="StaticBody3D" parent="Corridor2" unique_id=1418330129] [node name="StaticBody3D4" type="StaticBody3D" parent="Corridor2" unique_id=1418330129]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0, 0) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor2/StaticBody3D4" unique_id=808595951] [node name="CollisionShape3D" type="CollisionShape3D" parent="Corridor2/StaticBody3D4" unique_id=808595951]
transform = Transform3D(1, 0, 0, 0, 1, 8.351872e-23, 0, 8.351872e-23, 1, 0, 1.25, 0) transform = Transform3D(1, 0, 0, 0, 1, 8.351872e-23, 0, 8.351872e-23, 1, 0, 1.25, 0)
@ -148,13 +132,13 @@ mesh = SubResource("BoxMesh_id5ww")
[node name="Label3D" type="Label3D" parent="." unique_id=219693250] [node name="Label3D" type="Label3D" parent="." unique_id=219693250]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 0, 1, 0) transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 0, 1, 0)
billboard = 1 billboard = 1
text = "corridor turn right" text = "corridor turn"
[node name="Label3D2" type="Label3D" parent="." unique_id=1062586634] [node name="Label3D2" type="Label3D" parent="." unique_id=1062586634]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 0, 3, 0) transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, 0, 3, 0)
pixel_size = 0.01 pixel_size = 0.01
billboard = 1 billboard = 1
text = "corridor turn right" text = "corridor turn"
[node name="Markers" type="Node3D" parent="." unique_id=93966280] [node name="Markers" type="Node3D" parent="." unique_id=93966280]

View file

@ -0,0 +1,15 @@
[gd_scene format=3 uid="uid://dpipi1pttxrcp"]
[sub_resource type="BoxShape3D" id="BoxShape3D_pxn7n"]
size = Vector3(3, 3, 0.2)
[sub_resource type="BoxMesh" id="BoxMesh_dikcp"]
size = Vector3(3, 3, 0.1)
[node name="WallBase" type="StaticBody3D" unique_id=1490575404]
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1929329994]
shape = SubResource("BoxShape3D_pxn7n")
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D" unique_id=460229788]
mesh = SubResource("BoxMesh_dikcp")

View file

@ -1,6 +1,6 @@
[gd_scene format=3 uid="uid://dyh7k0iqmoa1s"] [gd_scene format=3 uid="uid://dyh7k0iqmoa1s"]
[ext_resource type="Script" uid="uid://dca56unue57vt" path="res://scenes/maps/procedural_map_parts_ver_premade/blocks/wall_hole_base.gd" id="1_iomhl"] [ext_resource type="Script" uid="uid://dca56unue57vt" path="res://maps/procedural_map_parts_ver_premade/blocks/wall_hole_base.gd" id="1_iomhl"]
[sub_resource type="BoxShape3D" id="BoxShape3D_y77ur"] [sub_resource type="BoxShape3D" id="BoxShape3D_y77ur"]
size = Vector3(0.5, 3, 0.2) size = Vector3(0.5, 3, 0.2)

View file

@ -0,0 +1,225 @@
extends Node3D
@export_group("Map Pieces")
@export var start_room_scene: PackedScene
@export var cap_scene: PackedScene
@export var room_scenes: Array[PackedScene]
@export var corridor_scenes: Array[PackedScene]
@export_group("Generation Rules")
@export_range(0.0, 1.0) var corridor_chance: float = 0.5
@export var room_threshold: int = 15
@export_range(0.0, 1.0) var stop_chance_step: float = 0.1
var generated_rooms: Array[Node3D] = []
var open_connections: Array[Dictionary] = []
var total_pieces: int = 0
func _ready() -> void:
generate_map()
func draw_connection_laser(pos1: Vector3, pos2: Vector3):
var mesh_instance = MeshInstance3D.new()
var cylinder = CylinderMesh.new()
# Make a thin, long laser beam
cylinder.top_radius = 0.05
cylinder.bottom_radius = 0.05
cylinder.height = pos1.distance_to(pos2)
var material = StandardMaterial3D.new()
material.albedo_color = Color.GREEN
material.emission_enabled = true
material.emission = Color.GREEN
cylinder.surface_set_material(0, material)
mesh_instance.mesh = cylinder
get_tree().current_scene.add_child(mesh_instance)
# Position it exactly between the two markers and make it look at the target
mesh_instance.global_position = pos1.lerp(pos2, 0.5)
mesh_instance.look_at(pos2, Vector3.UP)
# Cylinder meshes stand up (Y) by default, we need it to point forward (Z)
mesh_instance.rotate_object_local(Vector3.RIGHT, PI/2)
func generate_map():
if not start_room_scene or not cap_scene:
push_error("MapGenerator needs both a Start Room Scene and a Cap Scene!")
return
var start_room = start_room_scene.instantiate()
add_child(start_room)
generated_rooms.append(start_room)
add_open_connections(start_room, "room")
total_pieces += 1
var attempts = 0
while open_connections.size() > 0 and attempts < 2000:
attempts += 1
var target_dict = open_connections.pick_random()
var target_marker = target_dict["marker"]
var target_type = target_dict["type"]
if is_marker_blocked(target_marker):
open_connections.erase(target_dict)
continue
# 1. Decide what category we are TRYING to spawn
var spawn_category = "room"
var cap_probability = 0.0
if total_pieces > room_threshold:
cap_probability = (total_pieces - room_threshold) * stop_chance_step
if randf() < cap_probability:
spawn_category = "cap"
elif target_type == "room" and randf() < corridor_chance and corridor_scenes.size() > 0:
spawn_category = "corridor"
# 2. Gather all scenes for that category and SHUFFLE them
var scenes_to_try = []
if spawn_category == "cap":
scenes_to_try = [cap_scene]
elif spawn_category == "corridor":
scenes_to_try = corridor_scenes.duplicate()
scenes_to_try.shuffle() # Randomize the order we try the corridors
else:
scenes_to_try = room_scenes.duplicate()
scenes_to_try.shuffle() # Randomize the order we try the rooms
var placed_successfully = false
# 3. Try EVERY scene until one fits
for scene in scenes_to_try:
if placed_successfully:
break
var new_room = scene.instantiate()
add_child(new_room)
var new_room_markers = new_room.connection_markers.duplicate()
if new_room_markers.is_empty():
new_room.free()
continue
new_room_markers.shuffle() # Try the new room's doors in random order too!
# 4. Try EVERY door on the chosen scene
for incoming_marker in new_room_markers:
align_room(new_room, incoming_marker, target_marker)
var overlaps = false
for existing_room in generated_rooms:
if do_rooms_overlap(new_room, existing_room):
overlaps = true
break
if not overlaps:
# IT FITS! Lock it in.
generated_rooms.append(new_room)
# DRAW THE LASER!
draw_connection_laser(target_marker.global_position, new_room.global_position)
total_pieces += 1
open_connections.erase(target_dict)
new_room_markers.erase(incoming_marker)
for marker in new_room_markers:
open_connections.append({"marker": marker, "type": spawn_category})
placed_successfully = true
break # Break out of the door loop
if not placed_successfully:
new_room.free() # None of the doors on this scene fit, destroy it and try the next scene
# 5. Failsafe: If literally NO room and NO door fits in this spot, CAP IT instantly!
if not placed_successfully and spawn_category != "cap":
force_cap_on_marker(target_dict)
seal_remaining_connections()
print("Map Generation Complete! Total pieces: ", total_pieces)
func force_cap_on_marker(target_dict: Dictionary):
var target_marker = target_dict["marker"]
var cap = cap_scene.instantiate()
add_child(cap)
var incoming_marker = cap.connection_markers[0]
align_room(cap, incoming_marker, target_marker)
generated_rooms.append(cap)
open_connections.erase(target_dict)
func seal_remaining_connections():
for i in range(open_connections.size() - 1, -1, -1):
var target_dict = open_connections[i]
var target_marker = target_dict["marker"]
if is_marker_blocked(target_marker):
open_connections.remove_at(i)
continue
force_cap_on_marker(target_dict)
open_connections.clear()
func add_open_connections(room: Node3D, type: String):
if room.connection_markers != null:
for marker in room.connection_markers:
open_connections.append({"marker": marker, "type": type})
func is_marker_blocked(marker: Marker3D) -> bool:
for room in generated_rooms:
var aabb = get_room_global_aabb(room)
aabb.position += Vector3(0.1, 0.1, 0.1)
aabb.size -= Vector3(0.2, 0.2, 0.2)
if aabb.has_point(marker.global_position):
return true
return false
func align_room(new_room: Node3D, incoming_marker: Marker3D, target_marker: Marker3D):
var desired_incoming_transform = target_marker.global_transform.rotated_local(Vector3.UP, PI)
var room_to_marker = new_room.global_transform.affine_inverse() * incoming_marker.global_transform
new_room.global_transform = desired_incoming_transform * room_to_marker.affine_inverse()
func do_rooms_overlap(room_a: Node3D, room_b: Node3D) -> bool:
var aabb_a = get_room_global_aabb(room_a)
var aabb_b = get_room_global_aabb(room_b)
if aabb_a.size == Vector3.ZERO or aabb_b.size == Vector3.ZERO:
return false
# Increased the margin slightly to ensure corridors pass smoothly
var shrink_margin = Vector3(0.2, 0.2, 0.2)
aabb_a.position += shrink_margin / 2.0
aabb_a.size -= shrink_margin
return aabb_a.intersects(aabb_b)
func get_room_global_aabb(room: Node3D) -> AABB:
var combined_aabb := AABB()
var is_first_shape = true
for child in room.volume.get_children():
if child is CollisionShape3D and child.shape is BoxShape3D:
var shape = child.shape as BoxShape3D
var local_aabb = AABB(-shape.size / 2.0, shape.size)
var global_aabb = child.global_transform * local_aabb
if is_first_shape:
combined_aabb = global_aabb
is_first_shape = false
else:
combined_aabb = combined_aabb.merge(global_aabb)
return combined_aabb

View file

@ -0,0 +1,26 @@
[gd_scene format=3 uid="uid://c5p2fbgi8co1c"]
[ext_resource type="Script" uid="uid://dqddq642yha0o" path="res://maps/procedural_map_parts_ver_premade/map_generator.gd" id="1_oa821"]
[ext_resource type="PackedScene" uid="uid://cm24rsfnjw4ok" path="res://maps/procedural_map_parts_ver_premade/parts/big_part.tscn" id="1_ywphk"]
[ext_resource type="PackedScene" uid="uid://doddrjiew6eov" path="res://maps/procedural_map_parts_ver_premade/parts/end_part.tscn" id="3_dpdkl"]
[ext_resource type="PackedScene" uid="uid://do7paidwkyx2e" path="res://maps/procedural_map_parts_ver_premade/parts/medium_part.tscn" id="4_vnae6"]
[ext_resource type="PackedScene" uid="uid://tap7imlv8vb0" path="res://maps/procedural_map_parts_ver_premade/parts/small_part.tscn" id="5_s0fpg"]
[ext_resource type="PackedScene" uid="uid://bqi71jcv228ha" path="res://maps/procedural_map_parts_ver_premade/blocks/corridor_base.tscn" id="6_nd2uf"]
[ext_resource type="PackedScene" uid="uid://72meffei7m1x" path="res://maps/procedural_map_parts_ver_premade/blocks/corridor_turn_base.tscn" id="7_l0kyl"]
[sub_resource type="Environment" id="Environment_b5l5s"]
[node name="MapGenerator" type="Node3D" unique_id=1303087176]
script = ExtResource("1_oa821")
start_room_scene = ExtResource("1_ywphk")
cap_scene = ExtResource("3_dpdkl")
room_scenes = Array[PackedScene]([ExtResource("1_ywphk"), ExtResource("4_vnae6"), ExtResource("5_s0fpg")])
corridor_scenes = Array[PackedScene]([ExtResource("6_nd2uf"), ExtResource("7_l0kyl")])
corridor_chance = 0.523
stop_chance_step = 0.3
[node name="Camera3D" type="Camera3D" parent="." unique_id=1248557197]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 53.35144, 0)
[node name="WorldEnvironment" type="WorldEnvironment" parent="Camera3D" unique_id=1308284335]
environment = SubResource("Environment_b5l5s")

View file

@ -1,9 +1,8 @@
[gd_scene format=3 uid="uid://cm24rsfnjw4ok"] [gd_scene format=3 uid="uid://cm24rsfnjw4ok"]
[ext_resource type="PackedScene" uid="uid://dpipi1pttxrcp" path="res://scenes/maps/procedural_map_parts_ver_premade/blocks/wall_base.tscn" id="1_3yqjc"] [ext_resource type="PackedScene" uid="uid://dpipi1pttxrcp" path="res://maps/procedural_map_parts_ver_premade/blocks/wall_base.tscn" id="1_3yqjc"]
[ext_resource type="Script" uid="uid://dvmuhlmqeknv2" path="res://scenes/maps/procedural_map_parts_ver_premade/parts/big_part.gd" id="1_sdg7d"] [ext_resource type="Script" uid="uid://dvmuhlmqeknv2" path="res://maps/procedural_map_parts_ver_premade/parts/big_part.gd" id="1_sdg7d"]
[ext_resource type="PackedScene" uid="uid://dyh7k0iqmoa1s" path="res://scenes/maps/procedural_map_parts_ver_premade/blocks/wall_hole_base.tscn" id="2_1mbjt"] [ext_resource type="PackedScene" uid="uid://dyh7k0iqmoa1s" path="res://maps/procedural_map_parts_ver_premade/blocks/wall_hole_base.tscn" id="2_1mbjt"]
[ext_resource type="PackedScene" uid="uid://clr8dvbm56jn8" path="res://entities/usable/music_player.tscn" id="4_adfox"]
[sub_resource type="BoxShape3D" id="BoxShape3D_b5l5s"] [sub_resource type="BoxShape3D" id="BoxShape3D_b5l5s"]
size = Vector3(36, 0.1, 36) size = Vector3(36, 0.1, 36)
@ -32,28 +31,18 @@ transform = Transform3D(1, 0, -1.7484555e-07, 0, 1, 0, 1.7484555e-07, 0, 1, 10.4
[node name="WallBase7" parent="Walls/BiiigWall" unique_id=156284319 instance=ExtResource("1_3yqjc")] [node name="WallBase7" parent="Walls/BiiigWall" unique_id=156284319 instance=ExtResource("1_3yqjc")]
transform = Transform3D(2, 0, -1.7484552e-07, 0, 3.9600003, 0, 3.496911e-07, 0, 0.9999998, 15, 5.5, 18) transform = Transform3D(2, 0, -1.7484552e-07, 0, 3.9600003, 0, 3.496911e-07, 0, 0.9999998, 15, 5.5, 18)
collision_layer = 17
collision_mask = 17
[node name="WallBase14" parent="Walls/BiiigWall" unique_id=1808172169 instance=ExtResource("1_3yqjc")] [node name="WallBase14" parent="Walls/BiiigWall" unique_id=1808172169 instance=ExtResource("1_3yqjc")]
transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, 10.498831, 7, 17.999584) transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, 10.498831, 7, 17.999584)
collision_layer = 17
collision_mask = 17
[node name="WallBase28" parent="Walls/BiiigWall" unique_id=1713653384 instance=ExtResource("1_3yqjc")] [node name="WallBase28" parent="Walls/BiiigWall" unique_id=1713653384 instance=ExtResource("1_3yqjc")]
transform = Transform3D(2, 0, -1.7484552e-07, 0, 4.0035005, 0, 3.496911e-07, 0, 0.9999998, -15, 5.5, 18) transform = Transform3D(2, 0, -1.7484552e-07, 0, 4.0035005, 0, 3.496911e-07, 0, 0.9999998, -15, 5.5, 18)
collision_layer = 17
collision_mask = 17
[node name="WallBase32" parent="Walls/BiiigWall" unique_id=934204351 instance=ExtResource("1_3yqjc")] [node name="WallBase32" parent="Walls/BiiigWall" unique_id=934204351 instance=ExtResource("1_3yqjc")]
transform = Transform3D(6.16, 0, -1.7484541e-07, 0, 4.05, 0, 1.0770486e-06, 0, 0.9999992, 0, 5.5, 18) transform = Transform3D(6.16, 0, -1.7484541e-07, 0, 4.05, 0, 1.0770486e-06, 0, 0.9999992, 0, 5.5, 18)
collision_layer = 17
collision_mask = 17
[node name="WallBase36" parent="Walls/BiiigWall" unique_id=1235068910 instance=ExtResource("1_3yqjc")] [node name="WallBase36" parent="Walls/BiiigWall" unique_id=1235068910 instance=ExtResource("1_3yqjc")]
transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, -10.501167, 7, 17.999584) transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, -10.501167, 7, 17.999584)
collision_layer = 17
collision_mask = 17
[node name="BiiigWall2" type="Node3D" parent="Walls" unique_id=650435345] [node name="BiiigWall2" type="Node3D" parent="Walls" unique_id=650435345]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 0, 0.5, 0) transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 0, 0.5, 0)
@ -68,28 +57,18 @@ transform = Transform3D(1, 0, -1.7484555e-07, 0, 1, 0, 1.7484555e-07, 0, 1, 10.4
[node name="WallBase7" parent="Walls/BiiigWall2" unique_id=1490575404 instance=ExtResource("1_3yqjc")] [node name="WallBase7" parent="Walls/BiiigWall2" unique_id=1490575404 instance=ExtResource("1_3yqjc")]
transform = Transform3D(2, 0, -1.7484552e-07, 0, 3.9600003, 0, 3.496911e-07, 0, 0.9999998, 15, 5.5, 18) transform = Transform3D(2, 0, -1.7484552e-07, 0, 3.9600003, 0, 3.496911e-07, 0, 0.9999998, 15, 5.5, 18)
collision_layer = 17
collision_mask = 17
[node name="WallBase14" parent="Walls/BiiigWall2" unique_id=1414730758 instance=ExtResource("1_3yqjc")] [node name="WallBase14" parent="Walls/BiiigWall2" unique_id=1414730758 instance=ExtResource("1_3yqjc")]
transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, 10.498831, 7, 17.999584) transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, 10.498831, 7, 17.999584)
collision_layer = 17
collision_mask = 17
[node name="WallBase28" parent="Walls/BiiigWall2" unique_id=398712345 instance=ExtResource("1_3yqjc")] [node name="WallBase28" parent="Walls/BiiigWall2" unique_id=398712345 instance=ExtResource("1_3yqjc")]
transform = Transform3D(2, 0, -1.7484552e-07, 0, 4.0035005, 0, 3.496911e-07, 0, 0.9999998, -15, 5.5, 18) transform = Transform3D(2, 0, -1.7484552e-07, 0, 4.0035005, 0, 3.496911e-07, 0, 0.9999998, -15, 5.5, 18)
collision_layer = 17
collision_mask = 17
[node name="WallBase32" parent="Walls/BiiigWall2" unique_id=393456469 instance=ExtResource("1_3yqjc")] [node name="WallBase32" parent="Walls/BiiigWall2" unique_id=393456469 instance=ExtResource("1_3yqjc")]
transform = Transform3D(6.16, 0, -1.7484541e-07, 0, 4.05, 0, 1.0770486e-06, 0, 0.9999992, 0, 5.5, 18) transform = Transform3D(6.16, 0, -1.7484541e-07, 0, 4.05, 0, 1.0770486e-06, 0, 0.9999992, 0, 5.5, 18)
collision_layer = 17
collision_mask = 17
[node name="WallBase36" parent="Walls/BiiigWall2" unique_id=1856153119 instance=ExtResource("1_3yqjc")] [node name="WallBase36" parent="Walls/BiiigWall2" unique_id=1856153119 instance=ExtResource("1_3yqjc")]
transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, -10.501167, 7, 17.999584) transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, -10.501167, 7, 17.999584)
collision_layer = 17
collision_mask = 17
[node name="BiiigWall3" type="Node3D" parent="Walls" unique_id=1154496094] [node name="BiiigWall3" type="Node3D" parent="Walls" unique_id=1154496094]
transform = Transform3D(-1, 0, 8.742278e-08, 0, 1, 0, -8.742278e-08, 0, -1, 0, 0.5, 0) transform = Transform3D(-1, 0, 8.742278e-08, 0, 1, 0, -8.742278e-08, 0, -1, 0, 0.5, 0)
@ -104,28 +83,18 @@ transform = Transform3D(1, 0, -1.7484555e-07, 0, 1, 0, 1.7484555e-07, 0, 1, 10.4
[node name="WallBase7" parent="Walls/BiiigWall3" unique_id=1764650462 instance=ExtResource("1_3yqjc")] [node name="WallBase7" parent="Walls/BiiigWall3" unique_id=1764650462 instance=ExtResource("1_3yqjc")]
transform = Transform3D(2, 0, -1.7484552e-07, 0, 3.9600003, 0, 3.496911e-07, 0, 0.9999998, 15, 5.5, 18) transform = Transform3D(2, 0, -1.7484552e-07, 0, 3.9600003, 0, 3.496911e-07, 0, 0.9999998, 15, 5.5, 18)
collision_layer = 17
collision_mask = 17
[node name="WallBase14" parent="Walls/BiiigWall3" unique_id=1912856173 instance=ExtResource("1_3yqjc")] [node name="WallBase14" parent="Walls/BiiigWall3" unique_id=1912856173 instance=ExtResource("1_3yqjc")]
transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, 10.498831, 7, 17.999584) transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, 10.498831, 7, 17.999584)
collision_layer = 17
collision_mask = 17
[node name="WallBase28" parent="Walls/BiiigWall3" unique_id=622765899 instance=ExtResource("1_3yqjc")] [node name="WallBase28" parent="Walls/BiiigWall3" unique_id=622765899 instance=ExtResource("1_3yqjc")]
transform = Transform3D(2, 0, -1.7484552e-07, 0, 4.0035005, 0, 3.496911e-07, 0, 0.9999998, -15, 5.5, 18) transform = Transform3D(2, 0, -1.7484552e-07, 0, 4.0035005, 0, 3.496911e-07, 0, 0.9999998, -15, 5.5, 18)
collision_layer = 17
collision_mask = 17
[node name="WallBase32" parent="Walls/BiiigWall3" unique_id=569931776 instance=ExtResource("1_3yqjc")] [node name="WallBase32" parent="Walls/BiiigWall3" unique_id=569931776 instance=ExtResource("1_3yqjc")]
transform = Transform3D(6.16, 0, -1.7484541e-07, 0, 4.05, 0, 1.0770486e-06, 0, 0.9999992, 0, 5.5, 18) transform = Transform3D(6.16, 0, -1.7484541e-07, 0, 4.05, 0, 1.0770486e-06, 0, 0.9999992, 0, 5.5, 18)
collision_layer = 17
collision_mask = 17
[node name="WallBase36" parent="Walls/BiiigWall3" unique_id=1424457871 instance=ExtResource("1_3yqjc")] [node name="WallBase36" parent="Walls/BiiigWall3" unique_id=1424457871 instance=ExtResource("1_3yqjc")]
transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, -10.501167, 7, 17.999584) transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, -10.501167, 7, 17.999584)
collision_layer = 17
collision_mask = 17
[node name="BiiigWall4" type="Node3D" parent="Walls" unique_id=2106150262] [node name="BiiigWall4" type="Node3D" parent="Walls" unique_id=2106150262]
transform = Transform3D(1.3113416e-07, 0, 1, 0, 1, 0, -1, 0, 1.3113416e-07, 0, 0.5, 0) transform = Transform3D(1.3113416e-07, 0, 1, 0, 1, 0, -1, 0, 1.3113416e-07, 0, 0.5, 0)
@ -140,32 +109,20 @@ transform = Transform3D(1, 0, -1.7484555e-07, 0, 1, 0, 1.7484555e-07, 0, 1, 10.4
[node name="WallBase7" parent="Walls/BiiigWall4" unique_id=38896772 instance=ExtResource("1_3yqjc")] [node name="WallBase7" parent="Walls/BiiigWall4" unique_id=38896772 instance=ExtResource("1_3yqjc")]
transform = Transform3D(2, 0, -1.7484552e-07, 0, 3.9600003, 0, 3.496911e-07, 0, 0.9999998, 15, 5.5, 18) transform = Transform3D(2, 0, -1.7484552e-07, 0, 3.9600003, 0, 3.496911e-07, 0, 0.9999998, 15, 5.5, 18)
collision_layer = 17
collision_mask = 17
[node name="WallBase14" parent="Walls/BiiigWall4" unique_id=1588817707 instance=ExtResource("1_3yqjc")] [node name="WallBase14" parent="Walls/BiiigWall4" unique_id=1588817707 instance=ExtResource("1_3yqjc")]
transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, 10.498831, 7, 17.999584) transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, 10.498831, 7, 17.999584)
collision_layer = 17
collision_mask = 17
[node name="WallBase28" parent="Walls/BiiigWall4" unique_id=1844881760 instance=ExtResource("1_3yqjc")] [node name="WallBase28" parent="Walls/BiiigWall4" unique_id=1844881760 instance=ExtResource("1_3yqjc")]
transform = Transform3D(2, 0, -1.7484552e-07, 0, 4.0035005, 0, 3.496911e-07, 0, 0.9999998, -15, 5.5, 18) transform = Transform3D(2, 0, -1.7484552e-07, 0, 4.0035005, 0, 3.496911e-07, 0, 0.9999998, -15, 5.5, 18)
collision_layer = 17
collision_mask = 17
[node name="WallBase32" parent="Walls/BiiigWall4" unique_id=1280563607 instance=ExtResource("1_3yqjc")] [node name="WallBase32" parent="Walls/BiiigWall4" unique_id=1280563607 instance=ExtResource("1_3yqjc")]
transform = Transform3D(6.16, 0, -1.7484541e-07, 0, 4.05, 0, 1.0770486e-06, 0, 0.9999992, 0, 5.5, 18) transform = Transform3D(6.16, 0, -1.7484541e-07, 0, 4.05, 0, 1.0770486e-06, 0, 0.9999992, 0, 5.5, 18)
collision_layer = 17
collision_mask = 17
[node name="WallBase36" parent="Walls/BiiigWall4" unique_id=535457386 instance=ExtResource("1_3yqjc")] [node name="WallBase36" parent="Walls/BiiigWall4" unique_id=535457386 instance=ExtResource("1_3yqjc")]
transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, -10.501167, 7, 17.999584) transform = Transform3D(1, 0, -1.7484555e-07, 0, 3.0069256, 0, 1.7484555e-07, 0, 1, -10.501167, 7, 17.999584)
collision_layer = 17
collision_mask = 17
[node name="StaticBody3D" type="StaticBody3D" parent="Walls" unique_id=627574478] [node name="StaticBody3D" type="StaticBody3D" parent="Walls" unique_id=627574478]
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/StaticBody3D" unique_id=1587727920] [node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/StaticBody3D" unique_id=1587727920]
shape = SubResource("BoxShape3D_b5l5s") shape = SubResource("BoxShape3D_b5l5s")
@ -191,35 +148,9 @@ pixel_size = 0.1
billboard = 1 billboard = 1
text = "Big part" text = "Big part"
[node name="SpotLight3D" type="SpotLight3D" parent="." unique_id=1680502971]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, -10, 11.499046, 9)
spot_range = 18.55306
spot_angle = 73.125
[node name="SpotLight3D2" type="SpotLight3D" parent="." unique_id=2020319668]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 9, 11.095684, 9)
spot_range = 18.55306
spot_angle = 73.125
[node name="SpotLight3D3" type="SpotLight3D" parent="." unique_id=299944414]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 9, 11.095684, -9)
spot_range = 18.55306
spot_angle = 73.125
[node name="SpotLight3D4" type="SpotLight3D" parent="." unique_id=1550519126]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, -6, 11.095684, -9)
spot_range = 18.55306
spot_angle = 73.125
[node name="Volume" type="Area3D" parent="." unique_id=2146805842] [node name="Volume" type="Area3D" parent="." unique_id=2146805842]
unique_name_in_owner = true unique_name_in_owner = true
[node name="CollisionShape3D" type="CollisionShape3D" parent="Volume" unique_id=275812274] [node name="CollisionShape3D" type="CollisionShape3D" parent="Volume" unique_id=275812274]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 6, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 6, 0)
shape = SubResource("BoxShape3D_sdg7d") shape = SubResource("BoxShape3D_sdg7d")
[node name="MusicPlayer" parent="." unique_id=1866568806 instance=ExtResource("4_adfox")]
transform = Transform3D(-4.371139e-08, 0, 1, 0, 1, 0, -1, 0, -4.371139e-08, -17.367523, 1.2723811, -4.501629)
[node name="OmniLight3D" type="OmniLight3D" parent="MusicPlayer" unique_id=1888250769]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6807523, 0.5101266, 0)

View file

@ -1,7 +1,7 @@
[gd_scene format=3 uid="uid://doddrjiew6eov"] [gd_scene format=3 uid="uid://doddrjiew6eov"]
[ext_resource type="Script" uid="uid://djswykurjuy6u" path="res://scenes/maps/procedural_map_parts_ver_premade/parts/end_part.gd" id="1_rm6ay"] [ext_resource type="Script" uid="uid://djswykurjuy6u" path="res://maps/procedural_map_parts_ver_premade/parts/end_part.gd" id="1_rm6ay"]
[ext_resource type="PackedScene" uid="uid://dyh7k0iqmoa1s" path="res://scenes/maps/procedural_map_parts_ver_premade/blocks/wall_hole_base.tscn" id="2_p5ot5"] [ext_resource type="PackedScene" uid="uid://dyh7k0iqmoa1s" path="res://maps/procedural_map_parts_ver_premade/blocks/wall_hole_base.tscn" id="2_p5ot5"]
[sub_resource type="BoxShape3D" id="BoxShape3D_60a4j"] [sub_resource type="BoxShape3D" id="BoxShape3D_60a4j"]
size = Vector3(3, 3, 0.2) size = Vector3(3, 3, 0.2)
@ -19,8 +19,6 @@ script = ExtResource("1_rm6ay")
[node name="Wall" type="StaticBody3D" parent="Walls" unique_id=1096881998] [node name="Wall" type="StaticBody3D" parent="Walls" unique_id=1096881998]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Wall" unique_id=1704959952] [node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Wall" unique_id=1704959952]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -1.5) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -1.5)
@ -31,8 +29,6 @@ mesh = SubResource("BoxMesh_b5l5s")
[node name="Wall2" type="StaticBody3D" parent="Walls" unique_id=1708831491] [node name="Wall2" type="StaticBody3D" parent="Walls" unique_id=1708831491]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Wall2" unique_id=2076268913] [node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Wall2" unique_id=2076268913]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1.5) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 1.5)
@ -43,8 +39,6 @@ mesh = SubResource("BoxMesh_b5l5s")
[node name="Wall3" type="StaticBody3D" parent="Walls" unique_id=1464090892] [node name="Wall3" type="StaticBody3D" parent="Walls" unique_id=1464090892]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Wall3" unique_id=813882010] [node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Wall3" unique_id=813882010]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 2.5, 0) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 2.5, 0)
@ -54,8 +48,6 @@ shape = SubResource("BoxShape3D_60a4j")
mesh = SubResource("BoxMesh_b5l5s") mesh = SubResource("BoxMesh_b5l5s")
[node name="Wall5" type="StaticBody3D" parent="Walls" unique_id=597577595] [node name="Wall5" type="StaticBody3D" parent="Walls" unique_id=597577595]
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Wall5" unique_id=885758063] [node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Wall5" unique_id=885758063]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0, 0) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0, 0)
@ -66,8 +58,6 @@ mesh = SubResource("BoxMesh_b5l5s")
[node name="Wall4" type="StaticBody3D" parent="Walls" unique_id=1177443253] [node name="Wall4" type="StaticBody3D" parent="Walls" unique_id=1177443253]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Wall4" unique_id=854664258] [node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Wall4" unique_id=854664258]
transform = Transform3D(-4.371139e-08, 4.371139e-08, -1, 1, 1.9106855e-15, -4.371139e-08, 0, -1, -4.371139e-08, -1.5, 1, 0) transform = Transform3D(-4.371139e-08, 4.371139e-08, -1, 1, 1.9106855e-15, -4.371139e-08, 0, -1, -4.371139e-08, -1.5, 1, 0)

View file

@ -1,8 +1,8 @@
[gd_scene format=3 uid="uid://do7paidwkyx2e"] [gd_scene format=3 uid="uid://do7paidwkyx2e"]
[ext_resource type="Script" uid="uid://c6asgt1euaglh" path="res://scenes/maps/procedural_map_parts_ver_premade/parts/medium_part.gd" id="1_lljjn"] [ext_resource type="Script" uid="uid://c6asgt1euaglh" path="res://maps/procedural_map_parts_ver_premade/parts/medium_part.gd" id="1_lljjn"]
[ext_resource type="PackedScene" uid="uid://dpipi1pttxrcp" path="res://scenes/maps/procedural_map_parts_ver_premade/blocks/wall_base.tscn" id="1_uhbr2"] [ext_resource type="PackedScene" uid="uid://dpipi1pttxrcp" path="res://maps/procedural_map_parts_ver_premade/blocks/wall_base.tscn" id="1_uhbr2"]
[ext_resource type="PackedScene" uid="uid://dyh7k0iqmoa1s" path="res://scenes/maps/procedural_map_parts_ver_premade/blocks/wall_hole_base.tscn" id="2_hu2t6"] [ext_resource type="PackedScene" uid="uid://dyh7k0iqmoa1s" path="res://maps/procedural_map_parts_ver_premade/blocks/wall_hole_base.tscn" id="2_hu2t6"]
[sub_resource type="BoxShape3D" id="BoxShape3D_hu2t6"] [sub_resource type="BoxShape3D" id="BoxShape3D_hu2t6"]
size = Vector3(18, 18, 0.2) size = Vector3(18, 18, 0.2)
@ -40,18 +40,12 @@ transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -1.5
[node name="WallBase" parent="Walls/Bigwall1" unique_id=1490575404 instance=ExtResource("1_uhbr2")] [node name="WallBase" parent="Walls/Bigwall1" unique_id=1490575404 instance=ExtResource("1_uhbr2")]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -1.5, 4.5, 0) transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -1.5, 4.5, 0)
collision_layer = 17
collision_mask = 17
[node name="WallBase5" parent="Walls/Bigwall1" unique_id=1568037655 instance=ExtResource("1_uhbr2")] [node name="WallBase5" parent="Walls/Bigwall1" unique_id=1568037655 instance=ExtResource("1_uhbr2")]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 2, 0, 1, 0, -4.371139e-08, -1.5, 3, -3) transform = Transform3D(-4.371139e-08, 0, -1, 0, 2, 0, 1, 0, -4.371139e-08, -1.5, 3, -3)
collision_layer = 17
collision_mask = 17
[node name="WallBase14" parent="Walls/Bigwall1" unique_id=78975883 instance=ExtResource("1_uhbr2")] [node name="WallBase14" parent="Walls/Bigwall1" unique_id=78975883 instance=ExtResource("1_uhbr2")]
transform = Transform3D(-1.7484555e-07, 0, -0.9999999, 0, 2, 0, 4, 0, -4.3711385e-08, -1.5, 3, 7.5) transform = Transform3D(-1.7484555e-07, 0, -0.9999999, 0, 2, 0, 4, 0, -4.3711385e-08, -1.5, 3, 7.5)
collision_layer = 17
collision_mask = 17
[node name="Bigwall2" type="Node3D" parent="Walls" unique_id=826907750] [node name="Bigwall2" type="Node3D" parent="Walls" unique_id=826907750]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 4.498831, 0, -7.500418) transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 4.498831, 0, -7.500418)
@ -66,28 +60,18 @@ transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -1.5
[node name="WallBase5" parent="Walls/Bigwall2" unique_id=2118713508 instance=ExtResource("1_uhbr2")] [node name="WallBase5" parent="Walls/Bigwall2" unique_id=2118713508 instance=ExtResource("1_uhbr2")]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 2, 0, 1, 0, -4.371139e-08, -1.4999995, 3, -3) transform = Transform3D(-4.371139e-08, 0, -1, 0, 2, 0, 1, 0, -4.371139e-08, -1.4999995, 3, -3)
collision_layer = 17
collision_mask = 17
[node name="WallBase7" parent="Walls/Bigwall2" unique_id=1874271673 instance=ExtResource("1_uhbr2")] [node name="WallBase7" parent="Walls/Bigwall2" unique_id=1874271673 instance=ExtResource("1_uhbr2")]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 2, 0, 1, 0, -4.371139e-08, -1.5000014, 3, 12) transform = Transform3D(-4.371139e-08, 0, -1, 0, 2, 0, 1, 0, -4.371139e-08, -1.5000014, 3, 12)
collision_layer = 17
collision_mask = 17
[node name="WallBase10" parent="Walls/Bigwall2" unique_id=196260154 instance=ExtResource("1_uhbr2")] [node name="WallBase10" parent="Walls/Bigwall2" unique_id=196260154 instance=ExtResource("1_uhbr2")]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -1.5, 4.5, 0) transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -1.5, 4.5, 0)
collision_layer = 17
collision_mask = 17
[node name="WallBase12" parent="Walls/Bigwall2" unique_id=917303298 instance=ExtResource("1_uhbr2")] [node name="WallBase12" parent="Walls/Bigwall2" unique_id=917303298 instance=ExtResource("1_uhbr2")]
transform = Transform3D(-8.742278e-08, 0, -0.99999994, 0, 2, 0, 2, 0, -4.3711385e-08, -1.5000005, 3, 4.5) transform = Transform3D(-8.742278e-08, 0, -0.99999994, 0, 2, 0, 2, 0, -4.3711385e-08, -1.5000005, 3, 4.5)
collision_layer = 17
collision_mask = 17
[node name="WallBase13" parent="Walls/Bigwall2" unique_id=438748995 instance=ExtResource("1_uhbr2")] [node name="WallBase13" parent="Walls/Bigwall2" unique_id=438748995 instance=ExtResource("1_uhbr2")]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -1.5, 4.5, 9) transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -1.5, 4.5, 9)
collision_layer = 17
collision_mask = 17
[node name="Bigwall3" type="Node3D" parent="Walls" unique_id=933519333] [node name="Bigwall3" type="Node3D" parent="Walls" unique_id=933519333]
transform = Transform3D(-1, 0, 8.742278e-08, 0, 1, 0, -8.742278e-08, 0, -1, 7.498831, 0, 4.499582) transform = Transform3D(-1, 0, 8.742278e-08, 0, 1, 0, -8.742278e-08, 0, -1, 7.498831, 0, 4.499582)
@ -98,31 +82,21 @@ transform = Transform3D(-4.371138e-08, 0, -1, 0, 1, 0, 1, 0, -4.371138e-08, -1.4
[node name="WallBase5" parent="Walls/Bigwall3" unique_id=894275908 instance=ExtResource("1_uhbr2")] [node name="WallBase5" parent="Walls/Bigwall3" unique_id=894275908 instance=ExtResource("1_uhbr2")]
transform = Transform3D(-4.371138e-08, 0, -1, 0, 2, 0, 1, 0, -4.371138e-08, -1.5000005, 3, -2.999999) transform = Transform3D(-4.371138e-08, 0, -1, 0, 2, 0, 1, 0, -4.371138e-08, -1.5000005, 3, -2.999999)
collision_layer = 17
collision_mask = 17
[node name="WallBase9" parent="Walls/Bigwall3" unique_id=2070677842 instance=ExtResource("1_uhbr2")] [node name="WallBase9" parent="Walls/Bigwall3" unique_id=2070677842 instance=ExtResource("1_uhbr2")]
transform = Transform3D(-1.792167e-07, 0, -0.9999996, 0, 2.0400002, 0, 4.1000004, 0, -4.371136e-08, -1.5000005, 3, 7.5) transform = Transform3D(-1.792167e-07, 0, -0.9999996, 0, 2.0400002, 0, 4.1000004, 0, -4.371136e-08, -1.5000005, 3, 7.5)
collision_layer = 17
collision_mask = 17
[node name="WallBase10" parent="Walls/Bigwall3" unique_id=1020605827 instance=ExtResource("1_uhbr2")] [node name="WallBase10" parent="Walls/Bigwall3" unique_id=1020605827 instance=ExtResource("1_uhbr2")]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -1.5, 4.5, 0) transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -1.5, 4.5, 0)
collision_layer = 17
collision_mask = 17
[node name="Bigwall4" type="Node3D" parent="Walls" unique_id=505150141] [node name="Bigwall4" type="Node3D" parent="Walls" unique_id=505150141]
transform = Transform3D(1.3113416e-07, 0, 1, 0, 1, 0, -1, 0, 1.3113416e-07, -4.501169, 0, 7.499582) transform = Transform3D(1.3113416e-07, 0, 1, 0, 1, 0, -1, 0, 1.3113416e-07, -4.501169, 0, 7.499582)
[node name="WallBase5" parent="Walls/Bigwall4" unique_id=2116321947 instance=ExtResource("1_uhbr2")] [node name="WallBase5" parent="Walls/Bigwall4" unique_id=2116321947 instance=ExtResource("1_uhbr2")]
transform = Transform3D(-2.6226832e-07, 0, -0.9999991, 0, 2, 0, 6, 0, -4.3711353e-08, -1.5, 3, 4.5) transform = Transform3D(-2.6226832e-07, 0, -0.9999991, 0, 2, 0, 6, 0, -4.3711353e-08, -1.5, 3, 4.5)
collision_layer = 17
collision_mask = 17
[node name="Ceiling" type="StaticBody3D" parent="Walls" unique_id=48906640] [node name="Ceiling" type="StaticBody3D" parent="Walls" unique_id=48906640]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Ceiling" unique_id=719217371] [node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Ceiling" unique_id=719217371]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 5.5, 0) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 5.5, 0)
@ -133,8 +107,6 @@ mesh = SubResource("BoxMesh_lljjn")
[node name="Floor" type="StaticBody3D" parent="Walls" unique_id=42562663] [node name="Floor" type="StaticBody3D" parent="Walls" unique_id=42562663]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -5.5, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -5.5, 0)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Floor" unique_id=1790086579] [node name="CollisionShape3D" type="CollisionShape3D" parent="Walls/Floor" unique_id=1790086579]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 5.5, 0) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 5.5, 0)
@ -145,8 +117,6 @@ mesh = SubResource("BoxMesh_lljjn")
[node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=1256542062] [node name="StaticBody3D" type="StaticBody3D" parent="." unique_id=1256542062]
transform = Transform3D(-4.3711385e-08, -3.2555902e-15, -1, -0.5224327, 0.8526805, 2.283626e-08, 0.8526805, 0.5224327, -3.7271846e-08, -7.9658985, 1.6422927, 0.31512594) transform = Transform3D(-4.3711385e-08, -3.2555902e-15, -1, -0.5224327, 0.8526805, 2.283626e-08, 0.8526805, 0.5224327, -3.7271846e-08, -7.9658985, 1.6422927, 0.31512594)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" unique_id=450792456] [node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D" unique_id=450792456]
transform = Transform3D(0.9981775, -0.060490817, 8.0049745e-11, 0.060490817, 0.9981775, -2.6441462e-09, 7.990053e-11, 2.644299e-09, 1, 0.9831743, 0.36734676, 0) transform = Transform3D(0.9981775, -0.060490817, 8.0049745e-11, 0.060490817, 0.9981775, -2.6441462e-09, 7.990053e-11, 2.644299e-09, 1, 0.9831743, 0.36734676, 0)
@ -158,8 +128,6 @@ mesh = SubResource("BoxMesh_b0it3")
[node name="StaticBody3D2" type="StaticBody3D" parent="." unique_id=878315782] [node name="StaticBody3D2" type="StaticBody3D" parent="." unique_id=878315782]
transform = Transform3D(-4.371138e-08, 0, -1, 5.9604645e-08, 1, 8.881784e-16, 1, -5.9604645e-08, -4.3711385e-08, -7.965729, 2.9630294, -4.5) transform = Transform3D(-4.371138e-08, 0, -1, 5.9604645e-08, 1, 8.881784e-16, 1, -5.9604645e-08, -4.3711385e-08, -7.965729, 2.9630294, -4.5)
collision_layer = 17
collision_mask = 17
[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D2" unique_id=264240136] [node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D2" unique_id=264240136]
shape = SubResource("BoxShape3D_b5l5s") shape = SubResource("BoxShape3D_b5l5s")
@ -169,27 +137,19 @@ mesh = SubResource("BoxMesh_b5l5s")
[node name="SpotLight3D" type="SpotLight3D" parent="." unique_id=1345223811] [node name="SpotLight3D" type="SpotLight3D" parent="." unique_id=1345223811]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 4, 5, -5) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 4, 5, -5)
spot_range = 16.504
spot_angle = 49.19 spot_angle = 49.19
spot_angle_attenuation = 0.5358873
[node name="SpotLight3D2" type="SpotLight3D" parent="." unique_id=903847514] [node name="SpotLight3D2" type="SpotLight3D" parent="." unique_id=903847514]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, -4, 5, -5) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, -4, 5, -5)
spot_range = 16.504
spot_angle = 49.19 spot_angle = 49.19
spot_angle_attenuation = 0.5358873
[node name="SpotLight3D3" type="SpotLight3D" parent="." unique_id=2133169158] [node name="SpotLight3D3" type="SpotLight3D" parent="." unique_id=2133169158]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 4, 5, 5) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 4, 5, 5)
spot_range = 16.504
spot_angle = 49.19 spot_angle = 49.19
spot_angle_attenuation = 0.5358873
[node name="SpotLight3D4" type="SpotLight3D" parent="." unique_id=626724313] [node name="SpotLight3D4" type="SpotLight3D" parent="." unique_id=626724313]
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, -4, 5, 5) transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, -4, 5, 5)
spot_range = 16.504
spot_angle = 49.19 spot_angle = 49.19
spot_angle_attenuation = 0.5358873
[node name="Label3D" type="Label3D" parent="." unique_id=2021504335] [node name="Label3D" type="Label3D" parent="." unique_id=2021504335]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0)

View file

@ -1,8 +1,8 @@
[gd_scene format=3 uid="uid://tap7imlv8vb0"] [gd_scene format=3 uid="uid://tap7imlv8vb0"]
[ext_resource type="Script" uid="uid://u8cgplsupfdj" path="res://scenes/maps/procedural_map_parts_ver_premade/parts/small_part.gd" id="1_u3woj"] [ext_resource type="Script" uid="uid://u8cgplsupfdj" path="res://maps/procedural_map_parts_ver_premade/parts/small_part.gd" id="1_u3woj"]
[ext_resource type="PackedScene" uid="uid://dpipi1pttxrcp" path="res://scenes/maps/procedural_map_parts_ver_premade/blocks/wall_base.tscn" id="2_nyrt0"] [ext_resource type="PackedScene" uid="uid://dpipi1pttxrcp" path="res://maps/procedural_map_parts_ver_premade/blocks/wall_base.tscn" id="2_nyrt0"]
[ext_resource type="PackedScene" uid="uid://dyh7k0iqmoa1s" path="res://scenes/maps/procedural_map_parts_ver_premade/blocks/wall_hole_base.tscn" id="3_kp5l2"] [ext_resource type="PackedScene" uid="uid://dyh7k0iqmoa1s" path="res://maps/procedural_map_parts_ver_premade/blocks/wall_hole_base.tscn" id="3_kp5l2"]
[sub_resource type="BoxShape3D" id="BoxShape3D_u3woj"] [sub_resource type="BoxShape3D" id="BoxShape3D_u3woj"]
size = Vector3(3, 3, 9) size = Vector3(3, 3, 9)
@ -14,23 +14,15 @@ script = ExtResource("1_u3woj")
[node name="WallBase2" parent="Walls" unique_id=1947232728 instance=ExtResource("2_nyrt0")] [node name="WallBase2" parent="Walls" unique_id=1947232728 instance=ExtResource("2_nyrt0")]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 1.5, 1.5, -3) transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 1.5, 1.5, -3)
collision_layer = 17
collision_mask = 17
[node name="WallBase3" parent="Walls" unique_id=657146167 instance=ExtResource("2_nyrt0")] [node name="WallBase3" parent="Walls" unique_id=657146167 instance=ExtResource("2_nyrt0")]
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 1.5, 1.5, 3) transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 1.5, 1.5, 3)
collision_layer = 17
collision_mask = 17
[node name="WallBase4" parent="Walls" unique_id=1353383013 instance=ExtResource("2_nyrt0")] [node name="WallBase4" parent="Walls" unique_id=1353383013 instance=ExtResource("2_nyrt0")]
transform = Transform3D(-1.3113416e-07, 0, -0.99999994, 0, 1, 0, 3, 0, -4.3711385e-08, -1.5, 1.5, 0) transform = Transform3D(-1.3113416e-07, 0, -0.99999994, 0, 1, 0, 3, 0, -4.3711385e-08, -1.5, 1.5, 0)
collision_layer = 17
collision_mask = 17
[node name="Ceiling7" parent="Walls" unique_id=1993669613 instance=ExtResource("2_nyrt0")] [node name="Ceiling7" parent="Walls" unique_id=1993669613 instance=ExtResource("2_nyrt0")]
transform = Transform3D(5.7320566e-15, -1, 4.3711385e-08, -1.3113416e-07, -4.371139e-08, -0.99999994, 3, 0, -4.3711385e-08, 0, 3, 0) transform = Transform3D(5.7320566e-15, -1, 4.3711385e-08, -1.3113416e-07, -4.371139e-08, -0.99999994, 3, 0, -4.3711385e-08, 0, 3, 0)
collision_layer = 17
collision_mask = 17
[node name="SpotLight3D" type="SpotLight3D" parent="Walls" unique_id=301965768] [node name="SpotLight3D" type="SpotLight3D" parent="Walls" unique_id=301965768]
transform = Transform3D(1.9106855e-15, -1, 4.371139e-08, -4.371139e-08, 4.371139e-08, 1, -1, -3.821371e-15, -4.371139e-08, 0, 3, -3) transform = Transform3D(1.9106855e-15, -1, 4.371139e-08, -4.371139e-08, 4.371139e-08, 1, -1, -3.821371e-15, -4.371139e-08, 0, 3, -3)
@ -40,8 +32,6 @@ transform = Transform3D(1.9106855e-15, -1, 4.371139e-08, -4.371139e-08, 4.371139
[node name="Floor10" parent="Walls" unique_id=1490575404 instance=ExtResource("2_nyrt0")] [node name="Floor10" parent="Walls" unique_id=1490575404 instance=ExtResource("2_nyrt0")]
transform = Transform3D(5.7320566e-15, -1, 4.3711385e-08, -1.3113416e-07, -4.371139e-08, -0.99999994, 3, 0, -4.3711385e-08, 0, 0, 0) transform = Transform3D(5.7320566e-15, -1, 4.3711385e-08, -1.3113416e-07, -4.371139e-08, -0.99999994, 3, 0, -4.3711385e-08, 0, 0, 0)
collision_layer = 17
collision_mask = 17
[node name="WallHoleBase" parent="Walls" unique_id=116609943 instance=ExtResource("3_kp5l2")] [node name="WallHoleBase" parent="Walls" unique_id=116609943 instance=ExtResource("3_kp5l2")]
unique_name_in_owner = true unique_name_in_owner = true

View file

@ -1,8 +1,8 @@
[gd_scene format=3 uid="uid://cgtq0bwlps87x"] [gd_scene format=3 uid="uid://cgtq0bwlps87x"]
[ext_resource type="Script" uid="uid://b81cq1wvkdtlg" path="res://scenes/maps/procedural_map_ver_generated_parts/map_generator.gd" id="1_rupvp"] [ext_resource type="Script" uid="uid://b81cq1wvkdtlg" path="res://maps/procedural_map_ver_generated_parts/map_generator.gd" id="1_rupvp"]
[ext_resource type="PackedScene" uid="uid://5k3qstcxs2p0" path="res://scenes/maps/procedural_map_ver_generated_parts/floor.tscn" id="2_wti8w"] [ext_resource type="PackedScene" uid="uid://5k3qstcxs2p0" path="res://maps/procedural_map_ver_generated_parts/floor.tscn" id="2_wti8w"]
[ext_resource type="PackedScene" uid="uid://b50hwp4iervw" path="res://scenes/maps/procedural_map_ver_generated_parts/wall.tscn" id="3_uig64"] [ext_resource type="PackedScene" uid="uid://b50hwp4iervw" path="res://maps/procedural_map_ver_generated_parts/wall.tscn" id="3_uig64"]
[node name="MapGenerator" type="Node3D" unique_id=1914632083] [node name="MapGenerator" type="Node3D" unique_id=1914632083]
script = ExtResource("1_rupvp") script = ExtResource("1_rupvp")

View file

@ -15,7 +15,7 @@ general/updates_per_second=100
[application] [application]
config/name="breadwinner" config/name="breadwinner"
run/main_scene="uid://cerpwmavwn8t" run/main_scene="uid://chykk2a3opu0d"
config/features=PackedStringArray("4.7", "Forward Plus") config/features=PackedStringArray("4.7", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"
@ -29,12 +29,12 @@ driver/output_latency=30
Console="*uid://bojihx1fwf426" Console="*uid://bojihx1fwf426"
PlayerConsts="*uid://l2rc674shj03" PlayerConsts="*uid://l2rc674shj03"
Sounds="*uid://c4vhdhbi2yu8i" Sounds="*uid://c4vhdhbi2yu8i"
LoadingScreen="*uid://br8pa51piwxuy"
GrabbableBase="*uid://csj6ipagcwmeu" GrabbableBase="*uid://csj6ipagcwmeu"
Report="*uid://c76y0hv0jqdr3" Report="*uid://c76y0hv0jqdr3"
UiManager="*uid://dtrfb3xosj32r" UiManager="*uid://dtrfb3xosj32r"
GameState="*uid://drxx0ny7uim8k" GameState="*uid://drxx0ny7uim8k"
GlobalSignals="*uid://cky5rk5obojex" GlobalSignals="*uid://cky5rk5obojex"
SceneLoader="*uid://bniwncdtbehd3"
[display] [display]
@ -43,6 +43,7 @@ window/size/viewport_height=1080
window/size/resizable=false window/size/resizable=false
window/stretch/mode="canvas_items" window/stretch/mode="canvas_items"
window/stretch/aspect="expand" window/stretch/aspect="expand"
window/vsync/vsync_mode=0
window/max_fps=60 window/max_fps=60
[editor] [editor]
@ -50,10 +51,6 @@ window/max_fps=60
version_control/plugin_name="GitPlugin" version_control/plugin_name="GitPlugin"
version_control/autoload_on_startup=true version_control/autoload_on_startup=true
[editor_plugins]
enabled=PackedStringArray("res://addons/raytraced_audio/plugin.cfg")
[file_customization] [file_customization]
folder_colors={ folder_colors={
@ -61,10 +58,10 @@ folder_colors={
"res://assets/": "red", "res://assets/": "red",
"res://classes/": "pink", "res://classes/": "pink",
"res://concept/": "purple", "res://concept/": "purple",
"res://resources/shaders/": "pink", "res://maps/": "orange",
"res://scenes/": "blue", "res://scenes/": "blue",
"res://scenes/maps/": "orange", "res://scripts/": "gray",
"res://scripts/": "gray" "res://shaders/": "pink"
} }
[filesystem] [filesystem]
@ -74,10 +71,8 @@ import/blender/enabled=false
[global_group] [global_group]
grabbable="this object can be grabbed" grabbable="this object can be grabbed"
equippable="the item is equippable"
player="players" player="players"
pickupable="the item is equippable"
equippable=""
sound_player=""
[input] [input]
@ -201,7 +196,7 @@ open_menu={
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":true,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":true,"script":null)
] ]
} }
use={ equip={
"deadzone": 0.2, "deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":114,"location":0,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":82,"key_label":0,"unicode":114,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":true,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":true,"script":null)
@ -306,11 +301,6 @@ common/physics_jitter_fix=0.8
3d/physics_engine="Jolt Physics" 3d/physics_engine="Jolt Physics"
common/physics_interpolation=true common/physics_interpolation=true
[raytraced_audio]
reverb_bus=&"RaytracedReverb"
ambient_bus=&"RaytracedAmbient"
[rendering] [rendering]
rendering_device/driver.windows="d3d12" rendering_device/driver.windows="d3d12"

View file

@ -1,43 +0,0 @@
[gd_resource type="Theme" format=3 uid="uid://bspxrgwuidr02"]
[ext_resource type="FontFile" uid="uid://ddnuq5h5loicn" path="res://assets/fonts/BebasNeue-Regular.ttf" id="1_wj4bu"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_8sp8n"]
bg_color = Color(0.25490198, 0.25490198, 0.25490198, 0.3019608)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_m25cb"]
bg_color = Color(0.29411766, 0.29411766, 0.29411766, 0.49803922)
border_width_left = 5
border_width_top = 5
border_width_right = 5
border_width_bottom = 5
border_color = Color(1, 1, 1, 1)
corner_radius_top_left = 5
corner_radius_top_right = 5
corner_radius_bottom_right = 5
corner_radius_bottom_left = 5
[resource]
default_base_scale = 0.52
default_font = ExtResource("1_wj4bu")
Button/colors/font_color = Color(0.7792914, 0.7792914, 0.7792913, 1)
Button/colors/font_disabled_color = Color(0.46160597, 0.44038838, 0.44974285, 1)
Button/colors/font_focus_color = Color(0.30068555, 0.45265424, 0.73330176, 1)
Button/colors/font_hover_color = Color(1, 1, 1, 1)
Button/colors/font_hover_pressed_color = Color(0.97210664, 0.96787745, 0.96980983, 1)
Button/colors/font_outline_color = Color(0.7946597, 0, 0.26732337, 1)
Button/colors/font_pressed_color = Color(0.9287819, 0.80930334, 7.70092e-07, 1)
Button/colors/icon_normal_color = Color(0, 0, 0, 1)
Button/colors/icon_pressed_color = Color(0, 0, 0, 1)
Button/constants/align_to_largest_stylebox = 0
Button/constants/h_separation = 0
Button/constants/icon_max_width = 0
Button/constants/outline_size = 0
Button/font_sizes/font_size = 32
Button/fonts/font = ExtResource("1_wj4bu")
Button/styles/disabled = SubResource("StyleBoxFlat_8sp8n")
Button/styles/focus = SubResource("StyleBoxFlat_m25cb")
Button/styles/hover = SubResource("StyleBoxFlat_m25cb")
Button/styles/normal = null
Button/styles/pressed = null
Label/font_sizes/font_size = 32

View file

@ -1,90 +0,0 @@
class_name ChangableAudioStreamPlayer3D extends AudioStreamPlayer3D
## If enabled, it will default to an [color=#f00] AudioStreamPlayer3D [/color] [br]
## If disabled, it will use [color=#ff0]SpatialAudio3D [/color]
@export var easy_audio: bool = true:
set(value):
easy_audio = value
if value:
set_to_easy_audio()
else:
set_to_raytraced_audio()
#@export_group("SpatialAudio3D properties")
#@export_subgroup("Sound Properties")
#@export var reverb_enabled: bool = true ## Enable reverb-effects with all its computations.[br][br]Disable if you just need it for occlusion detection, for example fading ambient rain when entering a house.
#@export_range(-81, +80, 3.0, "suffix:dB") var reverb_volume_db: float = -6 ## Maximum volume of the reverbs.
#@export_range(-1, 5, 0.05, "or_greater", "suffix:s") var reverb_fadeintime: float = 2.0 ## Fade-in time when a reverb is added at a wall.[br][br]The default of 2s is a good value where changes in environment merge well into the overall sound mix.[br]If you have small areas with little changes of distances, set this value to low (0.2s) so that repositioned reverbs don't get stuck for too long in a position. In a large area, when the raycast suddenly hits a close wall, the sudden appearing reverb can sound unnatural.[br][br]Set to -1 for dynamic fade time (based on wetness).
#@export_range(-1, 8, 0.05, "or_greater", "suffix:s") var reverb_fadeouttime: float = 2.0 ## Fade-out time when a reverb is removed.[br][br]The default of 2s is a good value where changes in environment merge well into the overall sound mix.[br]If you have small areas with little changes of distances, set this value to low (0.2s) so that repositioned reverbs don't get stuck for too long in a position.[br][br]Set to -1 for dynamic fade time (based on wetness).
#@export_range(1, 20_000, 0.1, "suffix:Hz") var occlusion_lp_cutoff: int = 600 ## Frequency when soundsource is occluded behind walls.
#@export_range(0, 5, 0.05, "or_greater", "suffix:s") var occlusion_fadetime: float = 0.5 ## Fadetime when occlusion changes.
#@export_range(0, 100, 0.1, "or_greater", "suffix:m") var bass_proximity: int = 50 ## The closer you are to a wall, the more bass you will hear.[br][br]The effect starts at this value (distance to the wall).[br][br]0 to disable.
#
#@export_subgroup("Physics")
#@export_range(1, 100, 1, "or_greater", "suffix:m") var max_raycast_distance: int = 100 ## Maximum distance for the reverb raycasts.
#@export_flags_3d_physics var collision_mask: int = 1 ## Mask for the raycast where to add reverb.
#@export var roomsize_multiplicator: float = 6.0 ## How much hall to add compared to room size.[br]Sometimes you have a small room but you need a long reverb.
#@export_range(1, 340, 1, "or_greater", "suffix:m/s") var speed_of_sound: int = 340 ## How fast sound travels through the air.
#@export var prox_reduction: float = 24.0 ## How much proximity reduces the reverb
#@export_range(4,32,1) var reverb_raycast_count: int = 4 ##how many reverb raycasts to shoot out horizontally
#
#@export_subgroup("System")
#@export_range(1, 60, 0.1, "or_greater", "suffix:per second") var audiophysics_ticks: int = 10 ## The number of audio physics calculations per second.[br]Tied to _physics_process().[br][br]Use 30-60 for fast moving sounds like a motorcycle passing by.[br][br]Default: 10.
#@export var loop: bool = false ## Loop audio indefinitely.
#@export var shut_up: bool = false ## Mute output.
#@export var debug: bool = false ## Visualize raycasts, measurement rays and reverb-audioplayers.
var audio_player: AudioStreamPlayer3D = null
func do_set_stream(new_stream:AudioStream):
audio_player.stream = new_stream
stream = new_stream
func do_play(start_position: float = 0.0) -> void:
audio_player.play(start_position)
func do_stop() -> void:
audio_player.stop()
func set_to_easy_audio():
if audio_player != null:
audio_player.queue_free()
audio_player = self
func set_to_raytraced_audio() -> void:
if audio_player != null:
audio_player.queue_free()
audio_player = RaytracedAudioPlayer3D.new()
#audio_player.reverb_enabled = reverb_enabled
#audio_player.reverb_volume_db = reverb_volume_db
#audio_player.reverb_fadeintime = reverb_fadeintime
#audio_player.reverb_fadeouttime = reverb_fadeouttime
#audio_player.occlusion_lp_cutoff = occlusion_lp_cutoff
#audio_player.occlusion_fadetime = occlusion_fadetime
#audio_player.bass_proximity = bass_proximity
#
#audio_player.max_raycast_distance = max_raycast_distance
#audio_player.collision_mask = collision_mask
#audio_player.roomsize_multiplicator = roomsize_multiplicator
#audio_player.speed_of_sound = speed_of_sound
#audio_player.prox_reduction = prox_reduction
#audio_player.reverb_raycast_count = reverb_raycast_count
audio_player.name = "music player"
#audio_player.loop = loop
#audio_player.shut_up = shut_up
#audio_player.debug = debug
add_child(audio_player)
func _ready() -> void:
add_to_group("sound_player")
if easy_audio:
set_to_easy_audio()
else:
set_to_raytraced_audio()
audio_player.stream = stream
audio_player.global_position = global_position

View file

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

View file

@ -1,6 +0,0 @@
[gd_scene format=3 uid="uid://uwrlh36ij3y2"]
[ext_resource type="Script" uid="uid://v7j6ovrub5cp" path="res://scenes/changable_sound_emitter.gd" id="1_yhyrq"]
[node name="ChangableAudioStreamPlayer3D" type="AudioStreamPlayer3D" unique_id=783874887]
script = ExtResource("1_yhyrq")

View file

@ -1,48 +0,0 @@
extends Button
var tween: Tween
var _mouse_in: bool = false
var _original_position := Vector2.ZERO
func _ready() -> void:
mouse_entered.connect(_on_mouse_entered)
mouse_exited.connect(_on_mouse_exited)
pivot_offset = size / 2
offset_transform_enabled = true
_original_position = offset_transform_position
func _process(_delta: float) -> void:
if _mouse_in:
track_mouse()
func track_mouse() -> void:
var _mouse_adjusted = get_viewport().get_mouse_position() - global_position - size / 2
offset_transform_position = _mouse_adjusted / 10
func reset_tween():
if tween:
tween.kill()
tween = create_tween()
func _on_mouse_entered() -> void:
reset_tween()
tween.set_ease(Tween.EASE_OUT)\
.set_trans(Tween.TRANS_ELASTIC)\
.tween_property(self, "scale", Vector2(1.1,1.1), .5)
_mouse_in = true
func _on_mouse_exited() -> void:
reset_tween()
tween.set_parallel(true)
tween.set_ease(Tween.EASE_OUT)\
.set_trans(Tween.TRANS_ELASTIC)\
.tween_property(self, "scale", Vector2.ONE, .5)
tween.set_ease(Tween.EASE_IN_OUT)\
.set_trans(Tween.TRANS_BOUNCE)\
.tween_property(self, "offset_transform_position", _original_position, .5)
_mouse_in = false

Some files were not shown because too many files have changed in this diff Show more