mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-01-19 19:44:46 +00:00
👽️ save state
This commit is contained in:
parent
5b20ac2f2a
commit
32a1b73cee
|
|
@ -7,6 +7,7 @@ signal nickname_changed(new_nickname : String)
|
|||
set(value):
|
||||
player_id = value
|
||||
player_id_changed.emit(player_id)
|
||||
|
||||
@export var team_id : int = 1
|
||||
@export var nickname : String = "<Newblood>":
|
||||
set(value):
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ func _process(_delta : float) -> void:
|
|||
if not _is_pawn():
|
||||
tp_player.global_transform.basis = Basis.from_euler(Vector3(0.0, input.camera_rotation.x + PI, 0.0))
|
||||
elif not %Inventory/SpaceGun/Mesh/AnimationPlayer.is_playing():
|
||||
%Inventory/SpaceGun/Mesh/AnimationPlayer.play("idle")
|
||||
%Inventory/SpaceGun/Mesh/AnimationPlayer.play("idle")
|
||||
%SpringArm3D.global_transform.basis = Basis.from_euler(Vector3(input.camera_rotation.y, input.camera_rotation.x, 0.0))
|
||||
|
||||
func _physics_process(delta : float) -> void:
|
||||
|
|
|
|||
|
|
@ -39,14 +39,11 @@ func _ready() -> void:
|
|||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta : float) -> void:
|
||||
|
||||
var velocity_xz : Vector3 = player.linear_velocity
|
||||
velocity_xz.y = 0
|
||||
|
||||
text = \"\"
|
||||
text += \"fps: %d (%.2f mspf)\\n\" % [Engine.get_frames_per_second(), 1000.0 / Engine.get_frames_per_second()]
|
||||
text += \"position: %d, %d, %d\\n\" % [player.position.x, player.position.y, player.position.z]
|
||||
text += \"speed: %d km/h\\n\" % (player.linear_velocity.length() * 3.6)
|
||||
var velocity_xz := Vector3(player.linear_velocity.x, 0., player.linear_velocity.z)
|
||||
text += \"speed_xz: %d km/h\\n\" % (velocity_xz.length() * 3.6)
|
||||
var viewport_render_size : Vector2i = get_viewport().size * get_viewport().scaling_3d_scale
|
||||
text += \"3D viewport resolution: %d × %d (%d%%)\\n\" \\
|
||||
|
|
@ -148,6 +145,7 @@ value = 60.0
|
|||
show_percentage = false
|
||||
|
||||
[node name="Spacer" type="Control" parent="MarginContainer/HBoxContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 0.8
|
||||
|
|
|
|||
|
|
@ -320,7 +320,6 @@ func _ready() -> void:
|
|||
self.item_selected.emit(self.selected)
|
||||
|
||||
func _on_item_selected(index: int) -> void:
|
||||
print(\"here\")
|
||||
Settings.set_value(\"ui\", \"scale\", clamp(index, 0, 2))
|
||||
# When the screen changes size, we need to update the 3D
|
||||
# viewport quality setting. If we don't do this, the viewport will take
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
[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://boviiugcnfyrj" path="res://modes/singleplayer/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/multiplayer.tscn" id="2_g8xeb"]
|
||||
[ext_resource type="Resource" uid="uid://dut5f1sq0wfeb" path="res://maps/maps.tres" id="3_1ipir"]
|
||||
|
|
@ -95,8 +95,8 @@ func _start_server(port : int, nickname : String) -> void:
|
|||
|
||||
func _join_server(host : String, port : int, nickname : String) -> void:
|
||||
mode = MULTIPLAYER.instantiate()
|
||||
mode.connected_to_server.connect($BootMenu/Multiplayer._on_connected_to_server)
|
||||
mode.connection_failed.connect($BootMenu/Multiplayer._on_connection_failed)
|
||||
mode.connected_to_server.connect($BootMenu/MultiplayerPanelContainer._on_connected_to_server)
|
||||
mode.connection_failed.connect($BootMenu/MultiplayerPanelContainer._on_connection_failed)
|
||||
mode.join_server(host, port, nickname)
|
||||
"
|
||||
|
||||
|
|
|
|||
|
|
@ -71,9 +71,6 @@ func add_player(peer_id : int, nickname : String) -> void:
|
|||
var player : Player = PLAYER.instantiate()
|
||||
players.add_child(player)
|
||||
player.name = str(peer_id)
|
||||
player.player_id = peer_id
|
||||
player.team_id = team_chasers.team_id
|
||||
player.nickname = nickname
|
||||
player.global_position = MapsManager.get_player_spawn().position
|
||||
player.died.connect(_on_player_died)
|
||||
player.match_participant_component.player_id = peer_id
|
||||
|
|
|
|||
|
|
@ -34,9 +34,10 @@ spawn_path = NodePath("../Objectives")
|
|||
[node name="Scoreboard" parent="." instance=ExtResource("5_uj0pp")]
|
||||
visible = false
|
||||
|
||||
[node name="RabbitScoringComponent" type="Node" parent="." node_paths=PackedStringArray("_scoreboard")]
|
||||
[node name="RabbitScoringComponent" type="Node" parent="."]
|
||||
script = ExtResource("5_7woao")
|
||||
_scoreboard = NodePath("../Scoreboard")
|
||||
_scoreboard = Object(Control,"_import_path":NodePath(""),"unique_name_in_owner":false,"process_mode":0,"process_priority":0,"process_physics_priority":0,"process_thread_group":0,"editor_description":"","visible":false,"modulate":Color(1, 1, 1, 1),"self_modulate":Color(1, 1, 1, 1),"show_behind_parent":false,"top_level":false,"clip_children":0,"light_mask":1,"visibility_layer":1,"z_index":0,"z_as_relative":true,"y_sort_enabled":false,"texture_filter":0,"texture_repeat":0,"material":null,"use_parent_material":false,"clip_contents":false,"custom_minimum_size":Vector2(0, 0),"layout_direction":0,"layout_mode":3,"anchors_preset":15,"anchor_left":0.0,"anchor_top":0.0,"anchor_right":1.0,"anchor_bottom":1.0,"offset_left":0.0,"offset_top":0.0,"offset_right":0.0,"offset_bottom":0.0,"grow_horizontal":2,"grow_vertical":2,"rotation":0.0,"scale":Vector2(1, 1),"pivot_offset":Vector2(0, 0),"size_flags_horizontal":1,"size_flags_vertical":1,"size_flags_stretch_ratio":1.0,"auto_translate":true,"localize_numeral_system":true,"tooltip_text":"","focus_neighbor_left":NodePath(""),"focus_neighbor_top":NodePath(""),"focus_neighbor_right":NodePath(""),"focus_neighbor_bottom":NodePath(""),"focus_next":NodePath(""),"focus_previous":NodePath(""),"focus_mode":0,"mouse_filter":0,"mouse_force_pass_scroll_events":true,"mouse_default_cursor_shape":0,"shortcut_context":null,"theme":null,"theme_type_variation":&"","script":Resource("res://interfaces/scoreboard/scoreboard.gd"),"_entries":{})
|
||||
|
||||
|
||||
[node name="DeathmatchScoringComponent" type="Node" parent="." node_paths=PackedStringArray("_players", "_scoreboard")]
|
||||
script = ExtResource("6_iov4u")
|
||||
|
|
|
|||
27
modes/singleplayer/demo.gd
Normal file
27
modes/singleplayer/demo.gd
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# 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 Singleplayer extends Node
|
||||
|
||||
@onready var player_node : Player = $Player
|
||||
@onready var target_dummy : RigidBody3D = $TargetDummy
|
||||
@onready var player_respawn_location : Vector3 = player_node.position
|
||||
|
||||
func _ready() -> void:
|
||||
player_node.died.connect(respawn_player)
|
||||
player_node.match_participant_component.player_id = 1
|
||||
MapsManager.current_map = $Desert
|
||||
|
||||
func respawn_player(player : Player, _killer_id : int) -> void:
|
||||
player.respawn(player_respawn_location)
|
||||
|
|
@ -1,51 +1,21 @@
|
|||
[gd_scene load_steps=7 format=3 uid="uid://boviiugcnfyrj"]
|
||||
|
||||
[ext_resource type="Script" path="res://modes/singleplayer/demo.gd" id="1_kkjqs"]
|
||||
[ext_resource type="PackedScene" uid="uid://cbhx1xme0sb7k" path="res://entities/player/player.tscn" id="2_6wbjq"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpnu1lvfncx6q" path="res://entities/target_dummy/target_dummy.tscn" id="3_fkq5v"]
|
||||
[ext_resource type="PackedScene" uid="uid://c88l3h0ph00c7" path="res://entities/flag/flag.tscn" id="4_1j2pw"]
|
||||
[ext_resource type="PackedScene" uid="uid://btlkog4b87p4x" path="res://maps/desert/desert.tscn" id="4_dogmv"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_iv0l6"]
|
||||
script/source = "# 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/>.
|
||||
extends Node
|
||||
|
||||
@onready var player_node : Player = $Player
|
||||
@onready var target_dummy : RigidBody3D = $TargetDummy
|
||||
|
||||
@onready var player_respawn_location : Vector3 = player_node.position
|
||||
|
||||
func _ready() -> void:
|
||||
player_node.died.connect(respawn_player)
|
||||
player_node.match_participant_component.player_id = 1
|
||||
MapsManager.current_map = $Desert
|
||||
|
||||
func respawn_player(player : Player, _killer_id : int) -> void:
|
||||
player.respawn(player_respawn_location)
|
||||
"
|
||||
|
||||
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_c5jqv"]
|
||||
resource_local_to_scene = true
|
||||
bounce = 1.0
|
||||
absorbent = true
|
||||
|
||||
[node name="Demo" type="Node"]
|
||||
script = SubResource("GDScript_iv0l6")
|
||||
script = ExtResource("1_kkjqs")
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("2_6wbjq")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 589.786, 210.119, 853.632)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 589.786, 209.119, 853.632)
|
||||
physics_material_override = SubResource("PhysicsMaterial_c5jqv")
|
||||
|
||||
[node name="TargetDummy" parent="." instance=ExtResource("3_fkq5v")]
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
class_name Team extends Object
|
||||
|
||||
var team_id : int
|
||||
|
||||
func _init(id : int) -> void:
|
||||
team_id = id
|
||||
|
|
@ -15,3 +15,6 @@
|
|||
class_name Team extends Object
|
||||
|
||||
var team_id : int
|
||||
|
||||
func _init(id : int) -> void:
|
||||
team_id = id
|
||||
|
|
|
|||
Loading…
Reference in a new issue