mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-01-19 19:44:46 +00:00
✨ rename game manager
This commit is contained in:
parent
32c80ea79a
commit
f7fbbed014
|
|
@ -103,7 +103,7 @@ func _setup_pawn(_new_player_id : int) -> void:
|
|||
|
||||
func _is_pawn() -> bool:
|
||||
var peer_is_pawn : bool = multiplayer.get_unique_id() == match_participant_component.player_id
|
||||
return GameManager.mode is Singleplayer or peer_is_pawn
|
||||
return Game.mode is Singleplayer or peer_is_pawn
|
||||
|
||||
# @NOTE: this method works only because `tp_mesh` duplicates weapons meshes from the inventory
|
||||
func _on_inventory_selection_changed(_selected : Node3D, index : int) -> void:
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ func trigger() -> void:
|
|||
owner.match_participant_component
|
||||
)
|
||||
# add to owner of player for now
|
||||
GameManager.mode.add_child(projectile)
|
||||
Game.mode.add_child(projectile)
|
||||
projectile.shape_cast.add_exception(owner)
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ func trigger() -> void:
|
|||
owner.match_participant_component
|
||||
)
|
||||
# add to owner of player for now
|
||||
GameManager.mode.add_child(projectile)
|
||||
Game.mode.add_child(projectile)
|
||||
|
||||
func _on_visibility_changed() -> void:
|
||||
if self.visible:
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ func trigger() -> void:
|
|||
owner.match_participant_component
|
||||
)
|
||||
# add to owner of player for now
|
||||
GameManager.mode.add_child(projectile)
|
||||
Game.mode.add_child(projectile)
|
||||
# ensure projectile does not collide with owner
|
||||
var collider : ShapeCast3D = projectile.shape_cast
|
||||
collider.add_exception(owner)
|
||||
|
|
|
|||
26
main.tscn
26
main.tscn
|
|
@ -19,7 +19,7 @@ script/source = "# This file is part of open-fpsz.
|
|||
#
|
||||
# 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 Game extends Node3D
|
||||
extends Node3D
|
||||
|
||||
@export_category(\"Modes\")
|
||||
@export var SINGLEPLAYER : PackedScene
|
||||
|
|
@ -28,8 +28,8 @@ class_name Game extends Node3D
|
|||
func _ready() -> void:
|
||||
# only run server in headless
|
||||
if DisplayServer.get_name() == \"headless\":
|
||||
GameManager.mode = MULTIPLAYER.instantiate()
|
||||
GameManager.mode.start_server(9000, MapsManager.maps[MapsManager._rng.randi_range(0, len(MapsManager.maps) - 1)])
|
||||
Game.mode = MULTIPLAYER.instantiate()
|
||||
Game.mode.start_server(9000, MapsManager.maps[MapsManager._rng.randi_range(0, len(MapsManager.maps) - 1)])
|
||||
return
|
||||
# connect boot menu signals
|
||||
$BootMenu.start_demo.connect(_start_demo)
|
||||
|
|
@ -41,12 +41,12 @@ func _ready() -> void:
|
|||
|
||||
func _unhandled_input(event : InputEvent) -> void:
|
||||
if event.is_action_pressed(\"exit\"):
|
||||
if GameManager.mode is Multiplayer:
|
||||
if Game.mode is Multiplayer:
|
||||
$BootMenu._on_multiplayer_pressed()
|
||||
else:
|
||||
$BootMenu._on_main_menu_pressed()
|
||||
# reset game mode and get back to main menu
|
||||
GameManager.mode = null
|
||||
Game.mode = null
|
||||
if DisplayServer.get_name() != \"headless\":
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
return
|
||||
|
|
@ -66,25 +66,25 @@ func _unhandled_input(event : InputEvent) -> void:
|
|||
|
||||
|
||||
func _start_demo() -> void:
|
||||
GameManager.mode = SINGLEPLAYER.instantiate()
|
||||
Game.mode = SINGLEPLAYER.instantiate()
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
$BootMenu.hide()
|
||||
|
||||
func _start_server(port : int, nickname : String) -> void:
|
||||
GameManager.mode = MULTIPLAYER.instantiate()
|
||||
GameManager.mode.start_server(port, MapsManager.maps[$BootMenu/MultiplayerPanelContainer.map_selector.selected], nickname)
|
||||
Game.mode = MULTIPLAYER.instantiate()
|
||||
Game.mode.start_server(port, MapsManager.maps[$BootMenu/MultiplayerPanelContainer.map_selector.selected], nickname)
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
$BootMenu.hide()
|
||||
|
||||
func _join_server(host : String, port : int, nickname : String) -> void:
|
||||
GameManager.mode = MULTIPLAYER.instantiate()
|
||||
GameManager.mode.connected_to_server.connect($BootMenu/MultiplayerPanelContainer._on_connected_to_server)
|
||||
GameManager.mode.connection_failed.connect($BootMenu/MultiplayerPanelContainer._on_connection_failed)
|
||||
GameManager.mode.join_server(host, port, nickname)
|
||||
Game.mode = MULTIPLAYER.instantiate()
|
||||
Game.mode.connected_to_server.connect($BootMenu/MultiplayerPanelContainer._on_connected_to_server)
|
||||
Game.mode.connection_failed.connect($BootMenu/MultiplayerPanelContainer._on_connection_failed)
|
||||
Game.mode.join_server(host, port, nickname)
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
"
|
||||
|
||||
[node name="Game" type="Node3D"]
|
||||
[node name="Main" type="Node3D"]
|
||||
script = SubResource("GDScript_e61dq")
|
||||
SINGLEPLAYER = ExtResource("1_vgk6g")
|
||||
MULTIPLAYER = ExtResource("2_iumx3")
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ config/icon="res://icon.svg"
|
|||
|
||||
Settings="*res://systems/settings.gd"
|
||||
MapsManager="*res://systems/maps_manager.gd"
|
||||
GameManager="*res://systems/game_manager.gd"
|
||||
Game="*res://systems/game.gd"
|
||||
|
||||
[debug]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue