diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 396c297..7aa0f2a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -47,11 +47,11 @@ If you want to contribute changes without write access to the repository, you ca
2. Once you have a fork, clone it to your local machine and create a new branch from the `develop` branch.
3. Then, you can make changes just like you would if you were a member of the project.
4. After you've made your changes, you commit them locally and push these back to your fork on gitlab.
-5. Finally, you can [create a merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html#when-you-work-in-a-fork) from your fork's branch to upstream's branch.
+5. Finally, you can [create a merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html#when-you-work-in-a-fork) from your fork's branch to upstream's `develop` branch.
> We encourage you to [allow commits from upstream members](https://docs.gitlab.com/ee/user/project/merge_requests/allow_collaboration.html#allow-commits-from-upstream-members) so that they can [push to the fork as the upstream member](https://docs.gitlab.com/ee/user/project/merge_requests/allow_collaboration.html#push-to-the-fork-as-the-upstream-member) in order for you to reach out for help.
-The merge request notifies project maintainers that you've made changes and allows them to review your code and potentially merge it into the main project.
+The merge request notifies project maintainers that you've made changes and allows them to review your code and potentially merge it into the `develop` branch.
When your branch is merged, you may want to [update your fork](https://docs.gitlab.com/ee/user/project/repository/forking_workflow.html#update-your-fork) to be synced with upstream.
diff --git a/components/flag_carry_component.gd b/components/flag_carry_component.gd
index 54eaeaa..021ac9c 100644
--- a/components/flag_carry_component.gd
+++ b/components/flag_carry_component.gd
@@ -12,14 +12,13 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
-class_name FlagCarryComponent extends Node
+class_name FlagCarryComponent extends Node3D
## This component allows its entity to grab, carry and throw flags
##
## To work correctly the owner MUST set an attachment point for carried flags
## and a sensor to detect when flags are within grab range
@export var max_throw_speed : float = 10.0
-@export var attachment : Node3D
@export var sensor : Area3D
@export var carrier : Player
@@ -28,24 +27,26 @@ var _carried_flag : Flag
func _ready() -> void:
sensor.body_entered.connect(_sensor_on_body_entered)
-func _process(_delta : float) -> void:
+func _physics_process(_delta : float) -> void:
if _is_carrying():
- _carried_flag.global_position = attachment.global_position
- _carried_flag.global_rotation = attachment.global_rotation
+ _carried_flag.global_position = global_position
+ _carried_flag.global_rotation = global_rotation
func _grab(flag : Flag) -> void:
if not _is_carrying():
flag.grab(carrier)
_carried_flag = flag
+ show()
func _release(inherited_velocity : Vector3, throw_speed : float) -> void:
if _is_carrying():
_carried_flag.drop()
_carried_flag.rotation_degrees.x = 0.0
- _carried_flag.linear_velocity = inherited_velocity + (attachment.global_basis.z * throw_speed)
+ _carried_flag.linear_velocity = inherited_velocity + (global_basis.z * throw_speed)
# Throw the flag from some distance in front of the player to avoid regrabbing mid-air
- _carried_flag.global_position = _carried_flag.global_position + (attachment.global_basis.z * 1.5)
+ _carried_flag.global_position = _carried_flag.global_position + (global_basis.z * 1.5)
_carried_flag = null
+ hide()
func _is_carrying() -> bool:
return _carried_flag != null
diff --git a/components/flag_carry_component.tscn b/components/flag_carry_component.tscn
index ececd0e..17603b8 100644
--- a/components/flag_carry_component.tscn
+++ b/components/flag_carry_component.tscn
@@ -2,5 +2,5 @@
[ext_resource type="Script" path="res://components/flag_carry_component.gd" id="1_b6ee8"]
-[node name="FlagCarryComponent" type="Node"]
+[node name="FlagCarryComponent" type="Node3D"]
script = ExtResource("1_b6ee8")
diff --git a/entities/flag/flag.gd b/entities/flag/flag.gd
index 631b7f3..4f86225 100644
--- a/entities/flag/flag.gd
+++ b/entities/flag/flag.gd
@@ -9,12 +9,14 @@ signal regrabbed
signal dropped
var last_carrier : Player = null
+@onready var _mesh : Node = $Smoothing/Mesh
func can_be_grabbed() -> bool:
return flag_state != FlagState.FLAG_STATE_TAKEN
func grab(grabber : Player) -> void:
if flag_state != FlagState.FLAG_STATE_TAKEN:
+ _mesh.hide()
flag_state = FlagState.FLAG_STATE_TAKEN
if (last_carrier == null) or (grabber != last_carrier):
grabbed.emit(grabber)
@@ -24,6 +26,7 @@ func grab(grabber : Player) -> void:
func drop() -> void:
if flag_state == FlagState.FLAG_STATE_TAKEN:
+ _mesh.show()
flag_state = FlagState.FLAG_STATE_DROPPED
dropped.emit()
diff --git a/entities/flag/flag.tscn b/entities/flag/flag.tscn
index cf67430..a13f352 100644
--- a/entities/flag/flag.tscn
+++ b/entities/flag/flag.tscn
@@ -1,10 +1,12 @@
-[gd_scene load_steps=7 format=3 uid="uid://c88l3h0ph00c7"]
+[gd_scene load_steps=8 format=3 uid="uid://c88l3h0ph00c7"]
[ext_resource type="Script" path="res://entities/flag/flag.gd" id="1_y7d3d"]
+[ext_resource type="Script" path="res://addons/smoothing/smoothing.gd" id="2_es4ce"]
[ext_resource type="PackedScene" uid="uid://d3l7fvbdg6m5g" path="res://entities/flag/assets/flag.glb" id="2_i78em"]
[ext_resource type="PackedScene" uid="uid://bcgkc5fhhyauv" path="res://entities/flag/waypoint.tscn" id="3_tu6jg"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_4ymrw"]
+friction = 0.5
bounce = 0.5
[sub_resource type="BoxShape3D" id="BoxShape3D_fkf1k"]
@@ -20,6 +22,9 @@ properties/1/replication_mode = 1
properties/2/path = NodePath(".:flag_state")
properties/2/spawn = true
properties/2/replication_mode = 2
+properties/3/path = NodePath("Smoothing/Mesh:visible")
+properties/3/spawn = true
+properties/3/replication_mode = 2
[node name="Flag" type="RigidBody3D"]
collision_layer = 8
@@ -34,9 +39,6 @@ center_of_mass = Vector3(0, 0.5, 0)
continuous_cd = true
script = ExtResource("1_y7d3d")
-[node name="Mesh" parent="." instance=ExtResource("2_i78em")]
-transform = Transform3D(0.33, 0, 0, 0, 0.421029, 0, 0, 0, 0.33, 0, 0.0744106, 0)
-
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("BoxShape3D_fkf1k")
@@ -44,8 +46,14 @@ shape = SubResource("BoxShape3D_fkf1k")
[node name="MultiplayerSynchronizer" type="MultiplayerSynchronizer" parent="."]
replication_config = SubResource("SceneReplicationConfig_lpijf")
-[node name="WaypointAttachment" type="Marker3D" parent="."]
+[node name="Smoothing" type="Node3D" parent="."]
+script = ExtResource("2_es4ce")
-[node name="Waypoint" parent="WaypointAttachment" node_paths=PackedStringArray("attach_point", "flag") instance=ExtResource("3_tu6jg")]
+[node name="WaypointAttachment" type="Marker3D" parent="Smoothing"]
+
+[node name="Waypoint" parent="Smoothing/WaypointAttachment" node_paths=PackedStringArray("attach_point", "flag") instance=ExtResource("3_tu6jg")]
attach_point = NodePath("..")
-flag = NodePath("../..")
+flag = NodePath("../../..")
+
+[node name="Mesh" parent="Smoothing" instance=ExtResource("2_i78em")]
+transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0.0744106, 0)
diff --git a/entities/flag/waypoint.gd b/entities/flag/waypoint.gd
index a56a668..7911110 100644
--- a/entities/flag/waypoint.gd
+++ b/entities/flag/waypoint.gd
@@ -1,15 +1,15 @@
# 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 .
extends Control
@@ -32,15 +32,15 @@ func _process(_delta : float) -> void:
return
else:
_iff_container.show() # display the IFF
-
+
# get the screen location of the players head
var new_iff_position : Vector2 = camera.unproject_position(attach_point.global_position)
-
+
# check if the unprojected point lies inside the viewport
if !Rect2(Vector2(0, 0), viewport_rect.size).has_point(new_iff_position):
_iff_container.hide() # hide the IFF and exit function
return
-
+
# move the IFF up so the bottom of it is at the players head
new_iff_position.y -= _iff_container.size.y
# move the IFF left so it's centered horizontally above players head
diff --git a/entities/player/player.gd b/entities/player/player.gd
index f490b3a..fcf9ad4 100644
--- a/entities/player/player.gd
+++ b/entities/player/player.gd
@@ -49,10 +49,9 @@ enum PlayerState { PLAYER_ALIVE, PLAYER_DEAD }
@onready var animation_player : AnimationPlayer = $AnimationPlayer
@onready var health_component : Area3D = $HealthComponent
@onready var collision_shape : CollisionShape3D = $CollisionShape3D
-@onready var flag_carry_component : FlagCarryComponent = $FlagCarryComponent
+@onready var flag_carry_component : FlagCarryComponent = $Smoothing/SpringArm3D/FlagCarryComponent
@onready var spring_arm_height : float = $Smoothing/SpringArm3D.position.y
@onready var _original_weapon_transform : Transform3D = weapon.transform
-@onready var flag_carry_attachment : Node3D = $Smoothing/SpringArm3D/FlagCarryAttachment
@onready var tp_player : Vanguard = $Smoothing/ThirdPerson/PlayerMesh
@onready var _game_settings : Settings = get_node("/root/GlobalSettings")
@@ -86,7 +85,6 @@ func _ready() -> void:
camera.fov = _game_settings.fov
# set the spring arm translation to be about head height level
$Smoothing/SpringArm3D.transform = Transform3D().translated(Vector3(0, collision_shape.shape.height / 2, 0) * 0.9)
- flag_carry_attachment.hide()
$Smoothing.remove_child($Smoothing/ThirdPerson)
else:
diff --git a/entities/player/player.tscn b/entities/player/player.tscn
index e90e0fb..10ff523 100644
--- a/entities/player/player.tscn
+++ b/entities/player/player.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=18 format=3 uid="uid://cbhx1xme0sb7k"]
+[gd_scene load_steps=19 format=3 uid="uid://cbhx1xme0sb7k"]
[ext_resource type="Script" path="res://entities/player/player.gd" id="1_mk68k"]
[ext_resource type="PackedScene" uid="uid://drbefw6akui2v" path="res://entities/player/assets/vanguard.tscn" id="2_beyex"]
@@ -9,6 +9,7 @@
[ext_resource type="Script" path="res://entities/player/player_input.gd" id="6_ymcrr"]
[ext_resource type="PackedScene" uid="uid://dsysi2rd3bu76" path="res://interfaces/hud/iffs/iff.tscn" id="7_8hc80"]
[ext_resource type="PackedScene" uid="uid://2t8ql8pkxv6c" path="res://components/flag_carry_component.tscn" id="7_e7s1a"]
+[ext_resource type="PackedScene" uid="uid://d3l7fvbdg6m5g" path="res://entities/flag/assets/flag.glb" id="9_fce2y"]
[ext_resource type="Script" path="res://addons/smoothing/smoothing.gd" id="11_k330l"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_clur0"]
@@ -130,11 +131,6 @@ shape = ExtResource("2_vjqny")
[node name="CollisionShape3D" type="CollisionShape3D" parent="HealthComponent"]
shape = ExtResource("2_vjqny")
-[node name="FlagCarryComponent" parent="." node_paths=PackedStringArray("attachment", "sensor", "carrier") instance=ExtResource("7_e7s1a")]
-attachment = NodePath("../Smoothing/SpringArm3D/FlagCarryAttachment")
-sensor = NodePath("../Sensor")
-carrier = NodePath("..")
-
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_hg307")
@@ -174,8 +170,14 @@ holder = NodePath("../../../..")
[node name="SpineIKTarget" type="Node3D" parent="Smoothing/SpringArm3D"]
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
-[node name="FlagCarryAttachment" type="Node3D" parent="Smoothing/SpringArm3D"]
-transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, -0.620994, -0.287925)
+[node name="FlagCarryComponent" parent="Smoothing/SpringArm3D" node_paths=PackedStringArray("sensor", "carrier") instance=ExtResource("7_e7s1a")]
+transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0.150603)
+visible = false
+sensor = NodePath("../../../Sensor")
+carrier = NodePath("../../..")
+
+[node name="FlagMesh" parent="Smoothing/SpringArm3D/FlagCarryComponent" instance=ExtResource("9_fce2y")]
+transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.602515, 0)
[node name="ThirdPerson" type="Node3D" parent="Smoothing"]
diff --git a/interfaces/menus/boot/boot.tscn b/interfaces/menus/boot/boot.tscn
index 67fa3f0..66fb986 100644
--- a/interfaces/menus/boot/boot.tscn
+++ b/interfaces/menus/boot/boot.tscn
@@ -51,6 +51,9 @@ signal join_server(host : String, port : int)
@onready var modal : Control = $Modal
@onready var menu : CanvasLayer = get_parent()
+@onready var game : Node3D = get_tree().current_scene
+@onready var map_selector : OptionButton = %MapSelector
+
@export var tab_container : TabContainer
func _ready() -> void:
@@ -58,7 +61,12 @@ func _ready() -> void:
_registered_ports.compile(r'^(?:102[4-9]|10[3-9]\\d|1[1-9]\\d{2}|[2-9]\\d{3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5])$')
_join_address.compile(r'^(?[a-zA-Z0-9.-]+)(:(?:102[4-9]|10[3-9]\\d|1[1-9]\\d{2}|[2-9]\\d{3}|[1-5]\\d{4}|6[0-4]\\d{3}|65[0-4]\\d{2}|655[0-2]\\d|6553[0-5]))?$')
_load_config()
- hide() # start hidden
+ call_deferred(\"_populate_map_selector\")
+
+func _populate_map_selector() -> void:
+ for map : PackedScene in game.maps:
+ var map_name : String = map._bundled.names[0]
+ map_selector.add_item(map_name)
func _load_config() -> void:
var error : Error = _config_file.load(CONFIG_FILE_PATH)
@@ -406,6 +414,12 @@ unique_name_in_owner = true
layout_mode = 2
placeholder_text = "9000"
+[node name="MapSelector" type="OptionButton" parent="Multiplayer/MarginContainer/VBoxContainer/TabContainer/Host/MarginContainer/HBoxContainer/RightBox"]
+unique_name_in_owner = true
+layout_mode = 2
+clip_text = true
+allow_reselect = true
+
[node name="Modal" type="Panel" parent="Multiplayer"]
visible = false
layout_mode = 2
diff --git a/main.tscn b/main.tscn
index 206b589..19941cf 100644
--- a/main.tscn
+++ b/main.tscn
@@ -1,8 +1,9 @@
-[gd_scene load_steps=5 format=3 uid="uid://ma1if3sjox6i"]
+[gd_scene load_steps=6 format=3 uid="uid://ma1if3sjox6i"]
[ext_resource type="PackedScene" uid="uid://boviiugcnfyrj" path="res://modes/demo.tscn" id="1_50a80"]
[ext_resource type="PackedScene" uid="uid://bjctlqvs33nqy" path="res://interfaces/menus/boot/boot.tscn" id="1_acy5o"]
[ext_resource type="PackedScene" uid="uid://bvwxfgygm2xb8" path="res://modes/multiplayer.tscn" id="2_g8xeb"]
+[ext_resource type="Resource" uid="uid://cggykuclb5umn" path="res://maps/maps.tres" id="3_1ipir"]
[sub_resource type="GDScript" id="GDScript_e61dq"]
script/source = "class_name Game extends Node3D
@@ -11,6 +12,11 @@ script/source = "class_name Game extends Node3D
@export var SINGLEPLAYER : PackedScene
@export var MULTIPLAYER : PackedScene
+@export_category(\"Maps\")
+@export var _maps_resource : ArrayPackedSceneResource
+
+@onready var maps : Array[PackedScene] = _maps_resource.get_items()
+
var mode : Node:
set(new_mode):
# clean up previous mode
@@ -36,7 +42,7 @@ func _unhandled_input(event : InputEvent) -> void:
# reset game mode
mode = null
# check for debug build
- if not OS.is_debug_build():
+ if OS.is_debug_build():
# exit with success
get_tree().quit(0)
else:
@@ -63,7 +69,11 @@ func _start_demo() -> void:
func _start_server(port : int, nickname : String) -> void:
mode = MULTIPLAYER.instantiate()
- mode.start_server(port, nickname)
+ mode.start_server({
+ \"port\": port,
+ \"nickname\": nickname,
+ \"map\": maps[clamp($BootMenu/Multiplayer.map_selector.selected, 0, len(maps))]
+ })
$BootMenu.hide()
func _join_server(host : String, port : int, nickname : String) -> void:
@@ -77,5 +87,6 @@ func _join_server(host : String, port : int, nickname : String) -> void:
script = SubResource("GDScript_e61dq")
SINGLEPLAYER = ExtResource("1_50a80")
MULTIPLAYER = ExtResource("2_g8xeb")
+_maps_resource = ExtResource("3_1ipir")
[node name="BootMenu" parent="." instance=ExtResource("1_acy5o")]
diff --git a/maps/desert/desert.tscn b/maps/desert/desert.tscn
index f2d4f56..aab61c7 100644
--- a/maps/desert/desert.tscn
+++ b/maps/desert/desert.tscn
@@ -1,11 +1,20 @@
-[gd_scene load_steps=5 format=3 uid="uid://btlkog4b87p4x"]
+[gd_scene load_steps=6 format=3 uid="uid://btlkog4b87p4x"]
[ext_resource type="Terrain3DStorage" uid="uid://wgmg245njt8e" path="res://maps/desert/resources/storage.res" id="1_7nbyj"]
[ext_resource type="Environment" uid="uid://nw62ce5cglvs" path="res://environments/desert.tres" id="1_e1o3u"]
[ext_resource type="Terrain3DMaterial" uid="uid://c3isipd4wqxpk" path="res://maps/desert/resources/material.tres" id="2_psdr0"]
[ext_resource type="Terrain3DTextureList" uid="uid://d1j24k8sq8qpj" path="res://maps/desert/resources/textures.tres" id="3_aowug"]
+[ext_resource type="Script" path="res://maps/map.gd" id="4_cl7fm"]
-[node name="Desert" type="Node3D"]
+[node name="Desert" type="Terrain3D" node_paths=PackedStringArray("_flagstand", "_player_spawns_root")]
+storage = ExtResource("1_7nbyj")
+material = ExtResource("2_psdr0")
+texture_list = ExtResource("3_aowug")
+collision_layer = 2147483648
+collision_mask = 2147483648
+script = ExtResource("4_cl7fm")
+_flagstand = NodePath("FlagStand")
+_player_spawns_root = NodePath("PlayerSpawns")
[node name="Sunlight" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.5, 0.55667, -0.663414, 0, 0.766044, 0.642788, 0.866025, -0.321394, 0.383022, -1613.38, 2730.74, 446.64)
@@ -14,9 +23,13 @@ shadow_enabled = true
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = ExtResource("1_e1o3u")
-[node name="Terrain3D" type="Terrain3D" parent="."]
-storage = ExtResource("1_7nbyj")
-material = ExtResource("2_psdr0")
-texture_list = ExtResource("3_aowug")
-collision_layer = 2147483648
-collision_mask = 2147483648
+[node name="PlayerSpawns" type="Node" parent="."]
+
+[node name="Spawn1" type="Marker3D" parent="PlayerSpawns"]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1024, 172.13, 1024)
+
+[node name="Spawn2" type="Marker3D" parent="PlayerSpawns"]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1161.42, 174.535, 909.901)
+
+[node name="FlagStand" type="Marker3D" parent="."]
+transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 878.613, 134.55, 916.185)
diff --git a/maps/genesis/textures/ground037_alb_ht.png b/maps/genesis/assets/textures/ground037_alb_ht.png
similarity index 100%
rename from maps/genesis/textures/ground037_alb_ht.png
rename to maps/genesis/assets/textures/ground037_alb_ht.png
diff --git a/maps/genesis/textures/ground037_alb_ht.png.import b/maps/genesis/assets/textures/ground037_alb_ht.png.import
similarity index 68%
rename from maps/genesis/textures/ground037_alb_ht.png.import
rename to maps/genesis/assets/textures/ground037_alb_ht.png.import
index 3124bdb..7b0670d 100644
--- a/maps/genesis/textures/ground037_alb_ht.png.import
+++ b/maps/genesis/assets/textures/ground037_alb_ht.png.import
@@ -3,7 +3,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://ddprscrpsofah"
-path.bptc="res://.godot/imported/ground037_alb_ht.png-e94bcf81dfd35d432692c06ac781741b.bptc.ctex"
+path.bptc="res://.godot/imported/ground037_alb_ht.png-b65037b7797c79d182d5e53b32e49a98.bptc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
@@ -11,8 +11,8 @@ metadata={
[deps]
-source_file="res://maps/genesis/textures/ground037_alb_ht.png"
-dest_files=["res://.godot/imported/ground037_alb_ht.png-e94bcf81dfd35d432692c06ac781741b.bptc.ctex"]
+source_file="res://maps/genesis/assets/textures/ground037_alb_ht.png"
+dest_files=["res://.godot/imported/ground037_alb_ht.png-b65037b7797c79d182d5e53b32e49a98.bptc.ctex"]
[params]
diff --git a/maps/genesis/textures/ground037_nrm_rgh.png b/maps/genesis/assets/textures/ground037_nrm_rgh.png
similarity index 100%
rename from maps/genesis/textures/ground037_nrm_rgh.png
rename to maps/genesis/assets/textures/ground037_nrm_rgh.png
diff --git a/maps/genesis/textures/ground037_nrm_rgh.png.import b/maps/genesis/assets/textures/ground037_nrm_rgh.png.import
similarity index 68%
rename from maps/genesis/textures/ground037_nrm_rgh.png.import
rename to maps/genesis/assets/textures/ground037_nrm_rgh.png.import
index c17bdcd..466ff1a 100644
--- a/maps/genesis/textures/ground037_nrm_rgh.png.import
+++ b/maps/genesis/assets/textures/ground037_nrm_rgh.png.import
@@ -3,7 +3,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://c1ots7w6i0i1q"
-path.bptc="res://.godot/imported/ground037_nrm_rgh.png-81b0e480d48434b2b70dcb00c9b9be8a.bptc.ctex"
+path.bptc="res://.godot/imported/ground037_nrm_rgh.png-9e25ec612e0ce15ff2c117ec4096a8f7.bptc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
@@ -11,8 +11,8 @@ metadata={
[deps]
-source_file="res://maps/genesis/textures/ground037_nrm_rgh.png"
-dest_files=["res://.godot/imported/ground037_nrm_rgh.png-81b0e480d48434b2b70dcb00c9b9be8a.bptc.ctex"]
+source_file="res://maps/genesis/assets/textures/ground037_nrm_rgh.png"
+dest_files=["res://.godot/imported/ground037_nrm_rgh.png-9e25ec612e0ce15ff2c117ec4096a8f7.bptc.ctex"]
[params]
diff --git a/maps/genesis/textures/rock030_alb_ht.png b/maps/genesis/assets/textures/rock030_alb_ht.png
similarity index 100%
rename from maps/genesis/textures/rock030_alb_ht.png
rename to maps/genesis/assets/textures/rock030_alb_ht.png
diff --git a/maps/genesis/textures/rock030_alb_ht.png.import b/maps/genesis/assets/textures/rock030_alb_ht.png.import
similarity index 69%
rename from maps/genesis/textures/rock030_alb_ht.png.import
rename to maps/genesis/assets/textures/rock030_alb_ht.png.import
index be793a9..f681803 100644
--- a/maps/genesis/textures/rock030_alb_ht.png.import
+++ b/maps/genesis/assets/textures/rock030_alb_ht.png.import
@@ -3,7 +3,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://br7bfxcxh60df"
-path.bptc="res://.godot/imported/rock030_alb_ht.png-194ac44f1664ad902e6112d7c538b8ea.bptc.ctex"
+path.bptc="res://.godot/imported/rock030_alb_ht.png-264f70712792662fedd23fe3bac9e221.bptc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
@@ -11,8 +11,8 @@ metadata={
[deps]
-source_file="res://maps/genesis/textures/rock030_alb_ht.png"
-dest_files=["res://.godot/imported/rock030_alb_ht.png-194ac44f1664ad902e6112d7c538b8ea.bptc.ctex"]
+source_file="res://maps/genesis/assets/textures/rock030_alb_ht.png"
+dest_files=["res://.godot/imported/rock030_alb_ht.png-264f70712792662fedd23fe3bac9e221.bptc.ctex"]
[params]
diff --git a/maps/genesis/textures/rock030_nrm_rgh.png b/maps/genesis/assets/textures/rock030_nrm_rgh.png
similarity index 100%
rename from maps/genesis/textures/rock030_nrm_rgh.png
rename to maps/genesis/assets/textures/rock030_nrm_rgh.png
diff --git a/maps/genesis/textures/rock030_nrm_rgh.png.import b/maps/genesis/assets/textures/rock030_nrm_rgh.png.import
similarity index 68%
rename from maps/genesis/textures/rock030_nrm_rgh.png.import
rename to maps/genesis/assets/textures/rock030_nrm_rgh.png.import
index 37878b0..814d712 100644
--- a/maps/genesis/textures/rock030_nrm_rgh.png.import
+++ b/maps/genesis/assets/textures/rock030_nrm_rgh.png.import
@@ -3,7 +3,7 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://cr72kjil43vgj"
-path.bptc="res://.godot/imported/rock030_nrm_rgh.png-4c72231defef9c07b29c49d8904a13df.bptc.ctex"
+path.bptc="res://.godot/imported/rock030_nrm_rgh.png-ca17d43269b25394f8e7aa1fa0631681.bptc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
@@ -11,8 +11,8 @@ metadata={
[deps]
-source_file="res://maps/genesis/textures/rock030_nrm_rgh.png"
-dest_files=["res://.godot/imported/rock030_nrm_rgh.png-4c72231defef9c07b29c49d8904a13df.bptc.ctex"]
+source_file="res://maps/genesis/assets/textures/rock030_nrm_rgh.png"
+dest_files=["res://.godot/imported/rock030_nrm_rgh.png-ca17d43269b25394f8e7aa1fa0631681.bptc.ctex"]
[params]
diff --git a/maps/vortex/vortex_2048.r16 b/maps/genesis/assets/vortex.r16
similarity index 100%
rename from maps/vortex/vortex_2048.r16
rename to maps/genesis/assets/vortex.r16
diff --git a/maps/genesis/genesis.tscn b/maps/genesis/genesis.tscn
index f42b769..321fd8a 100644
--- a/maps/genesis/genesis.tscn
+++ b/maps/genesis/genesis.tscn
@@ -7,54 +7,40 @@
[ext_resource type="Terrain3DTextureList" uid="uid://dnqa8kxgm3xuw" path="res://maps/genesis/resources/textures.res" id="3_1cww7"]
[ext_resource type="AudioStream" uid="uid://bfve0qppqo17j" path="res://sounds/ambiance/Systematic Sound - General Ambience Series - Rural Countryside 01/AMBRurl_Meadow Open Plane Windy Deep Rumble_SYSO_SYSO011-1.tres" id="6_xrtaj"]
-[sub_resource type="CapsuleMesh" id="CapsuleMesh_k2vhq"]
-
-[sub_resource type="CapsuleMesh" id="CapsuleMesh_5ytwx"]
-
-[node name="Map" type="Node" node_paths=PackedStringArray("_flagstand", "_player_spawns_root")]
-script = ExtResource("1_6ysiv")
-_flagstand = NodePath("Terrain3D/FlagPillar/CSGCylinder3D/FlagStand")
-_player_spawns_root = NodePath("Terrain3D/PlayerSpawns")
-
-[node name="Terrain3D" type="Terrain3D" parent="."]
+[node name="Genesis" type="Terrain3D" node_paths=PackedStringArray("_flagstand", "_player_spawns_root")]
storage = ExtResource("1_a88qe")
material = ExtResource("2_o2y3d")
texture_list = ExtResource("3_1cww7")
collision_layer = 2147483648
collision_mask = 2147483648
mesh_size = 24
+script = ExtResource("1_6ysiv")
+_flagstand = NodePath("FlagPillar/CSGCylinder3D/FlagStand")
+_player_spawns_root = NodePath("PlayerSpawns")
-[node name="PlayerSpawns" type="Node" parent="Terrain3D"]
+[node name="PlayerSpawns" type="Node" parent="."]
-[node name="Spawn1" type="Marker3D" parent="Terrain3D/PlayerSpawns"]
+[node name="Spawn1" type="Marker3D" parent="PlayerSpawns"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 95.5378, -32.735)
-visible = false
-[node name="MeshInstance3D" type="MeshInstance3D" parent="Terrain3D/PlayerSpawns/Spawn1"]
-mesh = SubResource("CapsuleMesh_k2vhq")
-
-[node name="Spawn2" type="Marker3D" parent="Terrain3D/PlayerSpawns"]
+[node name="Spawn2" type="Marker3D" parent="PlayerSpawns"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 9, 98.3078, 18.061)
-visible = false
-[node name="MeshInstance3D" type="MeshInstance3D" parent="Terrain3D/PlayerSpawns/Spawn2"]
-mesh = SubResource("CapsuleMesh_5ytwx")
-
-[node name="FlagPillar" type="CSGCombiner3D" parent="Terrain3D"]
+[node name="FlagPillar" type="CSGCombiner3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 2.83726, 0, 0, 0, 1, 0, 94.6411, 0)
use_collision = true
collision_layer = 2147483648
collision_mask = 0
-[node name="CSGBox3D" type="CSGBox3D" parent="Terrain3D/FlagPillar"]
+[node name="CSGBox3D" type="CSGBox3D" parent="FlagPillar"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.9311, 0)
size = Vector3(0.5, 6, 0.5)
-[node name="CSGCylinder3D" type="CSGCylinder3D" parent="Terrain3D/FlagPillar"]
+[node name="CSGCylinder3D" type="CSGCylinder3D" parent="FlagPillar"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.42967, 0)
height = 5.0
-[node name="FlagStand" type="Marker3D" parent="Terrain3D/FlagPillar/CSGCylinder3D"]
+[node name="FlagStand" type="Marker3D" parent="FlagPillar/CSGCylinder3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.53822, 0)
[node name="Sunlight" type="DirectionalLight3D" parent="."]
diff --git a/maps/genesis/resources/textures.res b/maps/genesis/resources/textures.res
index 3338f1e..33a685e 100644
Binary files a/maps/genesis/resources/textures.res and b/maps/genesis/resources/textures.res differ
diff --git a/maps/map.gd b/maps/map.gd
index 4406366..62b9cf4 100644
--- a/maps/map.gd
+++ b/maps/map.gd
@@ -1,4 +1,4 @@
-class_name Map extends Node
+class_name Map extends Terrain3D
@export var _flagstand : Node3D
@export var _player_spawns_root : Node
diff --git a/maps/maps.tres b/maps/maps.tres
new file mode 100644
index 0000000..62115c3
--- /dev/null
+++ b/maps/maps.tres
@@ -0,0 +1,9 @@
+[gd_resource type="Resource" script_class="ArrayPackedSceneResource" load_steps=4 format=3 uid="uid://cggykuclb5umn"]
+
+[ext_resource type="PackedScene" uid="uid://chbno00ugl6te" path="res://maps/genesis/genesis.tscn" id="1_7kpvp"]
+[ext_resource type="PackedScene" uid="uid://btlkog4b87p4x" path="res://maps/desert/desert.tscn" id="2_8vsif"]
+[ext_resource type="Script" path="res://types/resources/array_packed_scene.gd" id="3_by6r1"]
+
+[resource]
+script = ExtResource("3_by6r1")
+_packed_scenes = Array[PackedScene]([ExtResource("1_7kpvp"), ExtResource("2_8vsif")])
diff --git a/modes/multiplayer.gd b/modes/multiplayer.gd
index 5131256..9f077f7 100644
--- a/modes/multiplayer.gd
+++ b/modes/multiplayer.gd
@@ -15,7 +15,6 @@
class_name Multiplayer extends Node
@export_category("Parameters")
-@export var MAP : PackedScene
@export var PLAYER : PackedScene
@export var FLAG : PackedScene
@export var MAX_CLIENTS : int = 24
@@ -38,15 +37,20 @@ func _ready() -> void:
_flag_carrier_scoring_timer.timeout.connect(_on_flag_carrier_scoring_timer_timeout)
add_child(_flag_carrier_scoring_timer)
-func start_server(port : int, nickname : String) -> void:
+func start_server(config : Dictionary) -> void:
+ # Check if required parameters are missing
+ var required_params : Array[String] = ["port", "map", "nickname"]
+ for param in required_params:
+ if not config.has(param):
+ print("Missing param in server config:", param)
+ return
+ # server setup
var peer : ENetMultiplayerPeer = ENetMultiplayerPeer.new()
- peer.create_server(port, MAX_CLIENTS)
-
+ peer.create_server(config["port"], MAX_CLIENTS)
multiplayer.multiplayer_peer = peer
-
- _load_map.call_deferred(MAP, nickname)
-
multiplayer.peer_disconnected.connect(remove_player)
+
+ _load_map.call_deferred(config["map"], config["nickname"])
func join_server(host : String, port : int, nickname : String) -> void:
var peer : ENetMultiplayerPeer = ENetMultiplayerPeer.new()
diff --git a/modes/multiplayer.tscn b/modes/multiplayer.tscn
index e0f93f6..bf5c98c 100644
--- a/modes/multiplayer.tscn
+++ b/modes/multiplayer.tscn
@@ -1,6 +1,5 @@
-[gd_scene load_steps=6 format=3 uid="uid://bvwxfgygm2xb8"]
+[gd_scene load_steps=5 format=3 uid="uid://bvwxfgygm2xb8"]
-[ext_resource type="PackedScene" uid="uid://chbno00ugl6te" path="res://maps/genesis/genesis.tscn" id="1_nulvv"]
[ext_resource type="Script" path="res://modes/multiplayer.gd" id="1_r1kd6"]
[ext_resource type="PackedScene" uid="uid://cbhx1xme0sb7k" path="res://entities/player/player.tscn" id="2_og1vb"]
[ext_resource type="PackedScene" uid="uid://c88l3h0ph00c7" path="res://entities/flag/flag.tscn" id="3_h0rie"]
@@ -8,7 +7,6 @@
[node name="Multiplayer" type="Node"]
script = ExtResource("1_r1kd6")
-MAP = ExtResource("1_nulvv")
PLAYER = ExtResource("2_og1vb")
FLAG = ExtResource("3_h0rie")
diff --git a/tests/test_scoreboard.gd b/tests/test_scoreboard.gd
index 2e38007..1a65c6d 100644
--- a/tests/test_scoreboard.gd
+++ b/tests/test_scoreboard.gd
@@ -15,7 +15,7 @@
extends GutTest
var PLAYER : PackedScene = preload("res://entities/player/player.tscn")
-var SCOREBOARD : PackedScene = preload("res://interfaces/hud/scoreboard.tscn")
+var SCOREBOARD : PackedScene = preload("res://interfaces/scoreboard/scoreboard.tscn")
var _subject : Scoreboard
diff --git a/types/resources/array_packed_scene.gd b/types/resources/array_packed_scene.gd
new file mode 100644
index 0000000..cf2a2ee
--- /dev/null
+++ b/types/resources/array_packed_scene.gd
@@ -0,0 +1,6 @@
+class_name ArrayPackedSceneResource extends Resource
+
+@export var _packed_scenes : Array[PackedScene] = []
+
+func get_items() -> Array[PackedScene]:
+ return _packed_scenes
diff --git a/types/resources/array_packed_scene.tres b/types/resources/array_packed_scene.tres
new file mode 100644
index 0000000..163e7d4
--- /dev/null
+++ b/types/resources/array_packed_scene.tres
@@ -0,0 +1,7 @@
+[gd_resource type="Resource" script_class="ArrayPackedSceneResource" load_steps=2 format=3 uid="uid://cpnargstkucch"]
+
+[ext_resource type="Script" path="res://types/resources/array_packed_scene.gd" id="1_r1ygd"]
+
+[resource]
+script = ExtResource("1_r1ygd")
+_packed_scenes = Array[PackedScene]([])