Bandage for #35
This commit is contained in:
parent
6183e16fcb
commit
686e2e9159
6 changed files with 61 additions and 26 deletions
|
@ -61,23 +61,24 @@ func _unhandled_input(event):
|
||||||
|
|
||||||
# Clamps the camera
|
# Clamps the camera
|
||||||
camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-50), deg_to_rad(60))
|
camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-50), deg_to_rad(60))
|
||||||
if menuOpen == false:
|
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
|
||||||
|
add_child(scene)
|
||||||
|
elif menuOpen == true:
|
||||||
|
if Global.miniMenuResume == true:
|
||||||
|
menuOpen = false
|
||||||
|
Global.miniMenuResume = false
|
||||||
|
elif Global.miniMenuResume == false:
|
||||||
if Input.is_action_just_pressed("menu"):
|
if Input.is_action_just_pressed("menu"):
|
||||||
menuOpen = true
|
|
||||||
var scene_trs = load("res://scenes/mainmenu.tscn")
|
|
||||||
var scene = scene_trs.instantiate()
|
|
||||||
globalscene = scene
|
|
||||||
add_child(scene)
|
|
||||||
elif menuOpen == true:
|
|
||||||
if Global.miniMenuResume == true:
|
|
||||||
menuOpen = false
|
menuOpen = false
|
||||||
Global.miniMenuResume = false
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||||
elif Global.miniMenuResume == false:
|
if globalscene:
|
||||||
if Input.is_action_just_pressed("menu"):
|
globalscene.queue_free()
|
||||||
menuOpen = false
|
|
||||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
|
||||||
if globalscene:
|
|
||||||
globalscene.queue_free()
|
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
if is_multiplayer_authority():
|
if is_multiplayer_authority():
|
||||||
|
|
|
@ -68,6 +68,7 @@ offset_bottom = 369.0
|
||||||
text = "Master Volume"
|
text = "Master Volume"
|
||||||
|
|
||||||
[node name="volumeSlider" type="HSlider" parent="."]
|
[node name="volumeSlider" type="HSlider" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
offset_left = 487.0
|
offset_left = 487.0
|
||||||
offset_top = 380.0
|
offset_top = 380.0
|
||||||
offset_right = 671.0
|
offset_right = 671.0
|
||||||
|
|
|
@ -75,6 +75,35 @@ func reset_variables():
|
||||||
playerAlive = true
|
playerAlive = true
|
||||||
playerPleaseRespawn = false
|
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():
|
func save_data():
|
||||||
SettingsFile.save_data(mouseSensitivity, playerName, volumeModifer)
|
SettingsFile.save_data(mouseSensitivity, playerName, volumeModifer)
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,7 @@ func _ready():
|
||||||
$Button.disabled = false
|
$Button.disabled = false
|
||||||
$AudioStreamPlayer.playing = false
|
$AudioStreamPlayer.playing = false
|
||||||
if Global.playingGame == false:
|
if Global.playingGame == false:
|
||||||
Global.connectedPlayers = []
|
Global.reset_variables_hard()
|
||||||
Networking.connected_peers = []
|
|
||||||
$musicPanel.visible = true
|
$musicPanel.visible = true
|
||||||
$musicPanel/playingLabel.text = musicName
|
$musicPanel/playingLabel.text = musicName
|
||||||
$musicPanel/authorLabel.text = musicAuthor
|
$musicPanel/authorLabel.text = musicAuthor
|
||||||
|
|
|
@ -19,19 +19,23 @@ func create_server(port, maxPlayers):
|
||||||
|
|
||||||
peer.peer_connected.connect(
|
peer.peer_connected.connect(
|
||||||
func(new_peer_id):
|
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
|
await get_tree().create_timer(0.5).timeout ## REQUIRED, THE RPC IS MADE BEFORE THE CLIENT IS FULLY CONNECTED
|
||||||
rpc_id(new_peer_id, "sync_names", Global.connectedPlayers)
|
if connected_peers.has(new_peer_id):
|
||||||
rpc_id(new_peer_id, "sync_respawn_speed", Global.respawnTimeModifier)
|
print("CONFLICT ID FOUND")
|
||||||
rpc_id(new_peer_id, "sync_gamemode", Global.gamemode)
|
return
|
||||||
rpc_id(new_peer_id, "sync_mapName", Global.mapName)
|
else:
|
||||||
rpc("add_newly_connected_player_character", new_peer_id)
|
print("NEW CONNECTION FROM ", new_peer_id)
|
||||||
rpc_id(new_peer_id, "add_previously_connected_player_characters", connected_peers)
|
rpc_id(new_peer_id, "sync_names", Global.connectedPlayers)
|
||||||
add_player_node(new_peer_id)
|
rpc_id(new_peer_id, "sync_respawn_speed", Global.respawnTimeModifier)
|
||||||
|
rpc_id(new_peer_id, "sync_gamemode", Global.gamemode)
|
||||||
|
rpc_id(new_peer_id, "sync_mapName", Global.mapName)
|
||||||
|
rpc("add_newly_connected_player_character", new_peer_id)
|
||||||
|
rpc_id(new_peer_id, "add_previously_connected_player_characters", connected_peers)
|
||||||
|
add_player_node(new_peer_id)
|
||||||
)
|
)
|
||||||
|
|
||||||
### NOT WORKING YET
|
### NOT WORKING YET
|
||||||
peer.peer_disconnected.disconnect(
|
peer.peer_disconnected.connect(
|
||||||
func(peer_id):
|
func(peer_id):
|
||||||
rpc("disconnect_peer", peer_id)
|
rpc("disconnect_peer", peer_id)
|
||||||
)
|
)
|
||||||
|
|
|
@ -10,6 +10,7 @@ func _process(delta):
|
||||||
|
|
||||||
|
|
||||||
func _on_yes_button_pressed():
|
func _on_yes_button_pressed():
|
||||||
|
Networking.peer.close()
|
||||||
Global.playingGame = false
|
Global.playingGame = false
|
||||||
get_tree().change_scene_to_file(Global.goScene)
|
get_tree().change_scene_to_file(Global.goScene)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue