Milestone 8 preparations 1

This commit is contained in:
Patrick_Pluto 2024-08-13 20:43:54 +02:00
parent 8b97a6ee7e
commit c9211b444e
26 changed files with 101 additions and 104 deletions

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/corner.gltf-d27aae84dacf6337afe0f777beb3d2f1.
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/crouch.gltf-ace5d02cb4e9e58f95c55709db549ec7.
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/floor.gltf-f41589b4f800248085aa506db510082f.s
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/frame.gltf-0e20b27650c04f11c1dfb68fc46aec12.s
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/inverted_corner.gltf-4b1ca22cbccec7314454316f
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/jump.gltf-7b6f835bd8b0695f3d758d786ce34d46.sc
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/jump_corner.gltf-48aab81343564dd20cd29f0bff34
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/jump_corner2.gltf-1a7d50337cb83e920dddd62bf38
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/stairs_1.gltf-b3faa75abaaa7744f04f516ad6700ff
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/stairs_2.gltf-53572c3c4bb5f3c8f79adfd45fe4bc2
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/stairs_3.gltf-22172a41fb8ad833b8941bfa6111f36
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/stairs_4.gltf-ab34f22899c6169c343831413f326e6
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/stairs_5.gltf-152ac59889e35702f24b64bc9de6062
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/stairs_6.gltf-59e685ed83ebcebad32d89c3ed47a83
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/stairs_7.gltf-a512293401a4d8fe9ae86955a71ea78
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -13,7 +13,7 @@ dest_files=["res://.godot/imported/wall.gltf-5a937a3e90517c0241c6d52793662436.sc
[params]
nodes/root_type="MeshInstance3D"
nodes/root_type="Node3D"
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0

View file

@ -34,13 +34,13 @@ offset_bottom = 32.0
grow_horizontal = 2
grow_vertical = 2
[node name="name" type="TextEdit" parent="player_customization"]
[node name="name" type="LineEdit" parent="player_customization"]
custom_minimum_size = Vector2(256, 64)
layout_mode = 2
theme_override_font_sizes/font_size = 32
placeholder_text = "Username"
[node name="ip" type="TextEdit" parent="player_customization"]
[node name="ip" type="LineEdit" parent="player_customization"]
custom_minimum_size = Vector2(256, 64)
layout_mode = 2
theme_override_font_sizes/font_size = 32

View file

@ -45,12 +45,6 @@ size_flags_vertical = 8
theme_override_font_sizes/font_size = 32
text = "Settings"
[node name="matchmaking" type="Button" parent="main_content"]
layout_mode = 2
size_flags_vertical = 8
theme_override_font_sizes/font_size = 32
text = "Matchmaking Server (DEBUG)"
[node name="ver_string" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 3
@ -71,4 +65,3 @@ horizontal_alignment = 2
[connection signal="pressed" from="main_content/join" to="." method="_on_join_pressed"]
[connection signal="pressed" from="main_content/settings" to="." method="_on_settings_pressed"]
[connection signal="pressed" from="main_content/matchmaking" to="." method="_on_matchmaking_pressed"]

View file

@ -54,12 +54,48 @@ layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Matchmaking Server IP"
[node name="TextEdit" type="TextEdit" parent="VBoxContainer/ip"]
custom_minimum_size = Vector2(400, 56)
[node name="LineEdit" type="LineEdit" parent="VBoxContainer/ip"]
custom_minimum_size = Vector2(500, 56)
layout_mode = 2
theme_override_font_sizes/font_size = 32
placeholder_text = "Matchmaking Server IP"
script = ExtResource("3_faw6x")
[node name="port" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="Label" type="Label" parent="VBoxContainer/port"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Matchmaking Server Port"
[node name="LineEdit" type="LineEdit" parent="VBoxContainer/port"]
custom_minimum_size = Vector2(500, 56)
layout_mode = 2
theme_override_font_sizes/font_size = 32
placeholder_text = "Matchmaking Server Port"
script = ExtResource("3_faw6x")
[node name="username" type="HBoxContainer" parent="VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
[node name="Label" type="Label" parent="VBoxContainer/username"]
layout_mode = 2
theme_override_font_sizes/font_size = 32
text = "Username"
[node name="LineEdit" type="LineEdit" parent="VBoxContainer/username"]
custom_minimum_size = Vector2(500, 56)
layout_mode = 2
theme_override_font_sizes/font_size = 32
placeholder_text = "Username"
script = ExtResource("3_faw6x")
[connection signal="item_selected" from="VBoxContainer/fps_counter/OptionButton" to="VBoxContainer/fps_counter/OptionButton" method="_on_item_selected"]
[connection signal="text_changed" from="VBoxContainer/ip/TextEdit" to="VBoxContainer/ip/TextEdit" method="_on_text_changed"]
[connection signal="text_changed" from="VBoxContainer/ip/LineEdit" to="VBoxContainer/ip/LineEdit" method="_on_text_changed"]
[connection signal="text_changed" from="VBoxContainer/port/LineEdit" to="VBoxContainer/port/LineEdit" method="_on_text_changed"]
[connection signal="text_changed" from="VBoxContainer/username/LineEdit" to="VBoxContainer/username/LineEdit" method="_on_text_changed"]

View file

@ -6,6 +6,7 @@
size = Vector3(2, 1.75, 1.5)
[sub_resource type="BoxShape3D" id="BoxShape3D_nfndi"]
size = Vector3(4, 1, 2.5)
[node name="computers" type="StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
@ -18,16 +19,17 @@ shape = SubResource("BoxShape3D_bvobj")
[node name="desk" type="CSGBox3D" parent="."]
size = Vector3(2, 1, 1.5)
[node name="pc_1_area" type="Area3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.875, 0.5)
[node name="CollisionShape3D" type="CollisionShape3D" parent="pc_1_area"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.75, -0.125)
shape = SubResource("BoxShape3D_nfndi")
[node name="pc_1" type="CSGBox3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.875, 0.5)
size = Vector3(1, 0.75, 0.25)
[node name="pc_1_area" type="Area3D" parent="pc_1"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="pc_1/pc_1_area"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.75, 0.875)
shape = SubResource("BoxShape3D_nfndi")
[node name="Label3D" type="Label3D" parent="pc_1"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.13)
text = "0"
@ -36,12 +38,6 @@ text = "0"
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0.75, 0.875, 0)
size = Vector3(1, 0.75, 0.25)
[node name="pc_2_area" type="Area3D" parent="pc_2"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="pc_2/pc_2_area"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.75, 0.875)
shape = SubResource("BoxShape3D_nfndi")
[node name="Label3D" type="Label3D" parent="pc_2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.13)
text = "0"
@ -50,12 +46,6 @@ text = "0"
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, -0.75, 0.875, 0)
size = Vector3(1, 0.75, 0.25)
[node name="pc_3_area" type="Area3D" parent="pc_3"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="pc_3/pc_3_area"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.75, 0.875)
shape = SubResource("BoxShape3D_nfndi")
[node name="Label3D" type="Label3D" parent="pc_3"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.55271e-15, 0, 0.13)
text = "0"
@ -63,10 +53,6 @@ text = "0"
[node name="computer_tick" type="Timer" parent="."]
autostart = true
[connection signal="body_entered" from="pc_1/pc_1_area" to="." method="_on_pc_1_area_body_entered"]
[connection signal="body_exited" from="pc_1/pc_1_area" to="." method="_on_pc_1_area_body_exited"]
[connection signal="body_entered" from="pc_2/pc_2_area" to="." method="_on_pc_2_area_body_entered"]
[connection signal="body_exited" from="pc_2/pc_2_area" to="." method="_on_pc_2_area_body_exited"]
[connection signal="body_entered" from="pc_3/pc_3_area" to="." method="_on_pc_3_area_body_entered"]
[connection signal="body_exited" from="pc_3/pc_3_area" to="." method="_on_pc_3_area_body_exited"]
[connection signal="body_entered" from="pc_1_area" to="." method="_on_pc_1_area_body_entered"]
[connection signal="body_exited" from="pc_1_area" to="." method="_on_pc_1_area_body_exited"]
[connection signal="timeout" from="computer_tick" to="." method="_on_computer_tick_timeout"]

View file

@ -17,7 +17,7 @@ func _ready():
func join_game():
var peer = ENetMultiplayerPeer.new()
peer.create_client(Game.settings["ip"], Game.settings["port"])
peer.create_client(Game.settings["ip"], int(Game.settings["port"]))
multiplayer.multiplayer_peer = peer
func is_valid(sender_id, must_be_from_owner):

View file

@ -12,16 +12,16 @@ extends StaticBody3D
const TARGET = 100
var current = 0
var pc_occupied = [0, 0, 0]
var pc_occupied = 0
var pc_body = [0, 0, 0]
var pc_body = []
func _ready():
Game.computers += 1
func _on_computer_tick_timeout():
if Game.is_server:
current += (pc_occupied[0] + pc_occupied[1] + pc_occupied[2])
current += pc_occupied
for id in Game.player_list:
Client.rpc_id(id,"sync_computers",name, current)
if current >= TARGET:
@ -34,36 +34,11 @@ func _on_computer_tick_timeout():
func _on_pc_1_area_body_entered(body):
if pc_occupied[0] == 0 and body is CharacterBody3D and !body.beast:
pc_occupied[0] = 1
pc_body[0] = body
func _on_pc_2_area_body_entered(body):
if pc_occupied[1] == 0 and body is CharacterBody3D and !body.beast:
pc_occupied[1] = 1
pc_body[1] = body
func _on_pc_3_area_body_entered(body):
if pc_occupied[2] == 0 and body is CharacterBody3D and !body.beast:
pc_occupied[2] = 1
pc_body[2] = body
if pc_occupied < 3 and body is CharacterBody3D and !body.beast and body not in pc_body:
pc_occupied += 1
pc_body.append(body)
func _on_pc_1_area_body_exited(body):
if pc_occupied[0] == 1 and body is CharacterBody3D and body == pc_body[0]:
pc_occupied[0] = 0
pc_body[0] = 0
func _on_pc_2_area_body_exited(body):
if pc_occupied[1] == 1 and body is CharacterBody3D and body == pc_body[1]:
pc_occupied[1] = 0
pc_body[1] = 0
func _on_pc_3_area_body_exited(body):
if pc_occupied[2] == 1 and body is CharacterBody3D and body == pc_body[2]:
pc_occupied[2] = 0
pc_body[2] = 0
if pc_occupied < 3 and body is CharacterBody3D and body in pc_body:
pc_occupied -= 1
pc_body.erase(body)

View file

@ -9,7 +9,7 @@
extends Node
var settings = {"save_version" = 3, "fps_counter" = 1, "port" = 35000, "ip" = "127.0.0.1"}
var settings = {"save_version" = 4, "fps_counter" = 1, "port" = 35000, "ip" = "127.0.0.1", "username" = "DefaultName"}
var computers = 0
var players = 0
var map_name = "mansion"
@ -79,6 +79,7 @@ func reset():
func save_setting(setting_name, value):
settings[setting_name] = value
Save.saveJSON("user://settings.json", settings)
print("saved")
func apply_settings():
players = player_list.size() - 1
@ -111,9 +112,10 @@ func player_hit(target, beast):
beast.got_one(target)
func sync_player(node_name, position, rotation):
var current_character = get_tree().root.get_node("./"+map_name+"/"+node_name)
current_character.position = position
current_character.rotation = rotation
if get_tree().root.has_node("./"+map_name+"/"+node_name):
var current_character = get_tree().root.get_node("./"+map_name+"/"+node_name)
current_character.position = position
current_character.rotation = rotation
func sync_hammer(node_name, rotation):
var current_character = get_tree().root.get_node("./"+map_name+"/"+node_name+"/hammer")

View file

@ -10,7 +10,7 @@
extends Control
func matchmaking():
get_tree().root.get_node("./main_menu").hide()
Matchmaking.create_game()
func _ready():
Game.reset()
@ -18,7 +18,7 @@ func _ready():
$main_content/matchmaking.hide()
$main_content/matchmaking.disabled = true
if DisplayServer.get_name() == "headless":
_on_matchmaking_pressed()
matchmaking()
func _on_join_pressed():
get_tree().change_scene_to_file("res://menus/create.tscn")
@ -27,9 +27,3 @@ func _on_join_pressed():
func _on_settings_pressed():
get_tree().change_scene_to_file("res://menus/settings.tscn")
func _on_matchmaking_pressed():
Matchmaking.create_game()
matchmaking()

View file

@ -69,11 +69,11 @@ func _physics_process(delta):
position.y += 1
if Input.is_action_pressed("click") and $hammer.rotation_degrees.x > 0:
$hammer.rotation_degrees.x -= 5
$hammer.rotation_degrees.x -= 10
for id in Game.player_list:
Client.rpc_id(id,"sync_hammer",name, $hammer.rotation)
elif $hammer.rotation_degrees.x < 90 and !Input.is_action_pressed("click"):
$hammer.rotation_degrees.x += 5
$hammer.rotation_degrees.x += 10
for id in Game.player_list:
Client.rpc_id(id,"sync_hammer",name, $hammer.rotation)

View file

@ -1,7 +1,18 @@
extends TextEdit
## freeftf
## Copyright (C) 2024 Patrick_Pluto
##
## 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/>.
extends LineEdit
func _ready():
text = Game.settings[get_parent().name]
text = str(Game.settings[get_parent().name])
func _on_text_changed():
func _on_text_changed(new_text):
Game.save_setting(get_parent().name, text)