Prep for forgejo migration.
This commit is contained in:
parent
882ef67c42
commit
56d77fbb53
6 changed files with 324 additions and 83 deletions
|
@ -21,7 +21,7 @@ func join_game():
|
|||
multiplayer.multiplayer_peer = peer
|
||||
|
||||
func is_valid(sender_id, must_be_from_owner):
|
||||
if must_be_from_owner:
|
||||
if must_be_from_owner and Game.player_list.has(0):
|
||||
if sender_id == Game.player_list.keys()[0] or Game.is_server:
|
||||
return true
|
||||
for id in Game.player_list:
|
||||
|
@ -39,7 +39,7 @@ func _on_server_disconnected():
|
|||
func _on_player_disconnected(id):
|
||||
var x = 0
|
||||
for i in Game.player_list:
|
||||
if i == id:
|
||||
if i == id and get_tree().root.has_node("./"+Game.map_name+"/player"+str(x)):
|
||||
var current_character = get_tree().root.get_node("./"+Game.map_name+"/player"+str(x))
|
||||
if current_character.hp == 0:
|
||||
Game.dead -= 1
|
||||
|
@ -50,10 +50,10 @@ func _on_player_disconnected(id):
|
|||
Game.players = 0
|
||||
else:
|
||||
Game.players -= 1
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
current_character.free()
|
||||
if current_character.captured_by != null:
|
||||
current_character.captured_by.lost_one()
|
||||
await get_tree().create_timer(0.5).timeout
|
||||
current_character.free()
|
||||
x += 1
|
||||
Game.player_list.erase(id)
|
||||
|
||||
|
|
|
@ -88,6 +88,5 @@ func _on_option_button_item_selected(index):
|
|||
for id in Game.player_list:
|
||||
Client.rpc_id(id, "sync_level", map_name)
|
||||
|
||||
func _sync_options():
|
||||
for id in Game.player_list:
|
||||
Client.rpc_id(id, "sync_level", map_name)
|
||||
func _sync_options(id):
|
||||
Client.rpc_id(id, "sync_level", map_name)
|
||||
|
|
|
@ -17,6 +17,7 @@ var is_running = false
|
|||
var frozen = 0
|
||||
var dead = 0
|
||||
var escaped = 0
|
||||
var result = "You Lose"
|
||||
var player_escaped = false
|
||||
var is_beast = false
|
||||
var character = preload("res://objects/player.tscn")
|
||||
|
@ -56,6 +57,11 @@ func has_escaped():
|
|||
|
||||
func _process(_delta):
|
||||
if is_running and players <= 0:
|
||||
if player_escaped or (is_beast and escaped == 0):
|
||||
result = "You Win"
|
||||
else:
|
||||
result = "You Lose"
|
||||
Game.reset()
|
||||
get_tree().change_scene_to_file("res://menus/result.tscn")
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
is_running = false
|
||||
|
|
|
@ -10,10 +10,8 @@
|
|||
extends Control
|
||||
|
||||
func _ready():
|
||||
if Game.player_escaped or (Game.is_beast and Game.escaped == 0):
|
||||
$VBoxContainer/Label.text = "You Win"
|
||||
else:
|
||||
$VBoxContainer/Label.text = "You Lose"
|
||||
$VBoxContainer/Label.text = Game.result
|
||||
Game.result = "You Lose"
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue