feat: implement core movement, combat, weapon management, and networking systems
This commit is contained in:
@@ -13,6 +13,11 @@ func _ready() -> void:
|
||||
var nm = get_node_or_null("/root/NetworkManager")
|
||||
if nm:
|
||||
nm.connection_succeeded.connect(_on_connection_succeeded)
|
||||
|
||||
# Auto-open lobby if returning to main menu while still connected
|
||||
if nm.multiplayer.has_multiplayer_peer() and not nm.multiplayer.multiplayer_peer is OfflineMultiplayerPeer:
|
||||
call_deferred("_on_connection_succeeded")
|
||||
call_deferred("_hide_ui_vbox")
|
||||
|
||||
# ==========================================
|
||||
# BACKGROUND: 3D DIORAMA (Sliding Player)
|
||||
@@ -242,6 +247,31 @@ func _ready() -> void:
|
||||
)
|
||||
hl_left.add_child(_gamemode_opt)
|
||||
|
||||
var time_label = Label.new()
|
||||
time_label.text = "Match Duration"
|
||||
time_label.add_theme_font_size_override("font_size", 32)
|
||||
hl_left.add_child(time_label)
|
||||
|
||||
var _time_opt = OptionButton.new()
|
||||
_time_opt.add_theme_font_size_override("font_size", 24)
|
||||
_time_opt.add_item("1 Minute", 0)
|
||||
_time_opt.add_item("3 Minutes", 1)
|
||||
_time_opt.add_item("5 Minutes", 2)
|
||||
_time_opt.add_item("10 Minutes", 3)
|
||||
_time_opt.add_item("15 Minutes", 4)
|
||||
_time_opt.select(2) # Default 5 Minutes
|
||||
_time_opt.add_to_group("host_only_ui")
|
||||
_time_opt.item_selected.connect(func(index: int):
|
||||
var net_man = get_node_or_null("/root/NetworkManager")
|
||||
if net_man:
|
||||
if index == 0: net_man.match_duration_setting = 60.0
|
||||
elif index == 1: net_man.match_duration_setting = 180.0
|
||||
elif index == 2: net_man.match_duration_setting = 300.0
|
||||
elif index == 3: net_man.match_duration_setting = 600.0
|
||||
elif index == 4: net_man.match_duration_setting = 900.0
|
||||
)
|
||||
hl_left.add_child(_time_opt)
|
||||
|
||||
var hl_spacer = Control.new()
|
||||
hl_spacer.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
hl_left.add_child(hl_spacer)
|
||||
@@ -410,9 +440,12 @@ func _on_network_player_disconnected(_id: int) -> void:
|
||||
_update_lobby_players()
|
||||
|
||||
func _update_lobby_players() -> void:
|
||||
if not _host_lobby_players_list: return
|
||||
if not is_inside_tree() or not _host_lobby_players_list: return
|
||||
|
||||
var nm = get_node_or_null("/root/NetworkManager")
|
||||
if not nm: return
|
||||
|
||||
_host_lobby_players_list.clear()
|
||||
var nm = get_node("/root/NetworkManager")
|
||||
|
||||
for pid in nm.player_stats.keys():
|
||||
var p_name = nm.player_stats[pid].get("username", "Unknown")
|
||||
@@ -438,6 +471,10 @@ func _on_settings_pressed() -> void:
|
||||
func _on_exit_pressed() -> void:
|
||||
get_tree().quit()
|
||||
|
||||
func _hide_ui_vbox() -> void:
|
||||
if _ui_vbox:
|
||||
_ui_vbox.hide()
|
||||
|
||||
# ==========================================
|
||||
# 3D DIORAMA BUILDER
|
||||
# ==========================================
|
||||
|
||||
Reference in New Issue
Block a user