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
|
||||
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"):
|
||||
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
|
||||
Global.miniMenuResume = false
|
||||
elif Global.miniMenuResume == false:
|
||||
if Input.is_action_just_pressed("menu"):
|
||||
menuOpen = false
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
if globalscene:
|
||||
globalscene.queue_free()
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
if globalscene:
|
||||
globalscene.queue_free()
|
||||
|
||||
func _physics_process(delta):
|
||||
if is_multiplayer_authority():
|
||||
|
|
|
@ -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,19 +19,23 @@ 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
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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
|
||||
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