mirror of
https://codeberg.org/sunder/sunder.git
synced 2026-03-07 02:40:23 +00:00
45 lines
1.9 KiB
GDScript
45 lines
1.9 KiB
GDScript
# This file is part of sunder.
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
class_name Map extends Terrain3D
|
|
|
|
@export var spawns:MapSpawns
|
|
|
|
func get_objective_spawn() -> Node3D:
|
|
var random_index:int = randi() % spawns.objectives.size()
|
|
return get_node(spawns.objectives[random_index])
|
|
|
|
func get_player_spawn() -> Node3D:
|
|
var random_index:int = randi() % spawns.players.size()
|
|
return get_node(spawns.players[random_index])
|
|
|
|
func get_spawn_position(key:String) -> Vector3:
|
|
if spawns and key in spawns:
|
|
var spawn:Node3D = get_node(spawns[key].pick_random())
|
|
return spawn.global_position
|
|
return Vector3.ZERO
|
|
|
|
func _ready() -> void:
|
|
Game.map = self
|
|
# forward user env settings to current viewport world env
|
|
var world: World3D = get_viewport().find_world_3d()
|
|
if not world.environment:
|
|
world.environment = Game.environment
|
|
world.environment.sdfgi_enabled = Game.environment.sdfgi_enabled
|
|
world.environment.glow_enabled = Game.environment.glow_enabled
|
|
world.environment.ssao_enabled = Game.environment.ssao_enabled
|
|
world.environment.ssr_enabled = Game.environment.ssr_enabled
|
|
world.environment.ssr_max_steps = Game.environment.ssr_max_steps
|
|
world.environment.ssil_enabled = Game.environment.ssil_enabled
|
|
world.environment.volumetric_fog_enabled = Game.environment.volumetric_fog_enabled
|