Map change
This commit is contained in:
parent
13cfa692ce
commit
337ba22bd3
7 changed files with 45 additions and 11 deletions
|
|
@ -1,5 +1,7 @@
|
|||
extends VBoxContainer
|
||||
|
||||
var levels_by_index: Array[StringName] = []
|
||||
|
||||
func _ready() -> void:
|
||||
%RoundTimeBox.set_value_no_signal(LobbySettings.round_time)
|
||||
%BombTimeBox.set_value_no_signal(LobbySettings.bomb_time)
|
||||
|
|
@ -8,6 +10,13 @@ func _ready() -> void:
|
|||
%RoundBox.set_value_no_signal(LobbySettings.win_score)
|
||||
%AllowMultipleAbilityButton.set_pressed_no_signal(LobbySettings.allow_multiple_abilities)
|
||||
%AllowTeamSwitch.set_pressed_no_signal(LobbySettings.allow_team_switch)
|
||||
|
||||
var popup: PopupMenu = %MapsButton.get_popup()
|
||||
%MapsButton.text = LobbySettings.selected_map
|
||||
popup.index_pressed.connect(on_maps_index_pressed)
|
||||
for level in Registry.maps.keys():
|
||||
levels_by_index.append(level)
|
||||
popup.add_item(level)
|
||||
|
||||
func _on_round_time_box_value_changed(value: float) -> void:
|
||||
LobbySettings.round_time = value
|
||||
|
|
@ -40,3 +49,7 @@ func _on_shuffle_pressed() -> void:
|
|||
|
||||
func _on_allow_team_switch_toggled(toggled_on: bool) -> void:
|
||||
LobbySettings.allow_team_switch = toggled_on
|
||||
|
||||
func on_maps_index_pressed(index: int):
|
||||
%MapsButton.text = levels_by_index[index]
|
||||
LobbySettings.selected_map = levels_by_index[index]
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@
|
|||
[node name="HostMenu" type="VBoxContainer"]
|
||||
script = ExtResource("1_83e8q")
|
||||
|
||||
[node name="MapsButton" type="MenuButton" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
text = "Выбор уровня"
|
||||
|
||||
[node name="Time" type="FoldableContainer" parent="."]
|
||||
layout_mode = 2
|
||||
folded = true
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
[ext_resource type="Environment" uid="uid://ybeuqwdb504c" path="res://environments/split_environment.tres" id="1_muj2s"]
|
||||
[ext_resource type="Material" uid="uid://bx3f5vx71ynh5" path="res://materials/Graymat.tres" id="4_mj4b4"]
|
||||
[ext_resource type="Script" uid="uid://xwiw2g6uc21k" path="res://multiplayer/dynamic_objects_parent.gd" id="5_d2sx1"]
|
||||
[ext_resource type="Script" uid="uid://3i00rp8urth7" path="res://systems/object_container.gd" id="9_klida"]
|
||||
[ext_resource type="Script" uid="uid://ypgm3aplt78m" path="res://multiplayer/team_spawner.gd" id="10_n3y50"]
|
||||
[ext_resource type="Script" path="res://multiplayer/spawn_system/dyn_objects_spawner.gd" id="11_ydk8w"]
|
||||
[ext_resource type="Script" uid="uid://dncldab5y4yod" path="res://systems/item_spawner.gd" id="12_kry5j"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxdgk74ln5xpn" path="res://weapons/bomb/droppable_bomb.tscn" id="13_hy0sx"]
|
||||
|
||||
|
|
@ -23,12 +23,12 @@ script = ExtResource("9_klida")
|
|||
exlusion_list = [NodePath("DefenceSpawn"), NodePath("AttackSpawn"), NodePath("SpectatorSpawn"), NodePath("MultiplayerSpawner")]
|
||||
|
||||
[node name="DefenceSpawn" type="Marker3D" parent="PlayersContainer"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 37.170197, 0.5180037, -11.271502)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 37.170197, 0.5, -11.271502)
|
||||
script = ExtResource("10_n3y50")
|
||||
spawn_radius = 10.0
|
||||
|
||||
[node name="AttackSpawn" type="Marker3D" parent="PlayersContainer"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.38304234, -4.809286, -89.24379)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -31.553003, 0.49999988, 20.371899)
|
||||
script = ExtResource("10_n3y50")
|
||||
team = 1
|
||||
spawn_radius = 5.0
|
||||
|
|
@ -45,15 +45,17 @@ spawn_path = NodePath("..")
|
|||
|
||||
[node name="DynamicObjectsContainer" type="Node3D" parent="." node_paths=PackedStringArray("exlusion_list")]
|
||||
script = ExtResource("9_klida")
|
||||
exlusion_list = [NodePath("MultiplayerSpawner"), NodePath("Bomb")]
|
||||
exlusion_list = [NodePath("MultiplayerSpawner"), NodePath("Bomb"), NodePath("Parenter")]
|
||||
|
||||
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="DynamicObjectsContainer"]
|
||||
_spawnable_scenes = PackedStringArray("uid://dtbpyfdawb02b", "uid://cxdgk74ln5xpn", "uid://dgfqppi21c2u0")
|
||||
_spawnable_scenes = PackedStringArray("uid://cxdgk74ln5xpn", "uid://dtbpyfdawb02b", "uid://dgfqppi21c2u0", "uid://b6qahd6q60js7", "uid://l4t1mflutm3t")
|
||||
spawn_path = NodePath("..")
|
||||
script = ExtResource("11_ydk8w")
|
||||
|
||||
[node name="Parenter" type="Node" parent="DynamicObjectsContainer"]
|
||||
script = ExtResource("5_d2sx1")
|
||||
|
||||
[node name="Bomb" type="Node3D" parent="DynamicObjectsContainer"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.75895405, 1.4657042, -82.2781)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -28.858309, 1.4657042, 12.873563)
|
||||
script = ExtResource("12_kry5j")
|
||||
item = ExtResource("13_hy0sx")
|
||||
|
||||
|
|
|
|||
|
|
@ -148,8 +148,7 @@ func team_switch_notification(team: int) -> void:
|
|||
func start_game() -> void:
|
||||
if not multiplayer.is_server():
|
||||
return
|
||||
get_tree().current_scene.get_node("%MainMenu").visible = false
|
||||
get_tree().current_scene.get_node("%LevelContainer").add_child(preload("res://levels/prototype_scene.tscn").instantiate())
|
||||
get_tree().current_scene.get_node("%LevelContainer").add_child(Registry.maps[LobbySettings.selected_map].instantiate())
|
||||
Session.start_session()
|
||||
|
||||
func get_team() -> Session.TEAMS:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
extends Node
|
||||
|
||||
|
||||
|
||||
var win_score: int = 13
|
||||
var half_rounds :int = 12
|
||||
var bomb_time: float = 45.0
|
||||
|
|
@ -7,3 +9,4 @@ var buy_time: float = 15.0
|
|||
var round_time: float = 150.0
|
||||
var allow_multiple_abilities: bool = false
|
||||
var allow_team_switch: bool = true
|
||||
var selected_map: StringName = "prototype"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,20 @@
|
|||
extends Node
|
||||
|
||||
const MAPS_FOLDER = "res://levels/"
|
||||
const WEAPONS_FOLDER = "res://weapons/"
|
||||
|
||||
var weapons: Dictionary[StringName,WeaponResource]
|
||||
var maps: Dictionary[StringName,PackedScene]
|
||||
|
||||
signal loaded
|
||||
|
||||
func _ready() -> void:
|
||||
for file in ResourceLoader.list_directory("res://weapons/"):
|
||||
for file in ResourceLoader.list_directory(WEAPONS_FOLDER):
|
||||
if file.ends_with(".tres"):
|
||||
weapons[file.trim_suffix(".tres")] = load("res://weapons/"+ file)
|
||||
weapons[file.trim_suffix(".tres")] = load(WEAPONS_FOLDER+ file)
|
||||
|
||||
for file in ResourceLoader.list_directory(MAPS_FOLDER):
|
||||
if file.ends_with(".tscn"):
|
||||
maps[file.trim_suffix(".tscn")] = load(MAPS_FOLDER+ file)
|
||||
|
||||
loaded.emit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue