Merge pull request 'Fix for respawn flashing the_adventures_of_teddy/public_issues#12' (#7) from respawn-tele-fix into main
Reviewed-on: #7
This commit is contained in:
commit
dbd4148b9c
2 changed files with 18 additions and 12 deletions
|
@ -86,6 +86,8 @@ func _physics_process(delta):
|
||||||
if is_multiplayer_authority():
|
if is_multiplayer_authority():
|
||||||
# This variable gets set my the death scene, so we know the player needs to be respawned
|
# This variable gets set my the death scene, so we know the player needs to be respawned
|
||||||
if Global.playerPleaseRespawn == true:
|
if Global.playerPleaseRespawn == true:
|
||||||
|
if not Global.respawnLocationChosen:
|
||||||
|
Global.respawnLocationChosen = true
|
||||||
get_node(teddyCollider).disabled = false
|
get_node(teddyCollider).disabled = false
|
||||||
var ramMax = Global.spawnCoords_x.size() - 1
|
var ramMax = Global.spawnCoords_x.size() - 1
|
||||||
var ramnum = RandomNumberGenerator.new().randi_range(0, ramMax)
|
var ramnum = RandomNumberGenerator.new().randi_range(0, ramMax)
|
||||||
|
@ -94,6 +96,7 @@ func _physics_process(delta):
|
||||||
position.x = Global.spawnCoords_x[ramnum] #Set player X
|
position.x = Global.spawnCoords_x[ramnum] #Set player X
|
||||||
position.y = Global.spawnCoords_y[ramnum] #Set player Y
|
position.y = Global.spawnCoords_y[ramnum] #Set player Y
|
||||||
position.z = Global.spawnCoords_z[ramnum] #Set player Z
|
position.z = Global.spawnCoords_z[ramnum] #Set player Z
|
||||||
|
velocity = Vector3.ZERO
|
||||||
await get_tree().create_timer(0.5).timeout
|
await get_tree().create_timer(0.5).timeout
|
||||||
Global.reset_variables()
|
Global.reset_variables()
|
||||||
ranRemovePlayer = false
|
ranRemovePlayer = false
|
||||||
|
|
|
@ -53,6 +53,7 @@ var tutorialTimerCompleted = false # Used for after the timer goes off in the tu
|
||||||
var playerDisable = false # Can be used to disable the player
|
var playerDisable = false # Can be used to disable the player
|
||||||
var playerDeathHealth = 100 # Can be changed by death.gd
|
var playerDeathHealth = 100 # Can be changed by death.gd
|
||||||
var kickAllPlayers = false # Can be set to true to kick all players in-game
|
var kickAllPlayers = false # Can be set to true to kick all players in-game
|
||||||
|
var respawnLocationChosen = false # When set to false, the game will be allowed to select a spawnpoint for the player
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
spawn_locations()
|
spawn_locations()
|
||||||
|
@ -74,6 +75,7 @@ func player_dead():
|
||||||
if deathShield <= 0:
|
if deathShield <= 0:
|
||||||
deathShield = 50
|
deathShield = 50
|
||||||
if playerAlive:
|
if playerAlive:
|
||||||
|
respawnLocationChosen = false
|
||||||
print("Player be deaddddd brooooooo")
|
print("Player be deaddddd brooooooo")
|
||||||
var scene_trs =load("res://scenes/death.tscn")
|
var scene_trs =load("res://scenes/death.tscn")
|
||||||
var scene=scene_trs.instantiate()
|
var scene=scene_trs.instantiate()
|
||||||
|
@ -124,6 +126,7 @@ func reset_variables_hard():
|
||||||
playerDisable = false
|
playerDisable = false
|
||||||
playerDeathHealth = 100
|
playerDeathHealth = 100
|
||||||
kickAllPlayers = false
|
kickAllPlayers = false
|
||||||
|
respawnLocationChosen = false
|
||||||
|
|
||||||
func save_data():
|
func save_data():
|
||||||
SettingsFile.save_data()
|
SettingsFile.save_data()
|
||||||
|
|
Loading…
Reference in a new issue