summaryrefslogtreecommitdiff
path: root/scripts/GameBase.gd
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/GameBase.gd')
-rw-r--r--scripts/GameBase.gd22
1 files changed, 21 insertions, 1 deletions
diff --git a/scripts/GameBase.gd b/scripts/GameBase.gd
index 019aa14..571ba84 100644
--- a/scripts/GameBase.gd
+++ b/scripts/GameBase.gd
@@ -16,6 +16,7 @@ var is_chatting = false
var winddir = Vector3(1,0,0)
func _process(delta):
+ $HUD/Health.text = str(player_char.health) if player_char != null else ""
if is_local:
local_server_tree.idle(delta)
@@ -67,6 +68,12 @@ remote func game_update_chars():
remote func game_chat_msg(msg):
$HUD.ui_chat_msg(msg)
+remotesync func game_hitsound():
+ $HUD.ui_play_hitsound()
+
+remotesync func game_killsound():
+ $HUD.ui_play_killsound()
+
func select_character(dest):
print(dest)
if player_char == null:
@@ -78,7 +85,20 @@ func client_disconnect():
if player_char != null:
player_char.deselect_character()
client.close_connection()
- get_tree().quit()
+ if is_local:
+ local_server_tree.free()
+ back_to_main()
+
+func _connection_lost():
+ if is_local:
+ local_server_tree.free()
+ back_to_main()
+
+func back_to_main():
+ var main_menu = load("res://ui/MainMenu.tscn").instance()
+ get_tree().get_root().add_child(main_menu)
+ get_tree().get_root().remove_child(self)
+ queue_free()
func join_team(team):
if player_char != null: