Fix all HUDs of players being shown, rather than just the local player

remotes/1705382094874458415/tmp_refs/heads/godot4-port
Jan 2020-09-29 23:24:33 +02:00
parent 2f3fcc6337
commit 23a4bf0bad
5 changed files with 11 additions and 20 deletions

View File

@ -8,17 +8,3 @@ func updateCrosshair(visible: bool, hit: bool):
$Crosshair.visible = visible
if hit:
$Crosshair/HitConfirmation.activate(0.2)
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass

View File

@ -205,10 +205,7 @@ sync func check_players(player_names):
player.translation += Vector3(0.0, 3.0, 0.0)
if player_name == str(get_tree().get_network_unique_id()):
player.camera.current = true
player.set_network_master(get_tree().get_network_unique_id())
local_player = player
player.set_local_player()
func add_player(id, check=true):
var player = player_scene.instance()

View File

@ -88,9 +88,9 @@ text = "Quit"
[node name="ConnectMenu" type="VBoxContainer" parent="MenuContainer"]
visible = false
margin_left = 312.0
margin_top = 216.0
margin_top = 212.0
margin_right = 712.0
margin_bottom = 384.0
margin_bottom = 388.0
rect_min_size = Vector2( 400, 0 )
[node name="Back" type="Button" parent="MenuContainer/ConnectMenu"]

View File

@ -325,6 +325,13 @@ func _input(event):
if event.is_action_pressed("WeaponPrimary"):
shoot()
func set_local_player():
set_network_master(get_tree().get_network_unique_id())
game.local_player = self
camera.current = true
$HUD.show()
# Called when the node enters the scene tree for the first time.
func _ready():
set_health(150)

View File

@ -70,3 +70,4 @@ SoundClip = "res://Assets/SFX/Player-Pain-01.wav"
MinDelay = 0.2
[node name="HUD" parent="." instance=ExtResource( 3 )]
visible = false