👽 interstellar delivery

This commit is contained in:
anyreso 2024-10-16 21:43:01 +00:00
parent 547c97bfba
commit 97c8292858
257 changed files with 7309 additions and 4637 deletions

View file

@ -15,6 +15,10 @@
extends Node
signal type_changed(type : Node)
signal exit_pressed
## The default [Environment] for the game.
var environment := Environment.new()
## This is the type currently used by the game.
var type : Node:
@ -27,10 +31,16 @@ var type : Node:
# keep reference to new type
type = new_type
if type != null:
get_tree().get_root().add_child(type)
get_tree().current_scene.add_child(type)
type_changed.emit(type)
func quit() -> void:
get_tree().quit()
func _unhandled_input(event : InputEvent) -> void:
if event.is_action_pressed("exit"):
exit_pressed.emit()
# switch window mode
if event.is_action_pressed("window_mode"):
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN:

View file

@ -12,51 +12,26 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
## Manage environment settings and terrain maps within a scene.
extends Node
## The list of available maps.
## @experimental
@export var maps : Array[PackedScene]
## The default [Environment] used by the current scene in case the [Terrain3D]
## node does not have a [WorldEnvironment] as one of its children.
var environment := Environment.new()
## Random number generator instance
var _rng := RandomNumberGenerator.new()
## Reference to the current terrain map in the scene
## @experimental
var current_map : Terrain3D = null:
set(new_map):
if current_map != null:
current_map.queue_free()
current_map = new_map
# forward user environment settings to current scene environment
var world : World3D = get_viewport().find_world_3d()
if world.environment:
world.environment.sdfgi_enabled = MapsManager.environment.sdfgi_enabled
world.environment.glow_enabled = MapsManager.environment.glow_enabled
world.environment.ssao_enabled = MapsManager.environment.ssao_enabled
world.environment.ssr_enabled = MapsManager.environment.ssr_enabled
world.environment.ssr_max_steps = MapsManager.environment.ssr_max_steps
world.environment.ssil_enabled = MapsManager.environment.ssil_enabled
world.environment.volumetric_fog_enabled = MapsManager.environment.volumetric_fog_enabled
## @experimental
func get_player_spawn() -> Node3D:
if current_map == null:
push_error("MapsManager.current_map is null")
if not current_map or not current_map.has_node("PlayerSpawns"):
return null
if not current_map.has_node("PlayerSpawns"):
push_warning("PlayerSpawns node not found in MapsManager.current_map")
return null
var player_spawns : Node = current_map.get_node("PlayerSpawns")
var spawn_count : int = player_spawns.get_child_count()
if spawn_count == 0:
push_error("PlayerSpawns has no children (%s)" % current_map.name)
return null
var spawn_index : int = _rng.randi_range(0, spawn_count - 1)
var random_spawn : Marker3D = player_spawns.get_child(spawn_index)
return random_spawn
var spawns : Node = current_map.get_node("PlayerSpawns")
if spawns:
var child_count : int = spawns.get_child_count()
return spawns.get_child(
randi_range(0, child_count - 1 if child_count else 0))
return null

View file

@ -24,8 +24,8 @@ func _ready() -> void:
var err : Error = _file.load(self.path)
if err == ERR_FILE_CANT_OPEN:
push_warning("settings not found, using defaults")
# apply state
self.apply()
# save state
save()
func get_value(section: String, key: String, default: Variant = null) -> Variant:
return _file.get_value(section, key, default)
@ -37,7 +37,7 @@ func reset() -> void:
_file.clear()
# video settings
_file.set_value("ui", "scale", 2)
_file.set_value("video", "quality", 1.125)
_file.set_value("video", "quality", 1.)
_file.set_value("video", "filter", 0)
_file.set_value("video", "fsr_sharpness", 0)
_file.set_value("video", "window_mode", 2)
@ -61,5 +61,5 @@ func reset() -> void:
_file.set_value("environment", "ssil", 0)
_file.set_value("environment", "volumetric_fog", 0)
func apply() -> void:
func save() -> void:
_file.save(self.path)

View file

@ -1,20 +0,0 @@
# This file is part of open-fpsz.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
class_name Team extends Object
var team_id : int
func _init(id : int) -> void:
team_id = id