Bandage for #35
This commit is contained in:
parent
6183e16fcb
commit
686e2e9159
6 changed files with 61 additions and 26 deletions
|
@ -64,6 +64,7 @@ func _unhandled_input(event):
|
|||
if menuOpen == false:
|
||||
if Input.is_action_just_pressed("menu"):
|
||||
menuOpen = true
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
var scene_trs = load("res://scenes/mainmenu.tscn")
|
||||
var scene = scene_trs.instantiate()
|
||||
globalscene = scene
|
||||
|
|
|
@ -68,6 +68,7 @@ offset_bottom = 369.0
|
|||
text = "Master Volume"
|
||||
|
||||
[node name="volumeSlider" type="HSlider" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 487.0
|
||||
offset_top = 380.0
|
||||
offset_right = 671.0
|
||||
|
|
|
@ -75,6 +75,35 @@ func reset_variables():
|
|||
playerAlive = true
|
||||
playerPleaseRespawn = false
|
||||
|
||||
func reset_variables_hard():
|
||||
print("Variables were HARD reset")
|
||||
fatigue = 100
|
||||
playerHealth = 100
|
||||
playerDead = false
|
||||
playerAlive = true
|
||||
playerPleaseRespawn = false
|
||||
connectedPlayers = []
|
||||
Networking.connected_peers = []
|
||||
connectedPlayersByPeerID = []
|
||||
roundInSession = false
|
||||
playingGame = false
|
||||
consoleOpen = false
|
||||
godMode = false
|
||||
multiplayerCurrent = false
|
||||
teddyAuthorityID = null
|
||||
miniMenuResume = false
|
||||
HUDStartLabelText = ""
|
||||
lastPersonToHitMe = 0
|
||||
HUDPlayerDied = false
|
||||
respawnTimeModifier = 1.0
|
||||
menuLightSwitch = false
|
||||
gamemode = "Deathmatch"
|
||||
chosenRunner = null
|
||||
iAmRunner = false
|
||||
runnerDead = false
|
||||
roundTimer = 300.0
|
||||
spawnCoordsInitalized = false
|
||||
|
||||
func save_data():
|
||||
SettingsFile.save_data(mouseSensitivity, playerName, volumeModifer)
|
||||
|
||||
|
|
|
@ -17,8 +17,7 @@ func _ready():
|
|||
$Button.disabled = false
|
||||
$AudioStreamPlayer.playing = false
|
||||
if Global.playingGame == false:
|
||||
Global.connectedPlayers = []
|
||||
Networking.connected_peers = []
|
||||
Global.reset_variables_hard()
|
||||
$musicPanel.visible = true
|
||||
$musicPanel/playingLabel.text = musicName
|
||||
$musicPanel/authorLabel.text = musicAuthor
|
||||
|
|
|
@ -19,8 +19,12 @@ func create_server(port, maxPlayers):
|
|||
|
||||
peer.peer_connected.connect(
|
||||
func(new_peer_id):
|
||||
print("NEW CONNECTION FROM ", new_peer_id)
|
||||
await get_tree().create_timer(0.5).timeout ## REQUIRED, THE RPC IS MADE BEFORE THE CLIENT IS FULLY CONNECTED
|
||||
if connected_peers.has(new_peer_id):
|
||||
print("CONFLICT ID FOUND")
|
||||
return
|
||||
else:
|
||||
print("NEW CONNECTION FROM ", new_peer_id)
|
||||
rpc_id(new_peer_id, "sync_names", Global.connectedPlayers)
|
||||
rpc_id(new_peer_id, "sync_respawn_speed", Global.respawnTimeModifier)
|
||||
rpc_id(new_peer_id, "sync_gamemode", Global.gamemode)
|
||||
|
@ -31,7 +35,7 @@ func create_server(port, maxPlayers):
|
|||
)
|
||||
|
||||
### NOT WORKING YET
|
||||
peer.peer_disconnected.disconnect(
|
||||
peer.peer_disconnected.connect(
|
||||
func(peer_id):
|
||||
rpc("disconnect_peer", peer_id)
|
||||
)
|
||||
|
|
|
@ -10,6 +10,7 @@ func _process(delta):
|
|||
|
||||
|
||||
func _on_yes_button_pressed():
|
||||
Networking.peer.close()
|
||||
Global.playingGame = false
|
||||
get_tree().change_scene_to_file(Global.goScene)
|
||||
|
||||
|
|
Loading…
Reference in a new issue