👽️ save state

This commit is contained in:
anyreso 2024-04-27 18:02:16 -04:00
parent 5b20ac2f2a
commit 32a1b73cee
11 changed files with 43 additions and 53 deletions

View file

@ -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

View file

@ -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")

View 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)

View file

@ -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")]

View file

@ -1,6 +0,0 @@
class_name Team extends Object
var team_id : int
func _init(id : int) -> void:
team_id = id